mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Water heroes will now be correctly banned on random maps.
This commit is contained in:
parent
bda126a1fd
commit
fbd1d728ec
@ -413,6 +413,7 @@ void CMapGenerator::addHeaderInfo()
|
|||||||
m.difficulty = 1;
|
m.difficulty = 1;
|
||||||
addPlayerInfo();
|
addPlayerInfo();
|
||||||
m.waterMap = (mapGenOptions.getWaterContent() != EWaterContent::EWaterContent::NONE);
|
m.waterMap = (mapGenOptions.getWaterContent() != EWaterContent::EWaterContent::NONE);
|
||||||
|
banWaterHeroes();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMapGenerator::getNextMonlithIndex()
|
int CMapGenerator::getNextMonlithIndex()
|
||||||
@ -452,6 +453,24 @@ const std::vector<ArtifactID> & CMapGenerator::getAllPossibleQuestArtifacts() co
|
|||||||
return questArtifacts;
|
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
|
const std::vector<HeroTypeID> CMapGenerator::getAllPossibleHeroes() const
|
||||||
{
|
{
|
||||||
auto isWaterMap = map->getMap(this).isWaterMap();
|
auto isWaterMap = map->getMap(this).isWaterMap();
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
int getPrisonsRemaning() const;
|
int getPrisonsRemaning() const;
|
||||||
std::shared_ptr<CZonePlacer> getZonePlacer() const;
|
std::shared_ptr<CZonePlacer> getZonePlacer() const;
|
||||||
const std::vector<ArtifactID> & getAllPossibleQuestArtifacts() const;
|
const std::vector<ArtifactID> & getAllPossibleQuestArtifacts() const;
|
||||||
|
void banWaterHeroes();
|
||||||
const std::vector<HeroTypeID> getAllPossibleHeroes() const;
|
const std::vector<HeroTypeID> getAllPossibleHeroes() const;
|
||||||
void banQuestArt(const ArtifactID & id);
|
void banQuestArt(const ArtifactID & id);
|
||||||
void banHero(const HeroTypeID& id);
|
void banHero(const HeroTypeID& id);
|
||||||
|
Loading…
Reference in New Issue
Block a user