Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#4089) Bug in pf
Home

[Freeciv-Dev] Re: (PR#4089) Bug in pf

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#4089) Bug in pf
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 28 Apr 2003 09:34:57 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 28 Apr 2003, Gregory Berkolaiko wrote:
> > The bug seems to be in pf. The pos.total_MC returned in aidiplomat.c is
> > hillariously low and wrong, giving us ridiculously high want for buying
> > diplomats.
>
> It works for me... Please supply a savegame.

Supplied. Apply the diff to see what the problem is. "ttd" means "time to
destination", and it is this number which is totally dead wrong.

  - Per

Attachment: q.sav.gz
Description: q.sav.gz

Index: ai/aidiplomat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidiplomat.c,v
retrieving revision 1.17
diff -u -r1.17 aidiplomat.c
--- ai/aidiplomat.c     18 Apr 2003 17:51:14 -0000      1.17
+++ ai/aidiplomat.c     28 Apr 2003 16:30:39 -0000
@@ -55,7 +55,7 @@
 
 #include "aidiplomat.h"
 
-#define LOG_DIPLOMAT LOG_DEBUG
+#define LOG_DIPLOMAT LOG_NORMAL
 
 static void find_city_to_diplomat(struct player *pplayer, struct unit *punit,
                                   struct city **ctarget, int *move_dist);
@@ -207,19 +207,20 @@
     want = military_amortize(pplayer, pcity, want, time_to_dest, 
                              ut->build_cost);
 
-    if (!player_has_embassy(pplayer, city_owner(acity))) {
+    if (!player_has_embassy(pplayer, city_owner(acity))
+        && want < 99) {
         freelog(LOG_DIPLOMAT, "A diplomat desired in %s to establish an "
                           "embassy with %s in %s", pcity->name,
                           city_owner(acity)->name, acity->name);
-        want = MAX(want, 99);
+        want = 99;
     }
     if (want > choice->want) {
-      freelog(LOG_DIPLOMAT, 
+      freelog(LOG_DIPLOMAT,
               "%s,%s: %s is desired with want %d (was %d) to spy "
-              "in %s (incite desire %d, tech theft desire %d)",
+              "in %s (incite want %d, tech theft want %d, ttd %d)",
               pplayer->name, pcity->name, ut->name, want, choice->want,
-              acity->name, gain_incite, gain_theft);
-      choice->want = want; 
+              acity->name, gain_incite, gain_theft, time_to_dest);
+      choice->want = want;
       choice->type = CT_NONMIL; /* so we don't build barracks for it */
       choice->choice = u;
       acity->ai.already_considered_for_diplomat = TRUE;

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