mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Fix placing road inside underground rock
This commit is contained in:
@@ -18,9 +18,12 @@
|
||||
#include "../threadpool/MapProxy.h"
|
||||
#include "../../CModHandler.h"
|
||||
#include "../../mapping/CMapEditManager.h"
|
||||
#include "../../TerrainHandler.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class TerrainType;
|
||||
|
||||
void RoadPlacer::process()
|
||||
{
|
||||
if(generator.getConfig().defaultRoadType.empty() && generator.getConfig().secondaryRoadType.empty())
|
||||
@@ -114,6 +117,13 @@ void RoadPlacer::drawRoads(bool secondary)
|
||||
//Clean space under roads even if they won't be eventually generated
|
||||
Zone::Lock lock(zone.areaMutex);
|
||||
|
||||
//Do not draw roads on underground rock or water
|
||||
roads.erase_if([this](const int3& pos) -> bool
|
||||
{
|
||||
const auto* terrain = map.getTile(pos).terType;;
|
||||
return !terrain->isPassable() || !terrain->isLand();
|
||||
});
|
||||
|
||||
zone.areaPossible().subtract(roads);
|
||||
zone.freePaths().unite(roads);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user