From 2349b2a1528fe5dc41d930f8dd332df5ba521eb6 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 26 Dec 2015 02:28:59 +0100 Subject: Fixed various issues pointed out by cppcheck Signed-off-by: Haru --- src/map/path.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/map/path.c') diff --git a/src/map/path.c b/src/map/path.c index 543497c33..0df9708d8 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -254,7 +254,7 @@ static int add_path(struct node_heap *heap, struct path_node *tp, int16 x, int16 *------------------------------------------*/ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int flag, cell_chk cell) { - register int i, j, x, y, dx, dy; + register int i, x, y, dx, dy; struct map_data *md; struct walkpath_data s_wpd; @@ -315,8 +315,7 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1 } return false; // easy path unsuccessful - } - else { // !(flag&1) + } else { // !(flag&1) // A* (A-star) pathfinding // We always use A* for finding walkpaths because it is what game client uses. // Easy pathfinding cuts corners of non-walkable cells, but client always walks around it. @@ -331,6 +330,7 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1 int xs = md->xs - 1; int ys = md->ys - 1; int len = 0; + int j; memset(tp, 0, sizeof(tp)); // Start node @@ -407,7 +407,7 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1 } for (it = current; it->parent != NULL; it = it->parent, len++); - if (len > sizeof(wpd->path)) { + if (len > (int)sizeof(wpd->path)) { return false; } -- cgit v1.2.3-60-g2f50