aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRobert Špalek2009-11-01 19:30:51 +0000
committerRobert Špalek2009-11-01 19:30:51 +0000
commit504973a0738843aed968d287416b7945bfa8f32c (patch)
treef69479f2c4206001e877af9f96157206f8b85e60 /engines
parent170918afabaf8a34a2dfcc581f9bc3e851e05161 (diff)
downloadscummvm-rg350-504973a0738843aed968d287416b7945bfa8f32c.tar.gz
scummvm-rg350-504973a0738843aed968d287416b7945bfa8f32c.tar.bz2
scummvm-rg350-504973a0738843aed968d287416b7945bfa8f32c.zip
One more clean-up of the path-finding code
svn-id: r45599
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/walking.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index cbd0e512b9..abc8028d53 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -218,16 +218,17 @@ bool WalkingMap::findShortestPath(Common::Point p1, Common::Point p2, Path *path
// with the smallest number of turns is preferred.
for (int addDir = 0; addDir < 4; ++addDir) {
const int probeDirection = (from + addDir) % 4;
- const Common::Point p(here.x + kDirections[probeDirection][0], here.y + kDirections[probeDirection][1]);
- if (p.x < 0 || p.x >= _mapWidth || p.y < 0 || p.y >= _mapHeight) {
+ const int x = here.x + kDirections[probeDirection][0];
+ const int y = here.y + kDirections[probeDirection][1];
+ if (x < 0 || x >= _mapWidth || y < 0 || y >= _mapHeight) {
continue;
}
// If this point is walkable and we haven't seen it
// yet, record how we have reached it and insert it
// into the round buffer for exploration.
- if (getPixel(p.x, p.y) && cameFrom[p.y * _mapWidth + p.x] == -1) {
- cameFrom[p.y * _mapWidth + p.x] = probeDirection;
- toSearch[toWrite++] = p;
+ if (getPixel(x, y) && cameFrom[y * _mapWidth + x] == -1) {
+ cameFrom[y * _mapWidth + x] = probeDirection;
+ toSearch[toWrite++] = Common::Point(x, y);
toWrite %= bufSize;
}
}