Author: cazfi
Date: Mon Jan 11 16:18:48 2016
New Revision: 31450

URL: http://svn.gna.org/viewcvs/freeciv?rev=31450&view=rev
Log:
AI callback 'diplomacy_actions' is called regardless if player is barbarian or 
not.
Default AI implementation checks EFT_NO_DIPLOMACY before doing anything.

See bug #24282

Modified:
    branches/S2_6/ai/default/advdiplomacy.c
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/ai/default/advdiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/advdiplomacy.c?rev=31450&r1=31449&r2=31450&view=diff
==============================================================================
--- branches/S2_6/ai/default/advdiplomacy.c     (original)
+++ branches/S2_6/ai/default/advdiplomacy.c     Mon Jan 11 16:18:48 2016
@@ -1468,7 +1468,7 @@
   Do diplomatic actions. Must be called only after calculate function
   above has been run for _all_ AI players.
 
-  Only ever called for AI players and never for barbarians.
+  Only ever called for AI players.
 ***********************************************************************/
 void dai_diplomacy_actions(struct ai_type *ait, struct player *pplayer)
 {
@@ -1483,6 +1483,11 @@
 
   fc_assert_ret(pplayer->ai_controlled);
   if (!pplayer->is_alive) {
+    return;
+  }
+
+  if (get_player_bonus(pplayer, EFT_NO_DIPLOMACY) > 0) {
+    /* Diplomacy disabled for this player */
     return;
   }
 

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=31450&r1=31449&r2=31450&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Mon Jan 11 16:18:48 2016
@@ -1076,7 +1076,7 @@
   if (is_new_phase) {
     /* Try to avoid hiding events under a diplomacy dialog */
     phase_players_iterate(pplayer) {
-      if (pplayer->ai_controlled && !is_barbarian(pplayer)) {
+      if (pplayer->ai_controlled) {
         CALL_PLR_AI_FUNC(diplomacy_actions, pplayer, pplayer);
       }
     } phase_players_iterate_end;


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

Reply via email to