1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Fixed major RMG bug.

This commit is contained in:
DjWarmonger
2014-09-21 20:57:42 +02:00
parent e77f328844
commit 5cb6eaa252
3 changed files with 11 additions and 10 deletions

View File

@ -3281,6 +3281,7 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
{
assert(hero);
assert(hero == getHero(hero->id));
if(src.x < 0)
src = hero->getPosition(false);
if(movement < 0)
@ -3303,9 +3304,9 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
return;
}
//logGlobal->infoStream() << boost::format("Calculating paths for hero %s (adress %d) of player %d") % hero->name % hero % hero->tempOwner;
initializeGraph();
//initial tile - set cost on 0 and add to the queue
CGPathNode &initialNode = *getNode(src);
initialNode.turns = 0;
@ -3457,7 +3458,7 @@ CGPathNode::EAccessibility CPathfinder::evaluateAccessibility(const TerrainTile
{
for(const CGObjectInstance *obj : tinfo->visitableObjects)
{
if(obj->passableFor(hero->tempOwner)) //special object instance specific passableness flag - overwrites other accessibility flags
if (obj->passableFor(hero->tempOwner))
{
ret = CGPathNode::ACCESSIBLE;
}