|
@@ -30,14 +30,21 @@ void RockPlacer::process()
|
|
|
{
|
|
{
|
|
|
blockRock();
|
|
blockRock();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
void RockPlacer::blockRock()
|
|
void RockPlacer::blockRock()
|
|
|
{
|
|
{
|
|
|
rockTerrain = VLC->terrainTypeHandler->getById(zone.getTerrainType())->rockTerrain;
|
|
rockTerrain = VLC->terrainTypeHandler->getById(zone.getTerrainType())->rockTerrain;
|
|
|
assert(!VLC->terrainTypeHandler->getById(rockTerrain)->isPassable());
|
|
assert(!VLC->terrainTypeHandler->getById(rockTerrain)->isPassable());
|
|
|
|
|
|
|
|
accessibleArea = zone.freePaths() + zone.areaUsed();
|
|
accessibleArea = zone.freePaths() + zone.areaUsed();
|
|
|
|
|
+ if(auto * rp = zone.getModificator<RoadPlacer>())
|
|
|
|
|
+ {
|
|
|
|
|
+ accessibleArea.unite(rp->getRoads());
|
|
|
|
|
+ }
|
|
|
if(auto * m = zone.getModificator<ObjectManager>())
|
|
if(auto * m = zone.getModificator<ObjectManager>())
|
|
|
|
|
+ {
|
|
|
accessibleArea.unite(m->getVisitableArea());
|
|
accessibleArea.unite(m->getVisitableArea());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//negative approach - create rock tiles first, then make sure all accessible tiles have no rock
|
|
//negative approach - create rock tiles first, then make sure all accessible tiles have no rock
|
|
|
rockArea = zone.area()->getSubarea([this](const int3 & t)
|
|
rockArea = zone.area()->getSubarea([this](const int3 & t)
|
|
@@ -55,6 +62,12 @@ void RockPlacer::postProcess()
|
|
|
{
|
|
{
|
|
|
return !map.getTile(t).terType->isPassable();
|
|
return !map.getTile(t).terType->isPassable();
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ // Do not place rock on roads
|
|
|
|
|
+ if(auto * rp = zone.getModificator<RoadPlacer>())
|
|
|
|
|
+ {
|
|
|
|
|
+ rockArea.subtract(rp->getRoads());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
zone.areaUsed()->unite(rockArea);
|
|
zone.areaUsed()->unite(rockArea);
|
|
|
zone.areaPossible()->subtract(rockArea);
|
|
zone.areaPossible()->subtract(rockArea);
|
|
@@ -70,15 +83,13 @@ void RockPlacer::postProcess()
|
|
|
|
|
|
|
|
void RockPlacer::init()
|
|
void RockPlacer::init()
|
|
|
{
|
|
{
|
|
|
- for (const auto& zone : map.getZones())
|
|
|
|
|
|
|
+ DEPENDENCY(RoadPlacer);
|
|
|
|
|
+ for (const auto& zone : map.getZonesOnLevel(1))
|
|
|
{
|
|
{
|
|
|
- if (zone.second->isUnderground())
|
|
|
|
|
|
|
+ auto * tp = zone.second->getModificator<TreasurePlacer>();
|
|
|
|
|
+ if (tp)
|
|
|
{
|
|
{
|
|
|
- auto * tp = zone.second->getModificator<TreasurePlacer>();
|
|
|
|
|
- if (tp)
|
|
|
|
|
- {
|
|
|
|
|
- dependency(tp);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ dependency(tp);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|