Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12823) invalid requirements
Home

[Freeciv-Dev] (PR#12823) invalid requirements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12823) invalid requirements
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Apr 2005 23:32:34 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12823 >

There is an invalid (typo) requirement in buildings.ruleset.  This patch
fixes it and improves the checks for requirement validity.

-jason

Index: common/requirements.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/requirements.c,v
retrieving revision 1.12
diff -u -r1.12 requirements.c
--- common/requirements.c       14 Apr 2005 04:49:13 -0000      1.12
+++ common/requirements.c       18 Apr 2005 06:29:27 -0000
@@ -261,6 +261,8 @@
 
   req.survives = survives;
 
+  /* These checks match what combinations are supported inside
+   * is_req_active(). */
   switch (req.source.type) {
   case REQ_SPECIAL:
   case REQ_TERRAIN:
@@ -268,10 +270,16 @@
               && req.range != REQ_RANGE_ADJACENT);
     break;
   case REQ_TECH:
+    invalid = (req.range < REQ_RANGE_PLAYER);
+    break;
   case REQ_GOV:
+    invalid = (req.range != REQ_RANGE_PLAYER);
+    break;
   case REQ_BUILDING:
-    /* FIXME: sanity checking */
-    invalid = FALSE;
+    invalid = ((req.range == REQ_RANGE_WORLD
+               && !is_great_wonder(req.source.value.building))
+              || (req.range > REQ_RANGE_CITY
+                  && !is_wonder(req.source.value.building)));
     break;
   case REQ_NATION:
     invalid = (req.range != REQ_RANGE_PLAYER
Index: data/default/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/buildings.ruleset,v
retrieving revision 1.69
diff -u -r1.69 buildings.ruleset
--- data/default/buildings.ruleset      14 Apr 2005 04:49:15 -0000      1.69
+++ data/default/buildings.ruleset      18 Apr 2005 06:29:27 -0000
@@ -1001,7 +1001,7 @@
 reqs   =
     { "type", "name", "range"
       "Tech", "University", "Player"
-      "Building", "Library", "Player"
+      "Building", "Library", "City"
     }
 graphic        = "b.university"
 graphic_alt    = "-"

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12823) invalid requirements, Jason Short <=