mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
CPathfinder: clean calculatePaths of code unsused for pathfinding
Map graph initialization should be there as well because it's needed for path checking. This change wouldn't affect anything since currently CPathfinder object created from scratch every time.
This commit is contained in:
parent
213d8c2258
commit
886042dc11
@ -3426,17 +3426,7 @@ void CPathfinder::calculatePaths()
|
||||
return cp->land ? maxMovePointsLand : maxMovePointsWater;
|
||||
};
|
||||
|
||||
out.hero = hero;
|
||||
out.hpos = hero->getPosition(false);
|
||||
|
||||
if(!gs->map->isInTheMap(out.hpos)/* || !gs->map->isInTheMap(dest)*/) //check input
|
||||
{
|
||||
logGlobal->errorStream() << "CGameState::calculatePaths: Hero outside the gs->map? How dare you...";
|
||||
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(out.hpos);
|
||||
@ -3612,6 +3602,16 @@ CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance
|
||||
assert(hero);
|
||||
assert(hero == getHero(hero->id));
|
||||
|
||||
out.hero = hero;
|
||||
out.hpos = hero->getPosition(false);
|
||||
if(!gs->map->isInTheMap(out.hpos)/* || !gs->map->isInTheMap(dest)*/) //check input
|
||||
{
|
||||
logGlobal->errorStream() << "CGameState::calculatePaths: Hero outside the gs->map? How dare you...";
|
||||
throw std::runtime_error("Wrong checksum");
|
||||
}
|
||||
|
||||
initializeGraph();
|
||||
|
||||
allowEmbarkAndDisembark = true;
|
||||
allowTeleportTwoWay = true;
|
||||
allowTeleportOneWay = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user