summaryrefslogtreecommitdiff
path: root/digital/avr/modules/path
diff options
context:
space:
mode:
authorNicolas Schodet2010-05-10 23:55:13 +0200
committerNicolas Schodet2010-05-10 23:55:13 +0200
commit674e305bf1d092a510022c736d6b7857a3577fc2 (patch)
treecb0a567f94b437345d05ce47a439c7d68f83eb28 /digital/avr/modules/path
parentcca3dc8353a2c0a9ebb66db7182601bd3d85cb3c (diff)
digital/avr/modules/path/astar: fix integer overflow on avr
Diffstat (limited to 'digital/avr/modules/path')
-rw-r--r--digital/avr/modules/path/astar/astar.c1
-rw-r--r--digital/avr/modules/path/astar/astar.h4
2 files changed, 3 insertions, 2 deletions
diff --git a/digital/avr/modules/path/astar/astar.c b/digital/avr/modules/path/astar/astar.c
index a5d4bd48..4b2c816e 100644
--- a/digital/avr/modules/path/astar/astar.c
+++ b/digital/avr/modules/path/astar/astar.c
@@ -70,6 +70,7 @@ astar (struct astar_node_t *nodes, uint8_t nodes_nb, uint8_t initial,
/* OK, there is some work, move this node to the closed set, it will
* never be consider again. */
nodes[lowest_node].score = ASTAR_NODE_SCORE_CLOSED;
+ nodes[lowest_node].heuristic = 0;
/* Now, process all its neighbors. */
struct astar_neighbor_t neighbors[nodes_nb - 1];
uint8_t neighbors_nb = AC_ASTAR_NEIGHBOR_CALLBACK (lowest_node,
diff --git a/digital/avr/modules/path/astar/astar.h b/digital/avr/modules/path/astar/astar.h
index 5122b6c3..ee82b2cc 100644
--- a/digital/avr/modules/path/astar/astar.h
+++ b/digital/avr/modules/path/astar/astar.h
@@ -26,9 +26,9 @@
* }}} */
/** Used instead of score for a unvisited node. */
-#define ASTAR_NODE_SCORE_UNVISITED 0xffff
+#define ASTAR_NODE_SCORE_UNVISITED ((uint16_t) 0xffff)
/** Used instead of score for a node in the closed set. */
-#define ASTAR_NODE_SCORE_CLOSED 0xfffe
+#define ASTAR_NODE_SCORE_CLOSED ((uint16_t) 0xfffe)
/** Test whether a node is in the open set. */
#define ASTAR_NODE_SCORE_OPEN(score) ((score) < ASTAR_NODE_SCORE_CLOSED)