Project

General

Profile

Bug #2400 » 0030-AI-Fix-declaring-war-on-multiple-targets-after-senat.patch

S3_3, S3_2 - Marko Lindqvist, 11/08/2026 05:35 AM

View differences:

ai/default/daidata.h
char love_incr; /* Modify love with this fixed amount */
int req_love_for_peace;
int req_love_for_alliance;
struct player *war_target;
} diplomacy;
/* Cache map for AI settlers; defined in daisettler.c. */
ai/default/daidiplomacy.c
pplayer->government = real_gov;
handle_player_change_government(pplayer,
game.info.government_during_revolution_id);
def_ai_player_data(pplayer, ait)->diplomacy.war_target = target;
return;
} else {
/* There would be Senate even during revolution. Better not to revolt for nothing */
......
**********************************************************************/
void dai_revolution_start(struct ai_type *ait, struct player *pplayer)
{
struct ai_plr *data = def_ai_player_data(pplayer, ait);
if (data->diplomacy.war_target != NULL) {
/* Target might have died since it was set. */
if (data->diplomacy.war_target->is_alive) {
if (gives_shared_vision(pplayer, data->diplomacy.war_target)) {
remove_shared_vision(pplayer, data->diplomacy.war_target);
players_iterate_alive(opponent) {
struct ai_dip_intel *adip = dai_diplomacy_get(ait, pplayer, opponent);
if (adip->countdown < -1 && !pplayers_at_war(pplayer, opponent)) {
/* We were waiting for opportunity to declare war without
* the senate intervening. */
if (gives_shared_vision(pplayer, opponent)) {
remove_shared_vision(pplayer, opponent);
}
dai_declare_war(ait, pplayer, data->diplomacy.war_target);
dai_declare_war(ait, pplayer, opponent);
}
data->diplomacy.war_target = NULL;
}
} players_iterate_alive_end;
}
/******************************************************************//**
(2-2/2)