1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Apply fixes to pathfinder

This commit is contained in:
AlexVinS 2015-11-01 01:52:43 +03:00
parent d46364c4c3
commit 1bcfa986e4
2 changed files with 4 additions and 3 deletions

View File

@ -479,11 +479,12 @@ CPathsInfo::~CPathsInfo()
delete [] nodes;
}
const CGPathNode * CPathsInfo::getPathInfo( int3 tile ) const
const CGPathNode * CPathsInfo::getPathInfo(const int3& tile) const
{
boost::unique_lock<boost::mutex> pathLock(pathMx);
if(tile.x >= sizes.x || tile.y >= sizes.y || tile.z >= sizes.z)
if(tile.x >= sizes.x || tile.y >= sizes.y || tile.z >= sizes.z
|| tile.x < 0 || tile.y < 0 || tile.z < 0)
return nullptr;
return &nodes[tile.x][tile.y][tile.z];
}

View File

@ -61,7 +61,7 @@ struct DLL_LINKAGE CPathsInfo
CPathsInfo(const int3 &Sizes);
~CPathsInfo();
const CGPathNode * getPathInfo( int3 tile ) const;
const CGPathNode * getPathInfo(const int3& tile) const;
bool getPath(const int3 &dst, CGPath &out) const;
int getDistance( int3 tile ) const;
};