mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
CPathfinder: fix typos and more code cleanups
This commit is contained in:
@ -3287,15 +3287,12 @@ void CPathfinder::initializeGraph()
|
|||||||
for(size_t k=0; k < out.sizes.z; ++k)
|
for(size_t k=0; k < out.sizes.z; ++k)
|
||||||
{
|
{
|
||||||
curPos = int3(i,j,k);
|
curPos = int3(i,j,k);
|
||||||
const TerrainTile *tinfo = &gs->map->getTile(int3(i, j, k));
|
const TerrainTile *tinfo = &gs->map->getTile(curPos);
|
||||||
CGPathNode &node = graph[i][j][k];
|
CGPathNode &node = graph[i][j][k];
|
||||||
|
|
||||||
node.accessible = evaluateAccessibility(tinfo);
|
node.accessible = evaluateAccessibility(tinfo);
|
||||||
node.turns = 0xff;
|
node.turns = 0xff;
|
||||||
node.moveRemains = 0;
|
node.moveRemains = 0;
|
||||||
node.coord.x = i;
|
node.coord = curPos;
|
||||||
node.coord.y = j;
|
|
||||||
node.coord.z = k;
|
|
||||||
node.land = tinfo->terType != ETerrainType::WATER;
|
node.land = tinfo->terType != ETerrainType::WATER;
|
||||||
node.theNodeBefore = nullptr;
|
node.theNodeBefore = nullptr;
|
||||||
}
|
}
|
||||||
@ -3348,7 +3345,7 @@ void CPathfinder::getTeleportExits(bool noTeleportExcludes)
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
sTileTeleport = dynamic_cast<const CGTeleport *>(sTileObj);
|
const CGTeleport *sTileTeleport = dynamic_cast<const CGTeleport *>(sTileObj);
|
||||||
if(isAllowedTeleportEntrance(sTileTeleport))
|
if(isAllowedTeleportEntrance(sTileTeleport))
|
||||||
{
|
{
|
||||||
for(auto objId : gs->getTeleportChannelExits(sTileTeleport->channel, hero->tempOwner))
|
for(auto objId : gs->getTeleportChannelExits(sTileTeleport->channel, hero->tempOwner))
|
||||||
@ -3613,7 +3610,7 @@ CPathfinder::PathfinderOptions::PathfinderOptions()
|
|||||||
useFlying = false;
|
useFlying = false;
|
||||||
useWaterWalking = false;
|
useWaterWalking = false;
|
||||||
useEmbarkAndDisembark = true;
|
useEmbarkAndDisembark = true;
|
||||||
useTeleportTWoWay = true;
|
useTeleportTwoWay = true;
|
||||||
useTeleportOneWay = true;
|
useTeleportOneWay = true;
|
||||||
useTeleportOneWayRandom = false;
|
useTeleportOneWayRandom = false;
|
||||||
useTeleportWhirlpool = false;
|
useTeleportWhirlpool = false;
|
||||||
@ -3652,7 +3649,7 @@ CRandomGenerator & CGameState::getRandomGenerator()
|
|||||||
|
|
||||||
bool CPathfinder::addTeleportTwoWay(const CGTeleport * obj) const
|
bool CPathfinder::addTeleportTwoWay(const CGTeleport * obj) const
|
||||||
{
|
{
|
||||||
return options.useTeleportTWoWay && gs->isTeleportChannelBidirectional(obj->channel, hero->tempOwner);
|
return options.useTeleportTwoWay && gs->isTeleportChannelBidirectional(obj->channel, hero->tempOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPathfinder::addTeleportOneWay(const CGTeleport * obj) const
|
bool CPathfinder::addTeleportOneWay(const CGTeleport * obj) const
|
||||||
|
@ -284,7 +284,7 @@ private:
|
|||||||
bool useFlying;
|
bool useFlying;
|
||||||
bool useWaterWalking;
|
bool useWaterWalking;
|
||||||
bool useEmbarkAndDisembark;
|
bool useEmbarkAndDisembark;
|
||||||
bool useTeleportTWoWay; // Two-way monoliths and Subterranean Gate
|
bool useTeleportTwoWay; // Two-way monoliths and Subterranean Gate
|
||||||
bool useTeleportOneWay; // One-way monoliths with one known exit only
|
bool useTeleportOneWay; // One-way monoliths with one known exit only
|
||||||
bool useTeleportOneWayRandom; // One-way monoliths with more than one known exit
|
bool useTeleportOneWayRandom; // One-way monoliths with more than one known exit
|
||||||
bool useTeleportWhirlpool; // Force enabled if hero protected or unaffected (have one stack of one creature)
|
bool useTeleportWhirlpool; // Force enabled if hero protected or unaffected (have one stack of one creature)
|
||||||
@ -305,13 +305,9 @@ private:
|
|||||||
CGPathNode *cp; //current (source) path node -> we took it from the queue
|
CGPathNode *cp; //current (source) path node -> we took it from the queue
|
||||||
CGPathNode *dp; //destination node -> it's a neighbour of cp that we consider
|
CGPathNode *dp; //destination node -> it's a neighbour of cp that we consider
|
||||||
const TerrainTile *ct, *dt; //tile info for both nodes
|
const TerrainTile *ct, *dt; //tile info for both nodes
|
||||||
|
const CGObjectInstance *sTileObj;
|
||||||
ui8 useEmbarkCost; //0 - usual movement; 1 - embark; 2 - disembark
|
ui8 useEmbarkCost; //0 - usual movement; 1 - embark; 2 - disembark
|
||||||
|
|
||||||
CGObjectInstance *sTileObj;
|
|
||||||
CGObjectInstance *dTileObj;
|
|
||||||
const CGTeleport *sTileTeleport;
|
|
||||||
const CGTeleport *dTileTeleport;
|
|
||||||
|
|
||||||
CGPathNode *getNode(const int3 &coord);
|
CGPathNode *getNode(const int3 &coord);
|
||||||
void initializeGraph();
|
void initializeGraph();
|
||||||
bool isMovementPossible(); //checks if current move will be between sea<->land. If so, checks it legality (returns false if movement is not possible) and sets useEmbarkCost
|
bool isMovementPossible(); //checks if current move will be between sea<->land. If so, checks it legality (returns false if movement is not possible) and sets useEmbarkCost
|
||||||
|
Reference in New Issue
Block a user