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

[Freeciv-Dev] Re: (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] Re: (PR#18333) [Patch] CanOccupy unit_class flag
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 6 Jul 2006 06:31:45 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:
> 
>   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

  - AI support
  - civ1 & civ2 rulesets updated


  - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c    2006-07-06 15:09:54.118250000 +0300
+++ freeciv/ai/advmilitary.c    2006-07-06 15:48:56.343750000 +0300
@@ -892,7 +892,7 @@
       if (move_type != LAND_MOVING && vuln == 0) {
         desire = 0;
         
-      } else if ((move_type == LAND_MOVING || move_type == HELI_MOVING) && 
acity
+      } else if (unit_class_flag(punittype->class, UCF_CAN_OCCUPY) && acity
                  && TEST_BIT(acity->ai.invasion, INVASION_ATTACK)
                  && !TEST_BIT(acity->ai.invasion, INVASION_OCCUPY)) {
         desire = bcost * SHIELD_WEIGHTING;
diff -Nurd -X.diff_ignore freeciv/common/unit.h freeciv/common/unit.h
--- freeciv/common/unit.h       2006-07-06 15:14:04.375000000 +0300
+++ freeciv/common/unit.h       2006-07-06 15:45:55.203125000 +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-06 15:45:40.265625000 +0300
+++ freeciv/common/unittype.c   2006-07-06 15:45:55.218750000 +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-06 15:45:40.312500000 +0300
+++ freeciv/common/unittype.h   2006-07-06 15:45:55.250000000 +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/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2006-07-06 15:15:00.562500000 +0300
+++ freeciv/data/civ1/units.ruleset     2006-07-06 15:53:25.546875000 +0300
@@ -59,12 +59,13 @@
 ;
 ; "TerrainSpeed" = Units use terrain spesific speed
 ; "DamageSlows"  = Damages units are slowed down
+; "CanOccupy"    = Military units of this class can occupy enemy cities
 
 [unitclass_land]
 name          = "Land"
 move_type     = "Land"
 hp_loss_pct   = 0
-flags         = "TerrainSpeed", "DamageSlows"
+flags         = "TerrainSpeed", "DamageSlows", "CanOccupy"
 
 [unitclass_sea]
 name          = "Sea"
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2006-07-06 15:15:06.484375000 +0300
+++ freeciv/data/civ2/units.ruleset     2006-07-06 15:52:29.531250000 +0300
@@ -59,6 +59,7 @@
 ;
 ; "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"
@@ -70,7 +71,7 @@
 name          = "Land"
 move_type     = "Land"
 hp_loss_pct   = 0
-flags         = "TerrainSpeed", "DamageSlows"
+flags         = "TerrainSpeed", "DamageSlows", "CanOccupy"
 
 [unitclass_sea]
 name          = "Sea"
@@ -82,7 +83,7 @@
 name          = "Helicopter"
 move_type     = "Heli"
 hp_loss_pct   = 10
-flags         = ""
+flags         = "CanOccupy"
 
 [unitclass_air]
 name          = "Air"
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-06 15:15:13.156250000 +0300
+++ freeciv/data/default/units.ruleset  2006-07-06 15:45:55.296875000 +0300
@@ -65,6 +65,7 @@
 ;
 ; "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"
@@ -76,7 +77,7 @@
 name          = "Land"
 move_type     = "Land"
 hp_loss_pct   = 0
-flags         = "TerrainSpeed", "DamageSlows"
+flags         = "TerrainSpeed", "DamageSlows", "CanOccupy"
 
 [unitclass_sea]
 name          = "Sea"
@@ -88,7 +89,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]