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 00:39:40 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10078 >

The reason is that ai_players_can_agree_on_ceasefire() isn't restrictive
enough.
This patch fixes it.
Also change the method of calculating ai.love gravitation. Now it's
better rounded.
--
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 07:34:50 -0000
@@ -173,8 +173,7 @@
   struct ai_data *ai1;
   ai1 = ai_data_get(player1);
   return (ai1->diplomacy.target != player2 && 
-          (player1 == ai1->diplomacy.alliance_leader ||
-           !pplayers_at_war(player2, ai1->diplomacy.alliance_leader)) &&
+          ai1->diplomacy.player_intel[player2->player_no].at_war_with_ally &&
          player1->ai.love[player2->player_no] > -40 &&
          (ai1->diplomacy.target == NULL || 
           !pplayers_allied(ai1->diplomacy.target, player2)));
@@ -743,8 +742,9 @@
          
     /* Massage our numbers to keep love and its opposite on the ground. 
      * Gravitate towards zero. */
-    pplayer->ai.love[aplayer->player_no] -= 
-       (pplayer->ai.love[aplayer->player_no] * ai->diplomacy.love_coeff / 100);
+    pplayer->ai.love[aplayer->player_no] = 
+       (pplayer->ai.love[aplayer->player_no] * 
+       (100 - ai->diplomacy.love_coeff) / 100);
        
     /* ai love should always be in range [-100..100] */
     pplayer->ai.love[aplayer->player_no] = 

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