1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Code cleanup

This commit is contained in:
Ivan Savenko 2024-03-26 13:01:15 +02:00
parent 89d091a386
commit d700e94189
5 changed files with 10 additions and 10 deletions

View File

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

View File

@ -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" : "Максимум гравців",

View File

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

View File

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

View File

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