mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Apply suggestions from code review
Co-authored-by: Nordsoft91 <nordsoft@yahoo.com>
This commit is contained in:
@ -67,7 +67,7 @@ public:
|
|||||||
virtual void setCampaignBonus(int bonusId) const = 0;
|
virtual void setCampaignBonus(int bonusId) const = 0;
|
||||||
virtual void setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts = {}) 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 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 setPlayerOption(ui8 what, int32_t value, PlayerColor player) const = 0;
|
||||||
virtual void setDifficulty(int to) const = 0;
|
virtual void setDifficulty(int to) const = 0;
|
||||||
virtual void setTurnTimerInfo(const TurnTimerInfo &) const = 0;
|
virtual void setTurnTimerInfo(const TurnTimerInfo &) const = 0;
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
void setCampaignBonus(int bonusId) const override;
|
void setCampaignBonus(int bonusId) const override;
|
||||||
void setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts = {}) const override;
|
void setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts = {}) const override;
|
||||||
void setPlayer(PlayerColor color) 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 setPlayerOption(ui8 what, int32_t value, PlayerColor player) const override;
|
||||||
void setDifficulty(int to) const override;
|
void setDifficulty(int to) const override;
|
||||||
void setTurnTimerInfo(const TurnTimerInfo &) const override;
|
void setTurnTimerInfo(const TurnTimerInfo &) const override;
|
||||||
|
@ -1145,7 +1145,7 @@ void OptionsTab::PlayerOptionsEntry::clickReleased(const Point & cursorPosition)
|
|||||||
changeName();
|
changeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsTab::PlayerOptionsEntry::changeName() {
|
void OptionsTab::PlayerOptionsEntry::updateName() {
|
||||||
if(labelPlayerNameEdit->getText() != name)
|
if(labelPlayerNameEdit->getText() != name)
|
||||||
{
|
{
|
||||||
CSH->setPlayerName(s->color, labelPlayerNameEdit->getText());
|
CSH->setPlayerName(s->color, labelPlayerNameEdit->getText());
|
||||||
|
@ -196,6 +196,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
const OptionsTab & parentTab;
|
const OptionsTab & parentTab;
|
||||||
|
|
||||||
void changeName();
|
void updateName();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -845,7 +845,7 @@ void CVCMIServer::setPlayerName(PlayerColor color, std::string name)
|
|||||||
if(!player.isControlledByHuman())
|
if(!player.isControlledByHuman())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!player.connectedPlayerIDs.size())
|
if(player.connectedPlayerIDs.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int nameID = *(player.connectedPlayerIDs.begin()); //if not AI - set appropiate ID
|
int nameID = *(player.connectedPlayerIDs.begin()); //if not AI - set appropiate ID
|
||||||
|
Reference in New Issue
Block a user