1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

show handicap resources

This commit is contained in:
Laserlicht
2024-07-16 02:01:55 +02:00
parent afd580b76a
commit af2b6a0051
5 changed files with 60 additions and 6 deletions

View File

@@ -784,7 +784,24 @@ void CVCMIServer::setPlayerHandicap(PlayerColor color, TResources handicap)
str.appendTextID("vcmi.lobby.handicap");
str.appendRawString(" ");
str.appendName(color);
str.appendRawString(":\n" + handicap.toString());
str.appendRawString(":");
if(handicap.empty())
{
str.appendRawString(" ");
str.appendTextID("core.genrltxt.523");
announceTxt(str);
return;
}
for(auto & res : EGameResID::ALL_RESOURCES())
if(handicap[res] != 0)
{
str.appendRawString(" ");
str.appendName(res);
str.appendRawString(":");
str.appendRawString(std::to_string(handicap[res]));
}
announceTxt(str);
}
@@ -1041,7 +1058,15 @@ void CVCMIServer::multiplayerWelcomeMessage()
str.appendTextID("vcmi.lobby.handicap");
str.appendRawString(" ");
str.appendName(pi.first);
str.appendRawString(": " + pi.second.handicap.toString());
str.appendRawString(":");
for(auto & res : EGameResID::ALL_RESOURCES())
if(pi.second.handicap[res] != 0)
{
str.appendRawString(" ");
str.appendName(res);
str.appendRawString(":");
str.appendRawString(std::to_string(pi.second.handicap[res]));
}
announceTxt(str);
}