Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] (PR#18333) [Patch] CanOccupy unit_class flag
Home

[Freeciv-Dev] (PR#18333) [Patch] CanOccupy unit_class flag

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18333) [Patch] CanOccupy unit_class flag
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Wed, 5 Jul 2006 13:52:17 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  This adds "CanOccupy" unit_class flag. Military units of this class 
can occupy enemy cities.
  Only default ruleset is changed for this first version. I also still 
need to check AI code for building occupying units.

  Applies on top of #18325


  - ML

diff -Nurd -X.diff_ignore freeciv/common/unit.h freeciv/common/unit.h
--- freeciv/common/unit.h       2006-07-05 19:55:40.348680100 +0300
+++ freeciv/common/unit.h       2006-07-05 23:09:48.562556900 +0300
@@ -255,7 +255,7 @@
 bool is_field_unit(const struct unit *punit);              /* ships+aero */
 bool is_hiding_unit(const struct unit *punit);
 #define COULD_OCCUPY(punit) \
-  ((is_ground_unit(punit) || is_heli_unit(punit)) && is_military_unit(punit))
+  (unit_class_flag(punit->type->class, UCF_CAN_OCCUPY) && 
is_military_unit(punit))
 bool can_unit_add_to_city (const struct unit *punit);
 bool can_unit_build_city (const struct unit *punit);
 bool can_unit_add_or_build_city (const struct unit *punit);
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2006-07-05 22:50:19.433853700 +0300
+++ freeciv/common/unittype.c   2006-07-05 22:52:03.462440500 +0300
@@ -40,7 +40,7 @@
 */
 
 static const char *unit_class_flag_names[] = {
-  "TerrainSpeed", "DamageSlows"
+  "TerrainSpeed", "DamageSlows", "CanOccupy"
 };
 static const char *flag_names[] = {
   "TradeRoute" ,"HelpWonder", "Missile", "IgZOC", "NonMil", "IgTer", 
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h   2006-07-05 22:50:19.465102900 +0300
+++ freeciv/common/unittype.h   2006-07-05 22:51:36.838122100 +0300
@@ -28,6 +28,7 @@
 enum unit_class_flag_id {
   UCF_TERRAIN_SPEED = 0,
   UCF_DAMAGE_SLOWS,
+  UCF_CAN_OCCUPY,
   UCF_LAST
 };
 
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-05 22:50:25.043085100 +0300
+++ freeciv/data/default/units.ruleset  2006-07-05 22:57:25.813563100 +0300
@@ -53,6 +53,7 @@
 ; ** Unit class Flags **
 ; "TerrainSpeed" = Units use terrain spesific speed
 ; "DamageSlows"  = Damages units are slowed down
+; "CanOccupy"    = Military units of this class can occupy enemy cities
 
 [unitclass_missile]
 name          = "Missile"
@@ -64,7 +65,7 @@
 name          = "Land"
 move_type     = "Land"
 hp_loss_pct   = 0
-flags         = "TerrainSpeed", "DamageSlows"
+flags         = "TerrainSpeed", "DamageSlows", "CanOccupy"
 
 [unitclass_sea]
 name          = "Sea"
@@ -76,7 +77,7 @@
 name          = "Helicopter"
 move_type     = "Heli"
 hp_loss_pct   = 10
-flags         = ""
+flags         = "CanOccupy"
 
 [unitclass_air]
 name          = "Air"

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#18333) [Patch] CanOccupy unit_class flag, Marko Lindqvist <=