mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
All required objects will now constitute main paths of zone (again), which should improve their shape.
This commit is contained in:
parent
e65b85873c
commit
1dd88d394f
@ -1069,7 +1069,8 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
||||
logGlobal->traceStream() << "Place found";
|
||||
|
||||
placeObject (gen, obj.first, pos);
|
||||
guardObject (gen, obj.first, obj.second, (obj.first->ID == Obj::MONOLITH_TWO_WAY));
|
||||
guardObject (gen, obj.first, obj.second, (obj.first->ID == Obj::MONOLITH_TWO_WAY), true);
|
||||
//paths to required objects constitute main paths of zone. otherwise they just may lead to middle and create dead zones
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1421,7 +1422,7 @@ std::vector<int3> CRmgTemplateZone::getAccessibleOffsets (CMapGenerator* gen, CG
|
||||
return tiles;
|
||||
}
|
||||
|
||||
bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard)
|
||||
bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard, bool addToFreePaths)
|
||||
{
|
||||
logGlobal->traceStream() << boost::format("Guard object at %s") % object->pos();
|
||||
|
||||
@ -1432,7 +1433,8 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
for (auto tile : tiles)
|
||||
{
|
||||
//crunching path may fail if center of teh zone is dirrectly over wide object
|
||||
if (crunchPath (gen, tile, findClosestTile(freePaths, tile), id)) //make sure object is accessible before surrounding it with blocked tiles
|
||||
//make sure object is accessible before surrounding it with blocked tiles
|
||||
if (crunchPath (gen, tile, findClosestTile(freePaths, tile), id, addToFreePaths ? &freePaths : nullptr))
|
||||
{
|
||||
guardTile = tile;
|
||||
break;
|
||||
|
@ -219,5 +219,5 @@ private:
|
||||
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
||||
void checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos);
|
||||
void placeObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, bool updateDistance = true);
|
||||
bool guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard = false);
|
||||
bool guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard = false, bool addToFreePaths = false);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user