From 9aaf6df724e49f8614a203d0f0ba2b6f08d14898 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 3 Jun 2021 03:05:20 +0300 Subject: [PATCH 56/56] ai.[ch]: Improve coding style See osdn #42456 Signed-off-by: Marko Lindqvist --- common/ai.c | 7 ++++--- common/ai.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/ai.c b/common/ai.c index bef00b0f84..c02eabc3bd 100644 --- a/common/ai.c +++ b/common/ai.c @@ -24,9 +24,10 @@ #include "timing.h" /* common */ -#include "ai.h" #include "player.h" +#include "ai.h" + static struct ai_type ai_types[FREECIV_AI_MOD_LAST]; static int ai_type_count = 0; @@ -56,6 +57,7 @@ void ai_timer_init(void) aitimers = fc_calloc(FREECIV_AI_MOD_LAST, sizeof(*aitimers)); for (i = 0; i < FREECIV_AI_MOD_LAST; i++) { struct ai_timer *aitimer = aitimers + i; + aitimer->count = 0; aitimer->timer = NULL; } @@ -64,6 +66,7 @@ void ai_timer_init(void) sizeof(*aitimer_plrs)); for (i = 0; i < FREECIV_AI_MOD_LAST * MAX_NUM_PLAYER_SLOTS; i++) { struct ai_timer *aitimer = aitimer_plrs + i; + aitimer->count = 0; aitimer->timer = NULL; } @@ -113,7 +116,6 @@ static struct ai_timer *ai_timer_get(const struct ai_type *ai) struct ai_timer *aitimer; fc_assert_ret_val(ai != NULL, NULL); - fc_assert_ret_val(aitimers != NULL, NULL); aitimer = aitimers + ai_type_number(ai); @@ -134,7 +136,6 @@ static struct ai_timer *ai_timer_player_get(const struct player *pplayer) fc_assert_ret_val(pplayer != NULL, NULL); fc_assert_ret_val(pplayer->ai != NULL, NULL); - fc_assert_ret_val(aitimer_plrs != NULL, NULL); aitimer = aitimer_plrs + (player_index(pplayer) * FREECIV_AI_MOD_LAST diff --git a/common/ai.h b/common/ai.h index 5ea13d5ae4..52ade2b8af 100644 --- a/common/ai.h +++ b/common/ai.h @@ -113,7 +113,7 @@ struct ai_type /* Called for AI type of the player who gets split to two. */ void (*split_by_civil_war)(struct player *original, struct player *created); - /* Called for AI type of the player who got created from the split. */ + /* Called for AI type of the player who got created from the split. */ void (*created_by_civil_war)(struct player *original, struct player *created); /* Called for player AI type when player phase begins. This is in the -- 2.30.2