1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

Lazy updates of hero paths.

This commit is contained in:
Michał W. Urbańczyk
2011-09-03 02:54:33 +00:00
parent 5072bda7e6
commit 6b9e64de91
7 changed files with 27 additions and 28 deletions

View File

@ -2005,6 +2005,7 @@ bool CGameState::getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath
void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int3 src, int movement)
{
assert(hero);
assert(hero == getHero(hero->id));
if(src.x < 0)
src = hero->getPosition(false);
if(movement < 0)
@ -2209,6 +2210,8 @@ void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int
}
} //neighbours loop
} //queue loop
out.isValid = true;
}
/**
@ -2824,6 +2827,8 @@ CGPathNode::CGPathNode()
bool CPathsInfo::getPath( const int3 &dst, CGPath &out )
{
assert(isValid);
out.nodes.clear();
const CGPathNode *curnode = &nodes[dst.x][dst.y][dst.z];
if(!curnode->theNodeBefore || curnode->accessible == CGPathNode::FLYABLE)