From 6db6a923128b3f9c45820508c41f2fdbc0edfe58 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 14 May 2012 13:32:44 +0200 Subject: digital/io-hub/src/guybrush: fix path optimization --- digital/io-hub/src/guybrush/path.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'digital/io-hub/src/guybrush/path.c') diff --git a/digital/io-hub/src/guybrush/path.c b/digital/io-hub/src/guybrush/path.c index 81a2270e..1ec32940 100644 --- a/digital/io-hub/src/guybrush/path.c +++ b/digital/io-hub/src/guybrush/path.c @@ -385,17 +385,13 @@ path_optimize (void) vect_t curp, nextp, next2p; path_pos (cur, &curp); next = path.astar_nodes[cur].prev; - if (next == 0xff || next == PATH_DST_NODE_INDEX) - return; path_pos (next, &nextp); /* Look at three points, if they are aligned, remove the center point. */ - while (1) + while (next != 0xff && next != PATH_DST_NODE_INDEX) { /* Nodes: cur ---> next ---> next2. Do not be fooled by the "prev" * name, astar is feed backward. */ next2 = path.astar_nodes[next].prev; - if (next2 == 0xff || next2 == PATH_DST_NODE_INDEX) - break; path_pos (next2, &next2p); vect_t vnp = nextp; vect_sub (&vnp, &curp); vect_t vn2p = next2p; vect_sub (&vn2p, &curp); -- cgit v1.2.3