1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-03 23:19:22 +02:00

+ Handled banning spells and artifacts

+ Rename allowedSpell => allowedSpells
This commit is contained in:
Tomasz Zieliński
2023-07-17 17:21:28 +02:00
parent fbd1d728ec
commit 025b0814c8
19 changed files with 101 additions and 44 deletions

View File

@@ -413,7 +413,7 @@ void CMapGenerator::addHeaderInfo()
m.difficulty = 1;
addPlayerInfo();
m.waterMap = (mapGenOptions.getWaterContent() != EWaterContent::EWaterContent::NONE);
banWaterHeroes();
m.banWaterContent();
}
int CMapGenerator::getNextMonlithIndex()
@@ -453,24 +453,6 @@ const std::vector<ArtifactID> & CMapGenerator::getAllPossibleQuestArtifacts() co
return questArtifacts;
}
void CMapGenerator::banWaterHeroes()
{
//This also bans only-land heroes on wazter maps
auto isWaterMap = map->getMap(this).isWaterMap();
for (int j = 0; j < map->getMap(this).allowedHeroes.size(); j++)
{
if (map->getMap(this).allowedHeroes[j])
{
auto* h = dynamic_cast<const CHero*>(VLC->heroTypes()->getByIndex(j));
if ((h->onlyOnWaterMap && !isWaterMap) || (h->onlyOnMapWithoutWater && isWaterMap)) //TODO: Refactor? Move to hero?
{
banHero(HeroTypeID(j));
}
}
}
}
const std::vector<HeroTypeID> CMapGenerator::getAllPossibleHeroes() const
{
auto isWaterMap = map->getMap(this).isWaterMap();
@@ -503,7 +485,7 @@ void CMapGenerator::banQuestArt(const ArtifactID & id)
void CMapGenerator::banHero(const HeroTypeID & id)
{
//TODO: Protect with mutex
map->getMap(this).allowedHeroes[id] = false;
map->getMap(this).banHero(id);
}
Zone * CMapGenerator::getZoneWater() const