Sfoglia il codice sorgente

Apply suggestions from code review

Co-authored-by: Nordsoft91 <[email protected]>
Laserlicht 2 anni fa
parent
commit
0a1578b797

+ 2 - 2
client/CServerHandler.h

@@ -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;

+ 1 - 1
client/lobby/OptionsTab.cpp

@@ -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());

+ 1 - 1
client/lobby/OptionsTab.h

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

+ 1 - 1
server/CVCMIServer.cpp

@@ -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