diff options
author | Vladimir Menshakov | 2009-11-14 11:45:15 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-11-14 11:45:15 +0000 |
commit | 813fa3d3753618fc83311359d32412cc51f15309 (patch) | |
tree | a8c822b5b3b7f74cbd61907cc5c2869fe3c9573f /engines/teenagent/scene.cpp | |
parent | cc1119940c833f7b61a977306c0a1a9cdf98cd6f (diff) | |
download | scummvm-rg350-813fa3d3753618fc83311359d32412cc51f15309.tar.gz scummvm-rg350-813fa3d3753618fc83311359d32412cc51f15309.tar.bz2 scummvm-rg350-813fa3d3753618fc83311359d32412cc51f15309.zip |
stick to the closest points to the destination instead of walkboxes' centers
svn-id: r45893
Diffstat (limited to 'engines/teenagent/scene.cpp')
-rw-r--r-- | engines/teenagent/scene.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 79ce6b1b66..3e5ade2c27 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -165,15 +165,11 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi search(nodes, n, m, start / m, start % m, -1, end, 1); int v = end; + Common::Point prev(dst); do { debug(1, "backtrace %d", v); - Common::Point c = nodes[v].rect.center(); - if (end / m == v / m) { //same y - c.y = dst.y; - } - if (end % m == v % m) { - c.x = dst.x; - } + Common::Point c = nodes[v].rect.closest_to(prev); + prev = c; p.push_front(c); if (v == start) break; |