From 6a7d3b07753b695ffef09a09b7af4f00967c017a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 28 Aug 2022 02:22:36 +0300 Subject: [PATCH 45/45] Make pf_path.length unsigned See osdn #45416 Signed-off-by: Marko Lindqvist --- common/aicore/path_finding.c | 9 +++++---- common/aicore/path_finding.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/aicore/path_finding.c b/common/aicore/path_finding.c index 8d05f4da2f..2df24b359c 100644 --- a/common/aicore/path_finding.c +++ b/common/aicore/path_finding.c @@ -1216,7 +1216,7 @@ pf_danger_map_construct_path(const struct pf_danger_map *pfdm, struct pf_danger_pos *danger_seg = NULL; bool waited = FALSE; struct pf_danger_node *node = pfdm->lattice + tile_index(ptile); - int length = 1; + unsigned length = 1; struct tile *iter_tile = ptile; const struct pf_parameter *params = pf_map_parameter(PF_MAP(pfdm)); struct pf_position *pos; @@ -1374,7 +1374,8 @@ static void pf_danger_map_create_segment(struct pf_danger_map *pfdm, struct tile *ptile = PF_MAP(pfdm)->tile; struct pf_danger_node *node = pfdm->lattice + tile_index(ptile); struct pf_danger_pos *pos; - int length = 0, i; + unsigned length = 0; + unsigned i; const struct pf_parameter *params = pf_map_parameter(PF_MAP(pfdm)); #ifdef PF_DEBUG @@ -2370,7 +2371,7 @@ pf_fuel_map_construct_path(const struct pf_fuel_map *pffm, enum direction8 dir_next = direction8_invalid(); struct pf_fuel_node *node = pffm->lattice + tile_index(ptile); struct pf_fuel_pos *segment = node->segment; - int length = 1; + unsigned length = 1; struct tile *iter_tile = ptile; const struct pf_parameter *params = pf_map_parameter(PF_MAP(pffm)); struct pf_position *pos; @@ -3465,7 +3466,7 @@ struct pf_path *pf_path_concat(struct pf_path *dest_path, ****************************************************************************/ bool pf_path_advance(struct pf_path *path, struct tile *ptile) { - int i; + unsigned i; struct pf_position *new_positions; for (i = 0; path->positions[i].tile != ptile; i++) { diff --git a/common/aicore/path_finding.h b/common/aicore/path_finding.h index 8edbad2445..089178ca14 100644 --- a/common/aicore/path_finding.h +++ b/common/aicore/path_finding.h @@ -342,7 +342,7 @@ struct pf_position { /* Full specification of a path. */ struct pf_path { - int length; /* Number of steps in the path */ + unsigned length; /* Number of steps in the path */ struct pf_position *positions; }; -- 2.35.1