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

On 3/3/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  Remove hardcoded unit type flag requirements for building base.
> Instead ruleset defined "UnitFlag" requirements are used.

 - Flag rename part removed from this patch.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c	2007-03-03 18:28:05.000000000 +0200
+++ freeciv/client/helpdata.c	2007-03-06 02:16:59.000000000 +0200
@@ -891,9 +891,6 @@
   if (unit_type_flag(utype, F_TRANSFORM)) {
     sprintf(buf + strlen(buf), _("* Can transform tiles.\n"));
   }
-  if (unit_type_flag(utype, F_AIRBASE)) {
-    sprintf(buf + strlen(buf), _("* Can build airbases.\n"));
-  }
   if (is_ground_unittype(utype) && !unit_type_flag(utype, F_SETTLERS)) {
     sprintf(buf + strlen(buf),
 	    _("* May fortify, granting a 50%% defensive bonus.\n"));
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c	2007-03-05 00:51:27.000000000 +0200
+++ freeciv/common/base.c	2007-03-06 02:16:59.000000000 +0200
@@ -52,12 +52,6 @@
 bool can_build_base(const struct unit *punit, const struct base_type *pbase,
                     const struct tile *ptile)
 {
-  if ((pbase->id == BASE_FORTRESS && !unit_flag(punit, F_SETTLERS)) ||
-      (pbase->id == BASE_AIRBASE && !unit_flag(punit, F_AIRBASE))) {
-    /* This unit cannot build this kind of base */
-    return FALSE;
-  }
-
   if (tile_get_city(ptile)) {
     /* Bases cannot be built inside cities */
     return FALSE;
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h	2007-03-01 01:49:07.000000000 +0200
+++ freeciv/common/unittype.h	2007-03-06 02:18:13.000000000 +0200
@@ -80,7 +80,7 @@
   F_SPY,              /* Enhanced spy abilities */
   F_TRANSFORM,        /* Can transform terrain types (Engineers) */
   F_PARATROOPERS,
-  F_AIRBASE,          /* Can build Airbases */
+  F_AIRBASE,          /* No hardcoded behavior, rulesets use for UnitFlag requirement */
   F_CITIES,           /* Can build cities */
   F_NO_LAND_ATTACK,   /* Cannot attack vs land squares (Submarine) */
   F_ADD_TO_CITY,      /* unit can add to city population */
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-03-04 22:55:01.000000000 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-03-06 02:16:59.000000000 +0200
@@ -617,6 +617,7 @@
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
+      "UnitFlag", "Settlers", "Local"
     }
 flags       = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
               "NoStackDeath", "DiplomatDefense"
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-03-04 22:55:02.000000000 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-03-06 02:19:07.000000000 +0200
@@ -709,6 +709,7 @@
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
+      "UnitFlag", "Settlers", "Local"
     }
 flags       = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
               "NoStackDeath", "DiplomatDefense"
@@ -719,6 +720,7 @@
     { "type", "name", "range"
       "Tech", "Radio", "Player"
       "TerrainClass", "Land", "Local"
+      "UnitFlag", "Airbase", "Local"
     }
 flags       = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
               "AttackUnreachable", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-03-04 22:55:02.000000000 +0200
+++ freeciv/data/default/terrain.ruleset	2007-03-06 02:18:54.000000000 +0200
@@ -776,6 +776,7 @@
     { "type", "name", "range"
       "Tech", "Construction", "Player"
       "TerrainClass", "Land", "Local"
+      "UnitFlag", "Settlers", "Local"
     }
 flags       = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
               "NoStackDeath", "DiplomatDefense"
@@ -786,6 +787,7 @@
     { "type", "name", "range"
       "Tech", "Radio", "Player"
       "TerrainClass", "Land", "Local"
+      "UnitFlag", "Airbase", "Local"
     }
 flags       = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
               "AttackUnreachable", "ParadropFrom"
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to