mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Water heroes will now be correctly banned on random maps.
This commit is contained in:
@ -413,6 +413,7 @@ void CMapGenerator::addHeaderInfo()
|
||||
m.difficulty = 1;
|
||||
addPlayerInfo();
|
||||
m.waterMap = (mapGenOptions.getWaterContent() != EWaterContent::EWaterContent::NONE);
|
||||
banWaterHeroes();
|
||||
}
|
||||
|
||||
int CMapGenerator::getNextMonlithIndex()
|
||||
@ -452,6 +453,24 @@ 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();
|
||||
|
Reference in New Issue
Block a user