Fixed walking to unreachable positions

svn-id: r45823
This commit is contained in:
Robert Špalek 2009-11-10 23:23:40 +00:00
parent 9ba6e8138c
commit dea7e18172

View File

@ -988,8 +988,10 @@ void Game::walkHero(int x, int y, SightDirection dir) {
// Compute the shortest and obliqued path.
WalkingPath shortestPath, obliquePath;
_walkingMap.findShortestPath(_hero, target, &shortestPath);
// TODO: test reachability and react
if (!_walkingMap.findShortestPath(_hero, target, &shortestPath)) {
debug(1, "Unreachable point [%d,%d]", target.x, target.y);
return;
}
_walkingMap.obliquePath(shortestPath, &obliquePath);
debugC(2, kDraciWalkingDebugLevel, "Walking path lengths: shortest=%d oblique=%d", shortestPath.size(), obliquePath.size());
if (_vm->_showWalkingMap) {