Ver código fonte

Code cleanup

Ivan Savenko 1 ano atrás
pai
commit
d700e94189

+ 1 - 1
Mods/vcmi/config/vcmi/english.json

@@ -87,7 +87,7 @@
 	"vcmi.lobby.header.history" : "Your Previous Games",
 	"vcmi.lobby.header.players" : "Players Online - %d",
 	"vcmi.lobby.match.solo" : "Singleplayer Game",
-	"vcmi.lobby.match.duel" : "Game with %s",
+	"vcmi.lobby.match.duel" : "Game with %s", // %s -> nickname of another player
 	"vcmi.lobby.match.multi" : "%d players",
 	"vcmi.lobby.room.create" : "Create New Room",
 	"vcmi.lobby.room.players.limit" : "Players Limit",

+ 1 - 1
Mods/vcmi/config/vcmi/ukrainian.json

@@ -86,7 +86,7 @@
 	"vcmi.lobby.header.history" : "Ваші попередні ігри",
 	"vcmi.lobby.header.players" : "Гравці в мережі - %d",
 	"vcmi.lobby.match.solo" : "Одиночна гра",
-	"vcmi.lobby.match.duel" : "Гра з %s",
+	"vcmi.lobby.match.duel" : "Гра з %s", // %s -> nickname of another player
 	"vcmi.lobby.match.multi" : "%d гравців",
 	"vcmi.lobby.room.create" : "Створити нову кімнату",
 	"vcmi.lobby.room.players.limit" : "Максимум гравців",

+ 3 - 3
client/globalLobby/GlobalLobbyInviteWindow.cpp

@@ -24,7 +24,7 @@
 #include "../../lib/MetaString.h"
 #include "../../lib/json/JsonNode.h"
 
-GlobalLobbyInviteAccountCard::GlobalLobbyInviteAccountCard(GlobalLobbyInviteWindow * window, const GlobalLobbyAccount & accountDescription)
+GlobalLobbyInviteAccountCard::GlobalLobbyInviteAccountCard(const GlobalLobbyAccount & accountDescription)
 	: accountID(accountDescription.accountID)
 {
 	pos.w = 200;
@@ -60,12 +60,12 @@ GlobalLobbyInviteWindow::GlobalLobbyInviteWindow()
 		pos.w / 2, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, MetaString::createFromTextID("vcmi.lobby.invite.header").toString()
 	);
 
-	const auto & createAccountCardCallback = [this](size_t index) -> std::shared_ptr<CIntObject>
+	const auto & createAccountCardCallback = [](size_t index) -> std::shared_ptr<CIntObject>
 	{
 		const auto & accounts = CSH->getGlobalLobby().getActiveAccounts();
 
 		if(index < accounts.size())
-			return std::make_shared<GlobalLobbyInviteAccountCard>(this, accounts[index]);
+			return std::make_shared<GlobalLobbyInviteAccountCard>(accounts[index]);
 		return std::make_shared<CIntObject>();
 	};
 

+ 1 - 1
client/globalLobby/GlobalLobbyInviteWindow.h

@@ -42,5 +42,5 @@ class GlobalLobbyInviteAccountCard : public CIntObject
 
 	void clickPressed(const Point & cursorPosition) override;
 public:
-	GlobalLobbyInviteAccountCard(GlobalLobbyInviteWindow * window, const GlobalLobbyAccount & accountDescription);
+	GlobalLobbyInviteAccountCard(const GlobalLobbyAccount & accountDescription);
 };

+ 4 - 4
client/lobby/CSelectionBase.cpp

@@ -138,8 +138,8 @@ InfoCard::InfoCard()
 	playerListBg = std::make_shared<CPicture>(ImagePath::builtin("CHATPLUG.bmp"), 16, 276);
 	chat = std::make_shared<CChatBox>(Rect(18, 126, 335, 143));
 
-	buttonInvitePlayers = std::make_shared<CButton>(Point(20, 365), AnimationPath::builtin("pregameInvitePlayers"), CGI->generaltexth->zelp[105], [=](){ CSH->getGlobalLobby().activateRoomInviteInterface(); } );
-	buttonOpenGlobalLobby = std::make_shared<CButton>(Point(188, 365), AnimationPath::builtin("pregameReturnToLobby"), CGI->generaltexth->zelp[105], [=](){ CSH->getGlobalLobby().activateInterface(); });
+	buttonInvitePlayers = std::make_shared<CButton>(Point(20, 365), AnimationPath::builtin("pregameInvitePlayers"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateRoomInviteInterface(); } );
+	buttonOpenGlobalLobby = std::make_shared<CButton>(Point(188, 365), AnimationPath::builtin("pregameReturnToLobby"), CGI->generaltexth->zelp[105], [](){ CSH->getGlobalLobby().activateInterface(); });
 
 	buttonInvitePlayers->setTextOverlay  (MetaString::createFromTextID("vcmi.lobby.invite.header").toString(), EFonts::FONT_SMALL, Colors::WHITE);
 	buttonOpenGlobalLobby->setTextOverlay(MetaString::createFromTextID("vcmi.lobby.backToLobby").toString(), EFonts::FONT_SMALL, Colors::WHITE);
@@ -252,12 +252,12 @@ void InfoCard::changeSelection()
 	if(!showChat)
 		labelGroupPlayers->disable();
 
-	for(auto & p : CSH->playerNames)
+	for(const auto & p : CSH->playerNames)
 	{
 		int slotsUsed = labelGroupPlayers->currentSize();
 		Point labelPosition;
 
-		if (slotsUsed < 4)
+		if(slotsUsed < 4)
 			labelPosition = Point(24, 285 + slotsUsed * graphics->fonts[FONT_SMALL]->getLineHeight()); // left column
 		else
 			labelPosition = Point(193, 285 + (slotsUsed - 4) * graphics->fonts[FONT_SMALL]->getLineHeight()); // right column