From 6bb61d40cedc0f73e35c1846bdf69d532ab79724 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 28 Aug 2022 02:24:00 +0300 Subject: [PATCH 19/19] 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 c624576066..38d81da23e 100644 --- a/common/aicore/path_finding.c +++ b/common/aicore/path_finding.c @@ -1213,7 +1213,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; @@ -1371,7 +1371,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; #ifdef PF_DEBUG if (NULL != node1->danger_segment) { @@ -2363,7 +2364,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; @@ -3454,7 +3455,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 307df53386..612aaf26d1 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