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

 Remove hardcoded unit type flag requirements for building base.
Instead ruleset defined "UnitFlag" requirements are used. As flag
"Airbase" no longer has any hardcoded behavior, it is renamed as
"User1".


  - 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-03 20:20: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-02 15:10:46.000000000 +0200
+++ freeciv/common/base.c	2007-03-03 20:17:38.000000000 +0200
@@ -51,12 +51,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.c freeciv/common/unittype.c
--- freeciv/common/unittype.c	2007-03-01 01:49:07.000000000 +0200
+++ freeciv/common/unittype.c	2007-03-03 20:19:37.000000000 +0200
@@ -49,7 +49,7 @@
   "OneAttack", "Pikemen", "Horse", "IgWall", "FieldUnit", 
   "AEGIS", "AttackAny", "Marines", "Partial_Invis", "Settlers", "Diplomat",
   "Trireme", "Nuclear", "Spy", "Transform", "Paratroopers",
-  "Airbase", "Cities", "No_Land_Attack",
+  "User1", "Cities", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
   "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender",
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-03 20:19:21.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_USER_1,           /* No hardcoded behavior, rulesets may 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-03 20:25:22.000000000 +0200
+++ freeciv/data/civ1/terrain.ruleset	2007-03-03 20:21:57.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-03 20:25:23.000000000 +0200
+++ freeciv/data/civ2/terrain.ruleset	2007-03-03 20:21:41.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", "User1", "Local"
     }
 flags       = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
               "AttackUnreachable", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset	2007-02-26 14:15:35.000000000 +0200
+++ freeciv/data/civ2/units.ruleset	2007-03-03 20:25:03.000000000 +0200
@@ -177,7 +177,7 @@
 uk_shield     = 1
 uk_food       = 1
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Airbase", "AddToCity", "Cities", "NoVeteran"
+flags         = "Settlers", "NonMil", "User1", "AddToCity", "Cities", "NoVeteran"
 roles         = "Settlers", "Cities"
 helptext      = _("\
 Settlers are one of the key units in the game.  They can be used to\
@@ -221,7 +221,7 @@
 uk_shield     = 1
 uk_food       = 1
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Transform", "Airbase", "AddToCity", "Cities", "NoVeteran"
+flags         = "Settlers", "NonMil", "Transform", "User1", "AddToCity", "Cities", "NoVeteran"
 roles         = "Settlers", "Cities"
 helptext      = _("\
 Engineers are similar to Settlers, but they work twice as fast and\
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset	2007-03-03 20:25:23.000000000 +0200
+++ freeciv/data/default/terrain.ruleset	2007-03-03 20:16:44.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", "User1", "Local"
     }
 flags       = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
               "AttackUnreachable", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset	2007-03-01 01:49:06.000000000 +0200
+++ freeciv/data/default/units.ruleset	2007-03-03 20:24:39.000000000 +0200
@@ -177,7 +177,6 @@
 ; "Nuclear"	= nuke!
 ; "Transform"	= can transform terrain
 ; "Paratroopers"= (land only) can paradrop
-; "Airbase"	= (land only) can produce airbases
 ; "Cities"	= can disband to produce a city
 ; "No_Land_Attack" = (sea only) cannot attack targets on land
 ; "AddToCity"	= can disband to add a single point of population to a city
@@ -216,6 +215,8 @@
 ; "AirUnit"     = very bad at attacking "AEGIS" units
 ; "Fighter"     = good attacker against "Helicopter" units
 ; "BarbarianOnly" = only barbarians can build this unit
+; "User1"       = no hardcoded effects, but rulesets may use as "UnitFlag" requirement
+;                 default ruleset uses this flag to mark units able to build airbases
 ;
 ; Following flag strings require extra fields:
 ;  "Paratroopers"
@@ -326,7 +327,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Airbase", "NoVeteran"
+flags         = "Settlers", "NonMil", "User1", "NoVeteran"
 roles         = "Settlers"
 helptext      = _("\
 Workers are one of the key units in the game.  They can be used to\
@@ -367,7 +368,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Transform", "Airbase", "NoVeteran"
+flags         = "Settlers", "NonMil", "Transform", "User1", "NoVeteran"
 roles         = "Settlers"
 helptext      = _("\
 Engineers are similar to Workers, but they work twice as fast and\
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to