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

Merge pull request #93 from ArseniyShestakov/feature/pathfindingTeleports

Okay let's do this!
This commit is contained in:
DjWarmonger
2015-03-10 09:04:25 +01:00
36 changed files with 936 additions and 243 deletions

View File

@@ -279,8 +279,11 @@ struct DLL_EXPORT DuelParameters
class CPathfinder : private CGameInfoCallback
{
private:
bool useSubterraneanGates;
bool allowEmbarkAndDisembark;
bool allowTeleportTwoWay; // Two-way monoliths and Subterranean Gate
bool allowTeleportOneWay; // One-way monoliths with one known exit only
bool allowTeleportOneWayRandom; // One-way monoliths with more than one known exit
bool allowTeleportWhirlpool; // Force enabled if hero protected or unaffected (have one stack of one creature)
CPathsInfo &out;
const CGHeroInstance *hero;
const std::vector<std::vector<std::vector<ui8> > > &FoW;
@@ -293,7 +296,7 @@ private:
CGPathNode *dp; //destination node -> it's a neighbour of cp that we consider
const TerrainTile *ct, *dt; //tile info for both nodes
ui8 useEmbarkCost; //0 - usual movement; 1 - embark; 2 - disembark
int destTopVisObjID;
Obj destTopVisObjID;
CGPathNode *getNode(const int3 &coord);
@@ -303,6 +306,11 @@ private:
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)
bool addTeleportTwoWay(const CGTeleport * obj) const;
bool addTeleportOneWay(const CGTeleport * obj) const;
bool addTeleportOneWayRandom(const CGTeleport * obj) const;
bool addTeleportWhirlpool(const CGWhirlpool * obj) const;
public:
CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance *_hero);
void calculatePaths(); //calculates possible paths for hero, uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists