mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Refactoing of pathfinder <-> client/AI interaction to remove dependency on selected hero
- finished removal of server-side setSelection - disabled some broken code (AI & cheats). TODO: fix
This commit is contained in:
@@ -216,50 +216,6 @@ struct UpgradeInfo
|
||||
UpgradeInfo(){oldID = CreatureID::NONE;};
|
||||
};
|
||||
|
||||
struct DLL_LINKAGE CGPathNode
|
||||
{
|
||||
enum EAccessibility
|
||||
{
|
||||
NOT_SET = 0,
|
||||
ACCESSIBLE = 1, //tile can be entered and passed
|
||||
VISITABLE, //tile can be entered as the last tile in path
|
||||
BLOCKVIS, //visitable from neighbouring tile but not passable
|
||||
BLOCKED //tile can't be entered nor visited
|
||||
};
|
||||
|
||||
EAccessibility accessible;
|
||||
ui8 land;
|
||||
ui8 turns; //how many turns we have to wait before reachng the tile - 0 means current turn
|
||||
ui32 moveRemains; //remaining tiles after hero reaches the tile
|
||||
CGPathNode * theNodeBefore;
|
||||
int3 coord; //coordinates
|
||||
|
||||
CGPathNode();
|
||||
bool reachable() const;
|
||||
};
|
||||
|
||||
struct DLL_LINKAGE CGPath
|
||||
{
|
||||
std::vector<CGPathNode> nodes; //just get node by node
|
||||
|
||||
int3 startPos() const; // start point
|
||||
int3 endPos() const; //destination point
|
||||
void convert(ui8 mode); //mode=0 -> from 'manifest' to 'object'
|
||||
};
|
||||
|
||||
struct DLL_LINKAGE CPathsInfo
|
||||
{
|
||||
bool isValid;
|
||||
const CGHeroInstance *hero;
|
||||
int3 hpos;
|
||||
int3 sizes;
|
||||
CGPathNode ***nodes; //[w][h][level]
|
||||
|
||||
bool getPath(const int3 &dst, CGPath &out);
|
||||
CPathsInfo(const int3 &Sizes);
|
||||
~CPathsInfo();
|
||||
};
|
||||
|
||||
struct DLL_EXPORT DuelParameters
|
||||
{
|
||||
ETerrainType terType;
|
||||
@@ -349,7 +305,7 @@ private:
|
||||
|
||||
public:
|
||||
CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance *_hero);
|
||||
void calculatePaths(int3 src = int3(-1,-1,-1), int movement = -1); //calculates possible paths for hero, by default uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
@@ -397,7 +353,7 @@ public:
|
||||
UpgradeInfo getUpgradeInfo(const CStackInstance &stack);
|
||||
PlayerRelations::PlayerRelations getPlayerRelations(PlayerColor color1, PlayerColor color2);
|
||||
bool checkForVisitableDir(const int3 & src, const int3 & dst) const; //check if src tile is visitable from dst tile
|
||||
void calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int3 src = int3(-1,-1,-1), int movement = -1); //calculates possible paths for hero, by default uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists
|
||||
void calculatePaths(const CGHeroInstance *hero, CPathsInfo &out); //calculates possible paths for hero, by default uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists
|
||||
int3 guardingCreaturePosition (int3 pos) const;
|
||||
std::vector<CGObjectInstance*> guardingCreatures (int3 pos) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user