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

Do not allow heroes banned for player as starting heroes

- `disposedHeroes` is now in map header, for use in map selection
- heroes that are marked as unavailable for player will now be hidden
from starting hero selection
This commit is contained in:
Ivan Savenko
2025-02-14 10:43:55 +00:00
parent 7e1ce095a1
commit 4b824d05e2
9 changed files with 67 additions and 43 deletions

View File

@@ -640,19 +640,19 @@ void CMapFormatJson::readDisposedHeroes(JsonSerializeFormat & handler)
hero.players = mask;
//name and portrait are not used
map->disposedHeroes.push_back(hero);
mapHeader->disposedHeroes.push_back(hero);
}
}
}
void CMapFormatJson::writeDisposedHeroes(JsonSerializeFormat & handler)
{
if(map->disposedHeroes.empty())
if(mapHeader->disposedHeroes.empty())
return;
auto definitions = handler.enterStruct("predefinedHeroes");//DisposedHeroes are part of predefinedHeroes in VCMI map format
for(DisposedHero & hero : map->disposedHeroes)
for(DisposedHero & hero : mapHeader->disposedHeroes)
{
std::string type = HeroTypeID::encode(hero.heroId.getNum());