1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Remove bitmasks of PlayerColor's. Add encode/decode methods

This commit is contained in:
Ivan Savenko
2023-08-25 21:40:19 +03:00
parent f79492e5b0
commit a30e7ba321
13 changed files with 56 additions and 142 deletions

View File

@ -228,6 +228,16 @@ std::string PlayerColor::getStrCap(bool L10n) const
return ret;
}
si32 PlayerColor::decode(const std::string & identifier)
{
return vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, identifier);
}
std::string PlayerColor::encode(const si32 index)
{
return GameConstants::PLAYER_COLOR_NAMES[index];
}
si32 FactionID::decode(const std::string & identifier)
{
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeGame(), entityType(), identifier);