Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] [bug cvs] I want my city walls back ! (improvement_redunda
Home

[Freeciv-Dev] [bug cvs] I want my city walls back ! (improvement_redunda

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] [bug cvs] I want my city walls back ! (improvement_redundant buggy) (PR#906)
From: Francois Taiani <francois.taiani@xxxxxxxx>
Date: Fri, 24 Aug 2001 15:07:55 -0700 (PDT)

Hi,

with the CVS snapshot from August 23 (freeciv-cvs-Aug-23.tar.bz2), you
can't build city walls if you already possess the great wall *even*
after the great wall was obsoleted by Mettalurgy (this is new!). The
problem did not exist with freeciv-1.12.0.

It seems that improvement.c:fill_ranges_improv_lists(..), which is used
in improvement_redundant(..) (same file) simply copies the different
list pointers of improvements, without taking into account that some
improvements are not active any more.

I've put a save game that reproduces the pb on
ftp://ftp.freeciv.org/freeciv/incoming/bug-city-wall-snapshot-23-Aug.sav.gz
(some AI players, + one human -- Cyrus --). Try building a wall in
Rhagae for instance: you can't.

To better observe the cause of the pb, you can add the following diff to
./common/improvement.c, which simply add a freelog to
fill_ranges_improv_lists. (Don't forget to start civclient with -d 3
then.)

I'll try to propose a patch if I come to it, but any further help is
wellcomed. (As usual :)

Francois

------------------

ftaiani@deepo:~/downloads/freeciv-cvs-Aug-23-underwork/common$ diff -u
../../freeciv-cvs-Aug-23/common/improvement.c improvement.c 
--- ../../freeciv-cvs-Aug-23/common/improvement.c       Thu Aug 23 14:01:29
2001+++ improvement.c   Fri Aug 24 23:26:21 2001
@@ -14,6 +14,7 @@
 #include <string.h>
 
 #include "game.h"
+#include "log.h"
 #include "map.h"
 #include "support.h"
 #include "tech.h"
@@ -315,8 +316,17 @@
      its presence in any of the lists (we check only for its presence,
and
      assume that it has the "equiv" effect even if it itself is
redundant) */
   for (ept=improvement_types[id].equiv_repl;ept && *ept!=B_LAST;ept++)
{
+
+    /* EFR means "Effect Range" (of the equipment), for instance:
+       EFR_BUILDING, EFR_CITY, EFR_ISLAND, ... etc. */
+
     for (i=0;i<EFR_LAST;i++) {
-      if (equiv_list[i] && equiv_list[i][*ept] != I_NONE) return 1;
+      if (equiv_list[i] && equiv_list[i][*ept] != I_NONE) 
+       {
+         freelog(LOG_VERBOSE,"%s is redundant with %s.", 
+             improvement_types[id].name, improvement_types[*ept].name) ;
+         return 1;
+       }
     }
   }



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