Author: cazfi
Date: Sun Apr  3 18:28:18 2016
New Revision: 32299

URL: http://svn.gna.org/viewcvs/freeciv?rev=32299&view=rev
Log:
Default AI counts patience toward other AI players down with the same speed as 
against human
players.

See patch #7035

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=32299&r1=32298&r2=32299&view=diff
==============================================================================
--- branches/S2_5/ai/default/advdiplomacy.c     (original)
+++ branches/S2_5/ai/default/advdiplomacy.c     Sun Apr  3 18:28:18 2016
@@ -1634,7 +1634,7 @@
       adip->asked_about_ceasefire = MAX(adip->asked_about_ceasefire - 1, 0);
       adip->warned_about_space = MAX(adip->warned_about_space - 1, 0);
       adip->spam = MAX(adip->spam - 1, 0);
-      if (adip->spam > 0) {
+      if (adip->spam > 0 && !aplayer->ai_controlled) {
         /* Don't spam */
         continue;
       }
@@ -1642,7 +1642,7 @@
       /* Canvass support from existing friends for our war, and try to
        * make friends with enemies. Then we wait some turns until next time
        * we spam them with our gibbering chatter. */
-      if (!aplayer->ai_controlled) {
+      if (adip->spam <= 0) {
         if (!pplayers_allied(pplayer, aplayer)) {
           adip->spam = fc_rand(4) + 3; /* Bugger allies often. */
         } else {
@@ -1678,39 +1678,43 @@
           break; /* No need to nag our ally */
         }
 
-        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?"),
+        if (adip->spam <= 0) {
+          /* Count down patience toward AI player (one that can have spam > 0) 
+           * at the same speed as toward human players. */
+          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 (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!"),
-                   player_name(pplayer),
-                   player_name(target));
-            DIPLO_LOG(ait, LOG_DIPL2, pplayer, aplayer, "breaking useless 
alliance");
-            /* to peace */
-            handle_diplomacy_cancel_pact(pplayer, player_number(aplayer),
-                                         CLAUSE_ALLIANCE);
-            pplayer->ai_common.love[player_index(aplayer)] =
-              MIN(pplayer->ai_common.love[player_index(aplayer)], 0);
-            if (gives_shared_vision(pplayer, aplayer)) {
-              remove_shared_vision(pplayer, aplayer);
+          } 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));
+              adip->ally_patience--;
             }
-            fc_assert(!gives_shared_vision(pplayer, aplayer));
+          } 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!"),
+                     player_name(pplayer),
+                     player_name(target));
+              DIPLO_LOG(ait, LOG_DIPL2, pplayer, aplayer, "breaking useless 
alliance");
+              /* to peace */
+              handle_diplomacy_cancel_pact(pplayer, player_number(aplayer),
+                                           CLAUSE_ALLIANCE);
+              pplayer->ai_common.love[player_index(aplayer)] =
+                MIN(pplayer->ai_common.love[player_index(aplayer)], 0);
+              if (gives_shared_vision(pplayer, aplayer)) {
+                remove_shared_vision(pplayer, aplayer);
+              }
+              fc_assert(!gives_shared_vision(pplayer, aplayer));
+            }
           }
         }
         break;


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

Reply via email to