Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9530) Show AI attitudes in player dialog
Home

[Freeciv-Dev] (PR#9530) Show AI attitudes in player dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9530) Show AI attitudes in player dialog
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 28 Jul 2004 14:07:12 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch adds a new column to the player dialog which shows the AI's
attitudes towards you. No, it is not "realistic" to have this info, and it
only works for AIs, but 1) it is supposed to be more fun this way, 2) "all
the other games do it this way", and 3) Jason asked me to do it :)

So here you go.

  - Per

Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.25
diff -u -r1.25 advdiplomacy.c
--- ai/advdiplomacy.c   20 Jul 2004 11:48:25 -0000      1.25
+++ ai/advdiplomacy.c   28 Jul 2004 20:40:43 -0000
@@ -316,7 +316,8 @@
                pplayer->name, aplayer->name);
         worth = -BIG_NUMBER;
       } else {
-        worth = greed(adip->love - ai->diplomacy.req_love_for_peace);
+        worth = greed(pplayer->ai.love[aplayer->player_no]
+                      - ai->diplomacy.req_love_for_peace);
       }
     } else if (pclause->type == CLAUSE_ALLIANCE) {
       if (!pplayers_in_peace(pplayer, aplayer)) {
@@ -324,10 +325,12 @@
                pplayer->name, aplayer->name);
         worth = -BIG_NUMBER;
       } else {
-        worth = greed(adip->love - ai->diplomacy.req_love_for_alliance);
+        worth = greed(pplayer->ai.love[aplayer->player_no]
+                      - ai->diplomacy.req_love_for_alliance);
       }
     } else {
-      worth = greed(adip->love - ai->diplomacy.req_love_for_ceasefire);
+      worth = greed(pplayer->ai.love[aplayer->player_no]
+                    - ai->diplomacy.req_love_for_ceasefire);
     }
   break;
 
@@ -525,7 +528,6 @@
   int total_balance = 0;
   bool gift = TRUE;
   struct ai_data *ai = ai_data_get(pplayer);
-  struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
 
   /* Evaluate clauses */
   clause_list_iterate(ptreaty->clauses, pclause) {
@@ -546,7 +548,7 @@
     int i = total_balance / ((city_list_size(&pplayer->cities) * 50) + 1);
 
     i = MIN(i, ai->diplomacy.love_incr * 150);
-    adip->love += i;
+    pplayer->ai.love[aplayer->player_no] += i;
     PLAYER_LOG(LOG_DIPL2, pplayer, ai, "%s's gift to %s increased love by %d",
             aplayer->name, pplayer->name, i);
   }
@@ -626,8 +628,8 @@
   } players_iterate_end;
 
   /* Modify by hatred */
-  if (adip->love < 0) {
-    kill_desire += kill_desire / 100 * adip->love;
+  if (pplayer->ai.love[aplayer->player_no] < 0) {
+    kill_desire += kill_desire / 100 * pplayer->ai.love[aplayer->player_no];
   }
 
   /* Amortize by distance */
@@ -660,7 +662,7 @@
 ***********************************************************************/
 void ai_diplomacy_calculate(struct player *pplayer, struct ai_data *ai)
 {
-  int war_desire[MAX_NUM_PLAYERS];
+  int war_desire[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
   int best_desire = 0;
   struct player *target = NULL;
 
@@ -680,32 +682,35 @@
     if (pplayer == aplayer || !aplayer->is_alive) {
       continue;
     }
-    adip->love -= pplayer->diplstates[a].has_reason_to_cancel;
+    pplayer->ai.love[aplayer->player_no] -= 
+                         pplayer->diplstates[a].has_reason_to_cancel;
     if ((pplayers_non_attack(pplayer, aplayer) 
          || pplayers_allied(pplayer, aplayer))
         && pplayer->diplstates[a].has_reason_to_cancel == 0
         && !adip->is_allied_with_enemy
         && !adip->at_war_with_ally
         && adip->ally_patience >= 0) {
-      adip->love += ai->diplomacy.love_incr;
+      pplayer->ai.love[aplayer->player_no] += ai->diplomacy.love_incr;
       PLAYER_LOG(LOG_DEBUG, pplayer, ai, "Increased love for %s (now %d)",
-                 aplayer->name, adip->love);
+                 aplayer->name, pplayer->ai.love[aplayer->player_no]);
     } else if (pplayer->diplstates[aplayer->player_no].type == DS_WAR) {
-      adip->love -= ai->diplomacy.love_incr;
+      pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
       PLAYER_LOG(LOG_DEBUG, pplayer, ai, "Reduced love for %s (now %d) ",
-                 aplayer->name, adip->love);
+                 aplayer->name, pplayer->ai.love[aplayer->player_no]);
     } else if (pplayer->diplstates[a].has_reason_to_cancel != 0) {
       /* Provoked in time of peace */
-      if (adip->love > 0) {
+      if (pplayer->ai.love[aplayer->player_no] > 0) {
         PLAYER_LOG(LOG_DEBUG, pplayer, ai, "Provoked by %s! Love halved "
-                   "(was %d)", aplayer->name, adip->love);
-        adip->love /= 2;
+                   "(was %d)", aplayer->name, 
+                   pplayer->ai.love[aplayer->player_no]);
+        pplayer->ai.love[aplayer->player_no] /= 2;
       }
-      adip->love -= ai->diplomacy.love_incr;
+      pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
     }
     /* Massage our numbers to keep love and its opposite on the ground. 
      * Gravitate towards zero. */
-    adip->love -= (adip->love * ai->diplomacy.love_coeff / 100);
+    pplayer->ai.love[aplayer->player_no] -= 
+       (pplayer->ai.love[aplayer->player_no] * ai->diplomacy.love_coeff / 100);
   } players_iterate_end;
 
   /* Stop war against a dead player */
@@ -855,8 +860,6 @@
 static void ai_go_to_war(struct player *pplayer, struct ai_data *ai,
                          struct player *target)
 {
-  struct ai_dip_intel *adip = &ai->diplomacy.player_intel[target->player_no];
-
   if (gives_shared_vision(pplayer, target)) {
     remove_shared_vision(pplayer, target);
   }
@@ -867,10 +870,11 @@
   /* Continue war at least in this arbitrary number of turns to show 
    * some spine */
   ai->diplomacy.timer = myrand(4) + 3;
-  if (adip->love < 0) {
-    ai->diplomacy.timer -= adip->love / 10;
+  if (pplayer->ai.love[target->player_no] < 0) {
+    ai->diplomacy.timer -= pplayer->ai.love[target->player_no] / 10;
   } else {
-    adip->love = -1; /* We DO NOT love our enemies! AIs are heatens! */
+    /* We DO NOT love our enemies! AIs are heatens! */
+    pplayer->ai.love[target->player_no] = -1; 
   }
   assert(!gives_shared_vision(pplayer, target));
 }
@@ -895,7 +899,7 @@
 
   players_iterate(aplayer) {
     if (ai->diplomacy.acceptable_reputation > aplayer->reputation
-        && ai->diplomacy.player_intel[aplayer->player_no].love < 0
+        && pplayer->ai.love[aplayer->player_no] < 0
         && pplayer->diplstates[aplayer->player_no].has_reason_to_cancel >= 2) {
       PLAYER_LOG(LOG_DIPL2, pplayer, ai, "Declaring war on %s in revenge",
                  target->name);
@@ -930,7 +934,8 @@
         if (gives_shared_vision(pplayer, aplayer)) {
           remove_shared_vision(pplayer, aplayer);
         }
-        adip->love = -(BIG_NUMBER); /* Never forgive this */
+        /* Never forgive this */
+        pplayer->ai.love[aplayer->player_no] = -(BIG_NUMBER);
       } else if (ship->state == SSHIP_STARTED 
                 && adip->warned_about_space == 0) {
         adip->warned_about_space = 10 + myrand(6);
@@ -962,7 +967,7 @@
       /* We have good reason */
       notify(target, _("*%s (AI)* Your despicable actions will not go "
              "unpunished!"), pplayer->name);
-    } if (ai->diplomacy.player_intel[target->player_no].love < 0) {
+    } if (pplayer->ai.love[target->player_no] < 0) {
       /* We have a reason of sorts from way back. */
       notify(target, _("*%s (AI)* Finally I get around to you! Did "
              "you really think you could get away with your crimes?"),
@@ -1087,7 +1092,8 @@
          /* to peace */
          handle_diplomacy_cancel_pact(pplayer, aplayer->player_no,
                                       CLAUSE_ALLIANCE);
-          adip->love = MIN(adip->love, 0);
+          pplayer->ai.love[aplayer->player_no] = 
+                                 MIN(pplayer->ai.love[aplayer->player_no], 0);
           if (gives_shared_vision(pplayer, aplayer)) {
             remove_shared_vision(pplayer, aplayer);
           }
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.29
diff -u -r1.29 aidata.c
--- ai/aidata.c 25 Jun 2004 23:43:00 -0000      1.29
+++ ai/aidata.c 28 Jul 2004 20:40:43 -0000
@@ -368,11 +368,11 @@
   ai->diplomacy.req_love_for_ceasefire = 0;
   ai->diplomacy.alliance_leader = pplayer;
 
-  for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+  for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
     ai->diplomacy.player_intel[i].spam = i; /* pseudorandom */
     ai->diplomacy.player_intel[i].distance = 1;
     ai->diplomacy.player_intel[i].ally_patience = 0;
-    ai->diplomacy.player_intel[i].love = 1;
+    pplayer->ai.love[i] = 1;
     ai->diplomacy.player_intel[i].asked_about_peace = 0;
     ai->diplomacy.player_intel[i].asked_about_alliance = 0;
     ai->diplomacy.player_intel[i].asked_about_ceasefire = 0;
Index: ai/aidata.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.h,v
retrieving revision 1.13
diff -u -r1.13 aidata.h
--- ai/aidata.h 20 Jun 2004 07:41:14 -0000      1.13
+++ ai/aidata.h 28 Jul 2004 20:40:43 -0000
@@ -43,7 +43,6 @@
   char spam;      /* timer to avoid spamming a player with chat */
   int distance;   /* average distance to that player's cities */
   char ally_patience; /* we EXPECT our allies to help us! */
-  int love;       /* basic player <-> player relation */
   char asked_about_peace;     /* don't ask again */
   char asked_about_alliance;  /* don't nag! */
   char asked_about_ceasefire; /* don't ... you get the point */
Index: ai/ailog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/ailog.c,v
retrieving revision 1.15
diff -u -r1.15 ailog.c
--- ai/ailog.c  14 Jun 2004 22:00:12 -0000      1.15
+++ ai/ailog.c  28 Jul 2004 20:40:43 -0000
@@ -54,7 +54,7 @@
   if (ai->diplomacy.target) {
     my_snprintf(targetbuffer, sizeof(targetbuffer), "[ti%d co%d lo%d %s] ",
                 ai->diplomacy.timer, ai->diplomacy.countdown,
-              ai->diplomacy.player_intel[ai->diplomacy.target->player_no].love,
+                pplayer->ai.love[ai->diplomacy.target->player_no],
                 ai->diplomacy.target->name);
   }
   my_snprintf(buffer, sizeof(buffer), "%s %s%s%s ", pplayer->name,
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.390
diff -u -r1.390 packhand.c
--- client/packhand.c   20 Jul 2004 11:05:36 -0000      1.390
+++ client/packhand.c   28 Jul 2004 20:40:44 -0000
@@ -1534,6 +1534,9 @@
   pplayer->embassy=pinfo->embassy;
   pplayer->gives_shared_vision = pinfo->gives_shared_vision;
   pplayer->city_style=pinfo->city_style;
+  for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
+    pplayer->ai.love[i] = pinfo->love[i];
+  }
 
   for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
     pplayer->diplstates[i].type =
Index: client/plrdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.c,v
retrieving revision 1.8
diff -u -r1.8 plrdlg_common.c
--- client/plrdlg_common.c      23 Apr 2004 22:58:05 -0000      1.8
+++ client/plrdlg_common.c      28 Jul 2004 20:40:44 -0000
@@ -134,6 +134,18 @@
 }
 
 /******************************************************************
+  Return a string displaying the AI's love (or not) for you...
+*******************************************************************/
+static const char *col_love(struct player *player)
+{
+  if (player == game.player_ptr || !player->ai.control) {
+    return "-";
+  } else {
+    return love_text(player->ai.love[game.player_ptr->player_no]);
+  }
+}
+
+/******************************************************************
  ...
 *******************************************************************/
 static const char *col_vision(struct player *player)
@@ -204,6 +216,7 @@
   {TRUE, COL_COLOR, N_("Border"), NULL, NULL, "border"},
   {TRUE, COL_TEXT, N_("Team"), col_team, NULL, "team"},
   {TRUE, COL_BOOLEAN, N_("AI"), NULL, col_ai, "ai"},
+  {TRUE, COL_TEXT, N_("Attitude"), col_love, NULL, "attitude"},
   {TRUE, COL_TEXT, N_("Embassy"), col_embassy, NULL, "embassy"},
   {TRUE, COL_TEXT, N_("Dipl.State"), col_diplstate, NULL, "diplstate"},
   {TRUE, COL_TEXT, N_("Vision"), col_vision, NULL, "vision"},
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.173
diff -u -r1.173 capstr.c
--- common/capstr.c     20 Jul 2004 11:05:36 -0000      1.173
+++ common/capstr.c     28 Jul 2004 20:40:44 -0000
@@ -77,7 +77,8 @@
                    "+starter +union +iso_maps +big_map_size +orders2client " \
                    "+change_production +tilespec1 +no_earth +trans " \
                    "+want_hack invasions bombard +killstack2 spec +spec2 " \
-                   "+city_map startunits +turn_last_built +happyborders"
+                   "+city_map startunits +turn_last_built +happyborders " \
+                   "+love"
 
 /* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
  *
@@ -130,6 +131,8 @@
  * 
  * "happyborders" means that units may not cause unhappiness inside
  * our own borders.
+ * 
+ * "love" means that we show the AI love for you in the client
  */
 
 void init_our_capability(void)
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.33
diff -u -r1.33 packets.def
--- common/packets.def  20 Jul 2004 11:05:37 -0000      1.33
+++ common/packets.def  28 Jul 2004 20:40:44 -0000
@@ -553,6 +553,7 @@
   UINT8 barbarian_type;
   uint32(unsigned int) gives_shared_vision;
   BIT_STRING inventions[A_LAST+1];
+  SINT16 love[MAX_NUM_PLAYERS];
 end
 
 PACKET_PLAYER_TURN_DONE=40;cs
Index: common/packets_gen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.c,v
retrieving revision 1.37
diff -u -r1.37 packets_gen.c
--- common/packets_gen.c        20 Jul 2004 11:05:37 -0000      1.37
+++ common/packets_gen.c        28 Jul 2004 20:40:46 -0000
@@ -8434,7 +8434,7 @@
   return 0;
 }
 
-BV_DEFINE(packet_player_info_100_fields, 28);
+BV_DEFINE(packet_player_info_100_fields, 29);
 
 static struct packet_player_info *receive_packet_player_info_100(struct 
connection *pc, enum packet_type type)
 {
@@ -8544,6 +8544,16 @@
   if (BV_ISSET(fields, 27)) {
     dio_get_bit_string(&din, real_packet->inventions, 
sizeof(real_packet->inventions));
   }
+  if (BV_ISSET(fields, 28)) {
+    
+    {
+      int i;
+    
+      for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+        dio_get_sint16(&din, (int *) &real_packet->love[i]);
+      }
+    }
+  }
 
   clone = fc_malloc(sizeof(*clone));
   *clone = *real_packet;
@@ -8702,6 +8712,22 @@
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 27);}
 
+
+    {
+      differ = (MAX_NUM_PLAYERS != MAX_NUM_PLAYERS);
+      if(!differ) {
+        int i;
+        for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+          if (old->love[i] != real_packet->love[i]) {
+            differ = TRUE;
+            break;
+          }
+        }
+      }
+    }
+  if(differ) {different++;}
+  if(differ) {BV_SET(fields, 28);}
+
   if (different == 0 && !force_send_of_unchanged) {
     return 0;
   }
@@ -8790,6 +8816,16 @@
   if (BV_ISSET(fields, 27)) {
     dio_put_bit_string(&dout, real_packet->inventions);
   }
+  if (BV_ISSET(fields, 28)) {
+  
+    {
+      int i;
+
+      for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+        dio_put_sint16(&dout, real_packet->love[i]);
+      }
+    } 
+  }
 
 
   if (old_from_hash) {
@@ -8824,7 +8860,7 @@
   return 0;
 }
 
-BV_DEFINE(packet_player_info_101_fields, 27);
+BV_DEFINE(packet_player_info_101_fields, 28);
 
 static struct packet_player_info *receive_packet_player_info_101(struct 
connection *pc, enum packet_type type)
 {
@@ -8931,6 +8967,16 @@
   if (BV_ISSET(fields, 26)) {
     dio_get_bit_string(&din, real_packet->inventions, 
sizeof(real_packet->inventions));
   }
+  if (BV_ISSET(fields, 27)) {
+    
+    {
+      int i;
+    
+      for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+        dio_get_sint16(&din, (int *) &real_packet->love[i]);
+      }
+    }
+  }
 
   clone = fc_malloc(sizeof(*clone));
   *clone = *real_packet;
@@ -9085,6 +9131,22 @@
   if(differ) {different++;}
   if(differ) {BV_SET(fields, 26);}
 
+
+    {
+      differ = (MAX_NUM_PLAYERS != MAX_NUM_PLAYERS);
+      if(!differ) {
+        int i;
+        for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+          if (old->love[i] != real_packet->love[i]) {
+            differ = TRUE;
+            break;
+          }
+        }
+      }
+    }
+  if(differ) {different++;}
+  if(differ) {BV_SET(fields, 27);}
+
   if (different == 0 && !force_send_of_unchanged) {
     return 0;
   }
@@ -9170,6 +9232,16 @@
   if (BV_ISSET(fields, 26)) {
     dio_put_bit_string(&dout, real_packet->inventions);
   }
+  if (BV_ISSET(fields, 27)) {
+  
+    {
+      int i;
+
+      for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+        dio_put_sint16(&dout, real_packet->love[i]);
+      }
+    } 
+  }
 
 
   if (old_from_hash) {
Index: common/packets_gen.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets_gen.h,v
retrieving revision 1.29
diff -u -r1.29 packets_gen.h
--- common/packets_gen.h        20 Jul 2004 11:05:37 -0000      1.29
+++ common/packets_gen.h        28 Jul 2004 20:40:47 -0000
@@ -337,6 +337,7 @@
   int barbarian_type;
   unsigned int gives_shared_vision;
   char inventions[A_LAST+1];
+  int love[MAX_NUM_PLAYERS];
 };
 
 struct packet_player_turn_done {
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.142
diff -u -r1.142 player.c
--- common/player.c     18 Jul 2004 17:09:39 -0000      1.142
+++ common/player.c     28 Jul 2004 20:40:47 -0000
@@ -579,6 +579,39 @@
   return !normal_decision;
 }
 
+
+
+/**************************************************************************
+  Return a text describing an AI's love for you.  (Oooh, kinky!!)
+**************************************************************************/
+const char *love_text(const int love)
+{
+  if (love < -51) {
+    return "Bloodfeud";
+  } else if (love >= -50 && love <= -21) {
+    return "Loathing";
+  } else if (love >= -20 && love <= -11) {
+    return "Hatred";
+  } else if (love >= -10 && love <= -5) {
+    return "Dislike";
+  } else if (love >= -4 && love <= -3) {
+    return "Unease";
+  } else if (love >= -2 && love <= 2) {
+    return "Indifferent";
+  } else if (love >= 3 && love <= 9) {
+    return "Peaceful";
+  } else if (love >= 10 && love <= 20) {
+    return "Relaxed";
+  } else if (love >= 21 && love <= 50) {
+    return "Friendly";
+  } else if (love >= 51 && love <= 70) {
+    return "Amiable";
+  } else {
+    assert(love >= 71);
+    return "Harmony";
+  }
+}
+
 /**************************************************************************
 Return a reputation level as a human-readable string
 **************************************************************************/
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.117
diff -u -r1.117 player.h
--- common/player.h     24 Jul 2004 12:26:05 -0000      1.117
+++ common/player.h     28 Jul 2004 20:40:47 -0000
@@ -142,6 +142,8 @@
                                    to non-AI players (100: Equal cost) */
   int warmth; /* threat of global warming */
   enum barbarian_type barbarian_type;
+
+  int love[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
 };
 
 /* Diplomatic states (how one player views another).
@@ -265,6 +267,7 @@
 
 const char *reputation_text(const int rep);
 const char *diplstate_text(const enum diplstate_type type);
+const char *love_text(const int love);
 
 const struct player_diplstate *pplayer_get_diplstate(const struct player
                                                     *pplayer,
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.313
diff -u -r1.313 plrhand.c
--- server/plrhand.c    13 Jul 2004 21:54:17 -0000      1.313
+++ server/plrhand.c    28 Jul 2004 20:40:47 -0000
@@ -1306,6 +1306,8 @@
 static void package_player_common(struct player *plr,
                                   struct packet_player_info *packet)
 {
+  int i;
+
   packet->playerno=plr->player_no;
   sz_strlcpy(packet->name, plr->name);
   packet->nation=plr->nation;
@@ -1316,6 +1318,9 @@
   packet->is_alive=plr->is_alive;
   packet->is_connected=plr->is_connected;
   packet->ai=plr->ai.control;
+  for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
+    packet->love[i] = plr->ai.love[i];
+  }
   packet->barbarian_type = plr->ai.barbarian_type;
   packet->reputation=plr->reputation;
 
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.172
diff -u -r1.172 savegame.c
--- server/savegame.c   26 Jul 2004 03:50:59 -0000      1.172
+++ server/savegame.c   28 Jul 2004 20:40:48 -0000
@@ -1196,7 +1196,7 @@
   plr->is_alive=secfile_lookup_bool(file, "player%d.is_alive", plrno);
   plr->ai.control = secfile_lookup_bool(file, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
-    ai->diplomacy.player_intel[i].love
+    plr->ai.love[i]
          = secfile_lookup_int_default(file, 1, "player%d.ai.love%d", plrno, i);
     ai->diplomacy.player_intel[i].spam 
          = secfile_lookup_int_default(file, 0, "player%d.ai.spam%d", plrno, i);
@@ -1870,7 +1870,7 @@
   secfile_insert_bool(file, plr->is_alive, "player%d.is_alive", plrno);
   secfile_insert_bool(file, plr->ai.control, "player%d.ai.control", plrno);
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
-    secfile_insert_int(file, ai->diplomacy.player_intel[i].love, 
+    secfile_insert_int(file, plr->ai.love[i],
                        "player%d.ai.love%d", plrno, i);
     secfile_insert_int(file, ai->diplomacy.player_intel[i].spam, 
                        "player%d.ai.spam%d", plrno, i);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9530) Show AI attitudes in player dialog, Per I. Mathisen <=