1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

Apply suggestions from code review

Co-authored-by: Nordsoft91 <nordsoft@yahoo.com>
This commit is contained in:
Laserlicht 2023-10-16 21:24:59 +02:00 committed by GitHub
parent f6843c0574
commit 0a1578b797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public:
virtual void setCampaignBonus(int bonusId) const = 0;
virtual void setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts = {}) const = 0;
virtual void setPlayer(PlayerColor color) const = 0;
virtual void setPlayerName(PlayerColor color, std::string name) const = 0;
virtual void setPlayerName(PlayerColor color, const std::string & name) const = 0;
virtual void setPlayerOption(ui8 what, int32_t value, PlayerColor player) const = 0;
virtual void setDifficulty(int to) const = 0;
virtual void setTurnTimerInfo(const TurnTimerInfo &) const = 0;
@ -153,7 +153,7 @@ public:
void setCampaignBonus(int bonusId) const override;
void setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts = {}) const override;
void setPlayer(PlayerColor color) const override;
void setPlayerName(PlayerColor color, std::string name) const override;
void setPlayerName(PlayerColor color, const std::string & name) const override;
void setPlayerOption(ui8 what, int32_t value, PlayerColor player) const override;
void setDifficulty(int to) const override;
void setTurnTimerInfo(const TurnTimerInfo &) const override;

View File

@ -1145,7 +1145,7 @@ void OptionsTab::PlayerOptionsEntry::clickReleased(const Point & cursorPosition)
changeName();
}
void OptionsTab::PlayerOptionsEntry::changeName() {
void OptionsTab::PlayerOptionsEntry::updateName() {
if(labelPlayerNameEdit->getText() != name)
{
CSH->setPlayerName(s->color, labelPlayerNameEdit->getText());

View File

@ -196,6 +196,6 @@ private:
private:
const OptionsTab & parentTab;
void changeName();
void updateName();
};
};

View File

@ -845,7 +845,7 @@ void CVCMIServer::setPlayerName(PlayerColor color, std::string name)
if(!player.isControlledByHuman())
return;
if(!player.connectedPlayerIDs.size())
if(player.connectedPlayerIDs.empty())
return;
int nameID = *(player.connectedPlayerIDs.begin()); //if not AI - set appropiate ID