(PR#10078) AIs often agress on cease fire just for one turn

"Mateusz Stefek" <mstefek-IjDXvh/[email protected]>
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10078 >

With previous patch it is impossible to have ceasefire with two players.
This patch is better. AI won't break ceasefire when someone is at war
with it's ally. This doesn't mean that alliances will be broken more
often, because ai_players_can_agree_on_ceasefire() checks diplomatic
state between the player and alliance leader.
--
mateusz
cease_fire_restriction3.diff (text/x-patch, 1 KB)
Index: advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.37
diff -u -r1.37 advdiplomacy.c
--- advdiplomacy.c	6 Sep 2004 09:00:32 -0000	1.37
+++ advdiplomacy.c	13 Sep 2004 15:24:51 -0000
@@ -1019,7 +1019,7 @@
     ai_go_to_war(pplayer, ai, target);
   }
 
-  /*** Declare war - against enemies of allies ***/
+  /*** Declare war - against enemies of allies, don't break cease fire ***/
 
   players_iterate(aplayer) {
     struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
@@ -1027,7 +1027,8 @@
     if (aplayer->is_alive
         && adip->at_war_with_ally
         && !adip->is_allied_with_ally
-        && !pplayers_at_war(pplayer, aplayer)) {
+        && !pplayers_at_war(pplayer, aplayer)
+	&& pplayer_get_diplstate(aplayer, pplayer)->type != DS_CEASEFIRE) {
       notify(aplayer, _("*%s (AI)* Your aggression against my allies was "
 			"your last mistake!"), pplayer->name);
       ai_go_to_war(pplayer, ai, aplayer);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.