mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
- Unban hero if related Prison is destroyed during map generation
- Move prison counter to PrisonHeroPlacer
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include "../RmgMap.h"
|
||||
#include "../CMapGenerator.h"
|
||||
#include "TreasurePlacer.h"
|
||||
#include "PrisonHeroPlacer.h"
|
||||
#include "QuestArtifactPlacer.h"
|
||||
#include "TownPlacer.h"
|
||||
#include "TerrainPainter.h"
|
||||
@ -145,7 +146,18 @@ void ObjectDistributor::distributePrisons()
|
||||
|
||||
RandomGeneratorUtil::randomShuffle(zones, zone.getRand());
|
||||
|
||||
size_t allowedPrisons = generator.getPrisonsRemaning();
|
||||
// TODO: Some shorthand for unique Modificator
|
||||
PrisonHeroPlacer * prisonHeroPlacer = nullptr;
|
||||
for(auto & z : map.getZones())
|
||||
{
|
||||
prisonHeroPlacer = z.second->getModificator<PrisonHeroPlacer>();
|
||||
if (prisonHeroPlacer)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size_t allowedPrisons = prisonHeroPlacer->getPrisonsRemaning();
|
||||
for (int i = zones.size() - 1; i >= 0; i--)
|
||||
{
|
||||
auto zone = zones[i].second;
|
||||
|
Reference in New Issue
Block a user