Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2004:
[freeciv-ai] (PR#10078) AIs often agress on cease fire just for one turn
Home

[freeciv-ai] (PR#10078) AIs often agress on cease fire just for one turn

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#10078) AIs often agress on cease fire just for one turn
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 13 Sep 2004 08:29:51 -0700
Reply-to: rt@xxxxxxxxxxx

<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
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);

[Prev in Thread] Current Thread [Next in Thread]