1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

- Unban hero if related Prison is destroyed during map generation

- Move prison counter to PrisonHeroPlacer
This commit is contained in:
Tomasz Zieliński
2023-12-24 09:36:26 +01:00
parent b0f0e9caa8
commit ebf2055afc
9 changed files with 72 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ VCMI_LIB_NAMESPACE_BEGIN
CMapGenerator::CMapGenerator(CMapGenOptions& mapGenOptions, int RandomSeed) :
mapGenOptions(mapGenOptions), randomSeed(RandomSeed),
allowedPrisons(0), monolithIndex(0)
monolithIndex(0)
{
loadConfig();
rand.setSeed(this->randomSeed);
@@ -96,12 +96,6 @@ const CMapGenOptions& CMapGenerator::getMapGenOptions() const
return mapGenOptions;
}
void CMapGenerator::initPrisonsRemaining()
{
allowedPrisons = map->getMap(this).allowedHeroes.size();
allowedPrisons = std::max<int> (0, allowedPrisons - 16 * mapGenOptions.getHumanOrCpuPlayerCount()); //so at least 16 heroes will be available for every player
}
void CMapGenerator::initQuestArtsRemaining()
{
//TODO: Move to QuestArtifactPlacer?
@@ -122,7 +116,6 @@ std::unique_ptr<CMap> CMapGenerator::generate()
addHeaderInfo();
map->initTiles(*this, rand);
Load::Progress::step();
initPrisonsRemaining();
initQuestArtsRemaining();
genZones();
Load::Progress::step();
@@ -468,11 +461,6 @@ int CMapGenerator::getNextMonlithIndex()
}
}
int CMapGenerator::getPrisonsRemaning() const
{
return allowedPrisons;
}
std::shared_ptr<CZonePlacer> CMapGenerator::getZonePlacer() const
{
return placer;
@@ -514,6 +502,12 @@ void CMapGenerator::banHero(const HeroTypeID & id)
map->getMap(this).banHero(id);
}
void CMapGenerator::unbanHero(const HeroTypeID & id)
{
map->getMap(this).unbanHero(id);
}
Zone * CMapGenerator::getZoneWater() const
{
for(auto & z : map->getZones())