From 6871becf0afc3ee6dda757ac9d2c27c5c1287e8d Mon Sep 17 00:00:00 2001 From: Olivier Lanneluc Date: Tue, 16 Apr 2013 01:25:40 +0200 Subject: digital/io-hub/src/common-cc: use int instead of mixed int8/int16 for indexes, uint16 for positions --- digital/io-hub/src/common-cc/path.cc | 16 ++++++++-------- digital/io-hub/src/common-cc/path.hh | 34 ++++++++++++++++------------------ 2 files changed, 24 insertions(+), 26 deletions(-) (limited to 'digital/io-hub/src/common-cc') diff --git a/digital/io-hub/src/common-cc/path.cc b/digital/io-hub/src/common-cc/path.cc index 2672426f..63ea7d96 100644 --- a/digital/io-hub/src/common-cc/path.cc +++ b/digital/io-hub/src/common-cc/path.cc @@ -81,7 +81,7 @@ void Path::reset() add_obstacle(pg_cake_pos, pg_cake_radius, PATH_CAKE_POINTS_NB); } -void Path::add_obstacle(const vect_t &c, int r, int num) +void Path::add_obstacle(const vect_t &c, uint16_t r, int num) { uint32_t rot_a, rot_b, nr; uint32_t x, y, nx; @@ -144,7 +144,7 @@ void Path::add_obstacle(const vect_t &c, int r, int num) #endif } -void Path::obstacle(int index, const vect_t &c, int r, int f) +void Path::obstacle(int index, const vect_t &c, uint16_t r, int f) { add_obstacle(c, r, PATH_OBSTACLES_POINTS_NB); } @@ -165,7 +165,7 @@ void Path::compute(int escape) escape_factor = escape; /* Call the A* algorithm */ - path_found = (bool)astar(astar_nodes, PATH_NODES_NB, PATH_POINT_DST_IDX, PATH_POINT_SRC_IDX); + path_found = (bool)astar(astar_nodes, PATH_POINTS_NB, PATH_POINT_DST_IDX, PATH_POINT_SRC_IDX); if (path_found) { /* Store next node to go to */ @@ -174,8 +174,8 @@ void Path::compute(int escape) #if PATH_DEBUG /* Log and display the path found */ vect_t path[PATH_POINTS_NB]; - uint8_t node = PATH_POINT_SRC_IDX; - uint8_t path_nb = 0; + int node = PATH_POINT_SRC_IDX; + int path_nb = 0; DPRINTF(">> Path found: "); while(node!=PATH_POINT_DST_IDX) @@ -203,7 +203,7 @@ bool Path::get_next(vect_t &p) return path_found; } -vect_t& Path::get_point_vect(const uint8_t index) +vect_t& Path::get_point_vect(const int index) { //assert(index