1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Remove dependencies of surface and underground zones

This commit is contained in:
Tomasz Zieliński 2023-06-10 14:58:12 +02:00
parent b65870f31e
commit 8ef25155df
7 changed files with 40 additions and 10 deletions

View File

@ -12,7 +12,7 @@
#include "ObstaclePlacer.h"
#include "ObjectManager.h"
#include "TreasurePlacer.h"
#include "RockPlacer.h"
#include "RockFiller.h"
#include "WaterRoutes.h"
#include "WaterProxy.h"
#include "RoadPlacer.h"
@ -94,10 +94,16 @@ void ObstaclePlacer::init()
{
DEPENDENCY(ObjectManager);
DEPENDENCY(TreasurePlacer);
DEPENDENCY(WaterRoutes);
DEPENDENCY(WaterProxy);
DEPENDENCY(RoadPlacer);
DEPENDENCY_ALL(RockPlacer);
if (zone.isUnderground())
{
DEPENDENCY(RockFiller);
}
else
{
DEPENDENCY(WaterRoutes);
DEPENDENCY(WaterProxy);
}
}
bool ObstaclePlacer::isInTheMap(const int3& tile)

View File

@ -82,7 +82,10 @@ void RiverPlacer::process()
void RiverPlacer::init()
{
DEPENDENCY_ALL(WaterProxy);
if (!zone.isUnderground())
{
DEPENDENCY_ALL(WaterProxy);
}
DEPENDENCY(ObjectManager);
DEPENDENCY(ObstaclePlacer);
}

View File

@ -12,6 +12,7 @@
#include "RoadPlacer.h"
#include "ObjectManager.h"
#include "ObstaclePlacer.h"
#include "RockFiller.h"
#include "../Functions.h"
#include "../CMapGenerator.h"
#include "../threadpool/MapProxy.h"
@ -28,6 +29,14 @@ void RoadPlacer::process()
connectRoads();
}
void RoadPlacer::init()
{
if (zone.isUnderground())
{
DEPENDENCY_ALL(RockFiller);
}
}
rmg::Area & RoadPlacer::areaForRoads()
{
return areaRoads;

View File

@ -19,6 +19,7 @@ public:
MODIFICATOR(RoadPlacer);
void process() override;
void init();
char dump(const int3 &) override;
void addRoadNode(const int3 & node);

View File

@ -13,7 +13,6 @@
#include "RockPlacer.h"
#include "TreasurePlacer.h"
#include "ObjectManager.h"
#include "RoadPlacer.h"
#include "RiverPlacer.h"
#include "../RmgMap.h"
#include "../CMapGenerator.h"
@ -63,7 +62,6 @@ void RockFiller::processMap()
void RockFiller::init()
{
DEPENDENCY_ALL(RockPlacer);
POSTFUNCTION_ALL(RoadPlacer);
}
char RockFiller::dump(const int3 & t)

View File

@ -67,7 +67,17 @@ void RockPlacer::postProcess()
void RockPlacer::init()
{
DEPENDENCY_ALL(TreasurePlacer);
for (const auto& zone : map.getZones())
{
if (zone.second->isUnderground())
{
auto * tp = zone.second->getModificator<TreasurePlacer>();
if (tp)
{
dependency(tp);
}
}
}
}
char RockPlacer::dump(const int3 & t)

View File

@ -83,8 +83,11 @@ void WaterProxy::init()
{
for(auto & z : map.getZones())
{
dependency(z.second->getModificator<TownPlacer>());
dependency(z.second->getModificator<WaterAdopter>());
if (!zone.isUnderground())
{
dependency(z.second->getModificator<TownPlacer>());
dependency(z.second->getModificator<WaterAdopter>());
}
postfunction(z.second->getModificator<ConnectionsPlacer>());
postfunction(z.second->getModificator<ObjectManager>());
}