Project

General

Profile

Feature #1916 » 0020-AI-Add-war-countdown-sanity-check.patch

Marko Lindqvist, 02/04/2026 08:00 AM

View differences:

ai/default/daiplayer.c
/* server */
#include "citytools.h"
#include "sanitycheck.h"
/* ai/default */
#include "daidata.h"
......
**************************************************************************/
void dai_sanity_check(struct ai_type *ait, struct player *pplayer)
{
#ifdef SANITY_CHECKING
#define SANITY_CHECK(check) \
fc_assert_full(__FILE__, __FUNCTION__, __FC_LINE__, check, , NOLOGMSG, NOLOGMSG)
struct player *wt = def_ai_player_data(pplayer, ait)->diplomacy.war_target;
players_iterate_alive(opponent) {
struct ai_dip_intel *adip = dai_diplomacy_get(ait, pplayer, opponent);
bool at_war = pplayers_at_war(pplayer, opponent);
bool war_target = (wt == opponent);
/* SANITY_CHECK(adip->countdown < 0 || !at_war); */
SANITY_CHECK(adip->countdown >= -1 || at_war || war_target);
} players_iterate_alive_end;
#endif /* SANITY_CHECKING */
}
(2-2/2)