mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
Fixed bug with Subterranean Gates:
Failed to connect (-1,-1,-1) with center of teh zone.
This commit is contained in:
@@ -518,6 +518,8 @@ void CMapGenerator::createConnections()
|
|||||||
int3 tile = posA;
|
int3 tile = posA;
|
||||||
int3 otherTile = tile;
|
int3 otherTile = tile;
|
||||||
|
|
||||||
|
auto sgt = VLC->objtypeh->getHandlerFor(Obj::SUBTERRANEAN_GATE, 0)->getTemplates().front();
|
||||||
|
|
||||||
bool stop = false;
|
bool stop = false;
|
||||||
while (!stop)
|
while (!stop)
|
||||||
{
|
{
|
||||||
@@ -551,11 +553,15 @@ void CMapGenerator::createConnections()
|
|||||||
withinZone = false;
|
withinZone = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (withinZone)
|
//make sure both gates has some free tiles below them
|
||||||
|
if (zoneA->getAccessibleOffset(this, sgt, tile).valid() && zoneB->getAccessibleOffset(this, sgt, otherTile).valid())
|
||||||
{
|
{
|
||||||
zoneA->placeSubterraneanGate(this, tile, connection.getGuardStrength());
|
if (withinZone)
|
||||||
zoneB->placeSubterraneanGate(this, otherTile, connection.getGuardStrength());
|
{
|
||||||
stop = true; //we are done, go to next connection
|
zoneA->placeSubterraneanGate(this, tile, connection.getGuardStrength());
|
||||||
|
zoneB->placeSubterraneanGate(this, otherTile, connection.getGuardStrength());
|
||||||
|
stop = true; //we are done, go to next connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -147,6 +147,8 @@ public:
|
|||||||
void setCenter(const float3 &f);
|
void setCenter(const float3 &f);
|
||||||
int3 getPos() const;
|
int3 getPos() const;
|
||||||
void setPos(const int3 &pos);
|
void setPos(const int3 &pos);
|
||||||
|
bool isAccessibleFromAnywhere(CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile) const;
|
||||||
|
int3 getAccessibleOffset(CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile) const;
|
||||||
|
|
||||||
void addTile (const int3 &pos);
|
void addTile (const int3 &pos);
|
||||||
void initFreeTiles (CMapGenerator* gen);
|
void initFreeTiles (CMapGenerator* gen);
|
||||||
@@ -239,8 +241,6 @@ private:
|
|||||||
|
|
||||||
bool pointIsIn(int x, int y);
|
bool pointIsIn(int x, int y);
|
||||||
void addAllPossibleObjects (CMapGenerator* gen); //add objects, including zone-specific, to possibleObjects
|
void addAllPossibleObjects (CMapGenerator* gen); //add objects, including zone-specific, to possibleObjects
|
||||||
bool isAccessibleFromAnywhere (CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile) const;
|
|
||||||
int3 getAccessibleOffset(CMapGenerator* gen, ObjectTemplate &appearance, int3 &tile) const;
|
|
||||||
bool findPlaceForObject(CMapGenerator* gen, CGObjectInstance* obj, si32 min_dist, int3 &pos);
|
bool findPlaceForObject(CMapGenerator* gen, CGObjectInstance* obj, si32 min_dist, int3 &pos);
|
||||||
bool findPlaceForTreasurePile(CMapGenerator* gen, float min_dist, int3 &pos, int value);
|
bool findPlaceForTreasurePile(CMapGenerator* gen, float min_dist, int3 &pos, int value);
|
||||||
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
||||||
|
Reference in New Issue
Block a user