mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
All required objects will now constitute main paths of zone (again), which should improve their shape.
This commit is contained in:
@@ -1069,7 +1069,8 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
|||||||
logGlobal->traceStream() << "Place found";
|
logGlobal->traceStream() << "Place found";
|
||||||
|
|
||||||
placeObject (gen, obj.first, pos);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1421,7 +1422,7 @@ std::vector<int3> CRmgTemplateZone::getAccessibleOffsets (CMapGenerator* gen, CG
|
|||||||
return tiles;
|
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();
|
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)
|
for (auto tile : tiles)
|
||||||
{
|
{
|
||||||
//crunching path may fail if center of teh zone is dirrectly over wide object
|
//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;
|
guardTile = tile;
|
||||||
break;
|
break;
|
||||||
|
@@ -219,5 +219,5 @@ private:
|
|||||||
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
||||||
void checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos);
|
void checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos);
|
||||||
void placeObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, bool updateDistance = true);
|
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);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user