1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

CPathfinder: separate neighbours code into getNeighbours

This is first step to make this code usable outside of calculatePaths.
This commit is contained in:
ArseniyShestakov
2015-10-10 16:09:40 +03:00
parent abe02247b5
commit f15065fdc5
2 changed files with 72 additions and 56 deletions

View File

@@ -290,6 +290,7 @@ private:
std::list<CGPathNode*> mq; //BFS queue -> nodes to be checked
std::vector<int3> neighbours;
int3 curPos;
CGPathNode *cp; //current (source) path node -> we took it from the queue
@@ -298,11 +299,17 @@ private:
ui8 useEmbarkCost; //0 - usual movement; 1 - embark; 2 - disembark
Obj destTopVisObjID;
CGObjectInstance *sTileObj;
CGObjectInstance *dTileObj;
const CGTeleport *sTileTeleport;
const CGTeleport *dTileTeleport;
CGPathNode *getNode(const int3 &coord);
void initializeGraph();
bool goodForLandSeaTransition(); //checks if current move will be between sea<->land. If so, checks it legality (returns false if movement is not possible) and sets useEmbarkCost
void getNeighbours(const int3 &coord, bool noTeleportExcludes = false);
CGPathNode::EAccessibility evaluateAccessibility(const TerrainTile *tinfo) const;
bool canMoveBetween(const int3 &a, const int3 &b) const; //checks only for visitable objects that may make moving between tiles impossible, not other conditions (like tiles itself accessibility)