Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10006) bldg_req is ignored
Home

[Freeciv-Dev] (PR#10006) bldg_req is ignored

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10006) bldg_req is ignored
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Sep 2004 17:03:21 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Fri Sep 10 04:32:08 2004]:
> 
> University has as its bldg_req
> 
> bldg_req      = "Library"
> 
> but I can build a university without first possessing a library.
> 
> This is under the effects patch.  I don't know if it applies to the 
> current code.

The problem is simple.  bldg_req is just never checked.  This may have
been introduced by the effects patch; I don't know.

jason

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.244
diff -u -r1.244 city.c
--- common/city.c       13 Sep 2004 15:54:51 -0000      1.244
+++ common/city.c       13 Sep 2004 23:56:03 -0000
@@ -356,6 +356,8 @@
 **************************************************************************/
 bool can_build_improvement_direct(const struct city *pcity, Impr_Type_id id)
 {
+  const struct impr_type *building = get_improvement_type(id);
+
   if (!can_player_build_improvement_direct(city_owner(pcity), id)) {
     return FALSE;
   }
@@ -368,6 +370,11 @@
     return FALSE;
   }
 
+  if (building->bldg_req != B_LAST
+      && !city_got_building(pcity, building->bldg_req)) {
+    return FALSE;
+  }
+
   return !improvement_redundant(city_owner(pcity),pcity, id, TRUE);
 }
 

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