Author: cazfi
Date: Sun Mar 16 21:45:36 2014
New Revision: 24687

URL: http://svn.gna.org/viewcvs/freeciv?rev=24687&view=rev
Log:
Default AI does not try to check if ally plans to declare war on its behalf.
That was working only when the ally had exactly same AI type, and was not an
human player. Otherwise it worked on incorrect data.

See bug #21630

Modified:
    branches/S2_5/ai/default/advdiplomacy.c

Modified: branches/S2_5/ai/default/advdiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/advdiplomacy.c?rev=24687&r1=24686&r2=24687&view=diff
==============================================================================
--- branches/S2_5/ai/default/advdiplomacy.c     (original)
+++ branches/S2_5/ai/default/advdiplomacy.c     Sun Mar 16 21:45:36 2014
@@ -1623,10 +1623,7 @@
       }
       target = NULL;
       players_iterate(eplayer) {
-        /* Read the countdown check below carefully... Note that we check
-         * our ally's intentions directly here. */
         if (WAR(pplayer, eplayer)
-            && (dai_diplomacy_get(ait, aplayer, eplayer)->countdown == -1)
             && !pplayers_at_war(aplayer, eplayer)) {
           target = eplayer;
           break;
@@ -1643,25 +1640,27 @@
         break; /* No need to nag our ally */
       }
 
-      switch (adip->ally_patience--) {
-        case 0:
-          notify(aplayer, _("*%s (AI)* Greetings our most trustworthy "
-                 "ally. We call upon you to destroy our enemy, %s."), 
+      if (adip->ally_patience == 0) {
+        notify(aplayer, _("*%s (AI)* Greetings our most trustworthy "
+                          "ally. We call upon you to destroy our enemy, %s."), 
+               player_name(pplayer),
+               player_name(target));
+        adip->ally_patience--;
+      } else if (adip->ally_patience == -1) {
+        if (fc_rand(5) == 1) {
+          notify(aplayer, _("*%s (AI)* Greetings ally, I see you have not yet "
+                            "made war with our enemy, %s. Why do I need to 
remind "
+                            "you of your promises?"),
                  player_name(pplayer),
                  player_name(target));
-          break;
-        case -1:
-          notify(aplayer, _("*%s (AI)* Greetings ally, I see you have not yet "
-                 "made war with our enemy, %s. Why do I need to remind "
-                 "you of your promises?"),
-                 player_name(pplayer),
-                 player_name(target));
-          break;
-        case -2:
+          adip->ally_patience--;
+        }
+      } else {
+        if (fc_rand(5) == 1) {
           notify(aplayer, _("*%s (AI)* Dishonored one, we made a pact of "
-                 "alliance, and yet you remain at peace with our mortal "
-                 "enemy, %s! This is unacceptable; our alliance is no "
-                 "more!"),
+                            "alliance, and yet you remain at peace with our 
mortal "
+                            "enemy, %s! This is unacceptable; our alliance is 
no "
+                            "more!"),
                  player_name(pplayer),
                  player_name(target));
           DIPLO_LOG(ait, LOG_DIPL2, pplayer, aplayer, "breaking useless 
alliance");
@@ -1674,7 +1673,7 @@
             remove_shared_vision(pplayer, aplayer);
           }
           fc_assert(!gives_shared_vision(pplayer, aplayer));
-          break;
+        }
       }
       break;
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to