From 813fa3d3753618fc83311359d32412cc51f15309 Mon Sep 17 00:00:00 2001 From: Vladimir Menshakov Date: Sat, 14 Nov 2009 11:45:15 +0000 Subject: stick to the closest points to the destination instead of walkboxes' centers svn-id: r45893 --- engines/teenagent/scene.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'engines/teenagent/scene.cpp') 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; -- cgit v1.2.3