1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Removed getStr(bool), replaced with similar toString()

This commit is contained in:
Ivan Savenko
2023-09-04 22:21:02 +03:00
parent 7e27ac7073
commit 86a7f5f5cd
27 changed files with 83 additions and 99 deletions

View File

@@ -199,36 +199,15 @@ bool PlayerColor::isValidPlayer() const
bool PlayerColor::isSpectator() const
{
return num == SPECTATOR.num;
}
std::string PlayerColor::getStr(bool L10n) const
{
std::string ret = "unnamed";
if(isValidPlayer())
{
if(L10n)
ret = VLC->generaltexth->colors[num];
else
ret = GameConstants::PLAYER_COLOR_NAMES[num];
}
else if(L10n)
{
ret = VLC->generaltexth->allTexts[508];
ret[0] = std::tolower(ret[0]);
}
return ret;
}
std::string PlayerColor::getStrCap(bool L10n) const
{
std::string ret = getStr(L10n);
ret[0] = std::toupper(ret[0]);
return ret;
}
si32 PlayerColor::decode(const std::string & identifier)
return num == SPECTATOR.num;
}
std::string PlayerColor::toString() const
{
return encode(num);
}
si32 PlayerColor::decode(const std::string & identifier)
{
return vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, identifier);
}