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

Removed remaining usages of std::vector<bool>

This commit is contained in:
Ivan Savenko
2023-11-05 15:24:26 +02:00
parent a9f868b379
commit 0842f5afee
54 changed files with 140 additions and 317 deletions

View File

@ -493,19 +493,16 @@ const std::vector<HeroTypeID> CMapGenerator::getAllPossibleHeroes() const
auto isWaterMap = map->getMap(this).isWaterMap();
//Skip heroes that were banned, including the ones placed in prisons
std::vector<HeroTypeID> ret;
for (int j = 0; j < map->getMap(this).allowedHeroes.size(); j++)
for (HeroTypeID hero : map->getMap(this).allowedHeroes)
{
if (map->getMap(this).allowedHeroes[j])
auto * h = dynamic_cast<const CHero*>(VLC->heroTypes()->getById(hero));
if ((h->onlyOnWaterMap && !isWaterMap) || (h->onlyOnMapWithoutWater && isWaterMap))
{
auto * h = dynamic_cast<const CHero*>(VLC->heroTypes()->getByIndex(j));
if ((h->onlyOnWaterMap && !isWaterMap) || (h->onlyOnMapWithoutWater && isWaterMap))
{
continue;
}
else
{
ret.push_back(HeroTypeID(j));
}
continue;
}
else
{
ret.push_back(hero);
}
}
return ret;
@ -514,7 +511,7 @@ const std::vector<HeroTypeID> CMapGenerator::getAllPossibleHeroes() const
void CMapGenerator::banQuestArt(const ArtifactID & id)
{
//TODO: Protect with mutex
map->getMap(this).allowedArtifact[id] = false;
map->getMap(this).allowedArtifact.erase(id);
}
void CMapGenerator::banHero(const HeroTypeID & id)