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

 New unit class flag "ZOC" to mark classes that are subject to ZOC
rules. Previously this was hardcoded to LAND_MOVING. Unit type flag
"IgZOC" may override this.
 Now amphibious units too can be subject to ZOC rules.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/unit.c freeciv/common/unit.c
--- freeciv/common/unit.c	2007-01-25 17:59:51.000000000 +0200
+++ freeciv/common/unit.c	2007-01-26 23:51:21.000000000 +0200
@@ -1165,11 +1165,11 @@
 }
 
 /**************************************************************************
-  Takes into account unit move_type as well as IGZOC
+  Takes into account unit class flag UCF_ZOC as well as IGZOC
 **************************************************************************/
 bool unit_type_really_ignores_zoc(const struct unit_type *punittype)
 {
-  return (!is_ground_unittype(punittype)
+  return (!unit_class_flag(get_unit_class(punittype), UCF_ZOC)
 	  || unit_type_flag(punittype, F_IGZOC));
 }
 
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c	2007-01-26 22:51:04.000000000 +0200
+++ freeciv/common/unittype.c	2007-01-26 23:41:44.000000000 +0200
@@ -42,7 +42,7 @@
 static const char *unit_class_flag_names[] = {
   "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile",
   "RoadNative", "BuildAnywhere", "Unreachable", "AlwaysSafe",
-  "CollectRansom"
+  "CollectRansom", "ZOC"
 };
 static const char *flag_names[] = {
   "TradeRoute" ,"HelpWonder", "IgZOC", "NonMil", "IgTer", 
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h	2007-01-26 22:51:04.000000000 +0200
+++ freeciv/common/unittype.h	2007-01-26 23:41:32.000000000 +0200
@@ -35,6 +35,7 @@
   UCF_UNREACHABLE,
   UCF_ALWAYS_SAFE,
   UCF_COLLECT_RANSOM,     /* Can collect ransom from barbarian leader */
+  UCF_ZOC,                /* Is subject to ZOC */
   UCF_LAST
 };
 
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset	2007-01-26 22:51:04.000000000 +0200
+++ freeciv/data/civ1/units.ruleset	2007-01-26 23:46:16.000000000 +0200
@@ -69,6 +69,8 @@
 ;                   city or airbase
 ; "AlwaysSafe"    = Unit is safe even on unsafe terrain
 ; "CollectRansom" = Unit can collect ransom when killing lone barbarian leader
+; "ZOC"           = Unit is subject to ZOC rules. Unit type flag "IgZOC" can
+;                   override this
 
 [unitclass_land]
 name          = _("Land")
@@ -76,7 +78,7 @@
 min_speed     = 1
 hp_loss_pct   = 0
 flags         = "TerrainSpeed", "DamageSlows", "CanOccupy", "BuildAnywhere",
-                "CollectRansom"
+                "CollectRansom", "ZOC"
 
 [unitclass_sea]
 name          = _("Sea")
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset	2007-01-26 22:51:04.000000000 +0200
+++ freeciv/data/civ2/units.ruleset	2007-01-26 23:46:07.000000000 +0200
@@ -69,6 +69,8 @@
 ;                   city or airbase
 ; "AlwaysSafe"    = Unit is safe even on unsafe terrain
 ; "CollectRansom" = Unit can collect ransom when killing lone barbarian leader
+; "ZOC"           = Unit is subject to ZOC rules. Unit type flag "IgZOC" can
+;                   override this
 
 [unitclass_missile]
 name          = _("Missile")
@@ -83,7 +85,7 @@
 min_speed     = 1
 hp_loss_pct   = 0
 flags         = "TerrainSpeed", "DamageSlows", "CanOccupy", "BuildAnywhere",
-                "CollectRansom"
+                "CollectRansom", "ZOC"
 
 [unitclass_sea]
 name          = _("Sea")
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset	2007-01-26 22:51:04.000000000 +0200
+++ freeciv/data/default/units.ruleset	2007-01-26 23:45:39.000000000 +0200
@@ -75,6 +75,8 @@
 ;                   city or airbase
 ; "AlwaysSafe"    = Unit is safe even on unsafe terrain
 ; "CollectRansom" = Unit can collect ransom when killing lone barbarian leader
+; "ZOC"           = Unit is subject to ZOC rules. Unit type flag "IgZOC" can
+;                   override this
 
 [unitclass_missile]
 name          = _("Missile")
@@ -89,7 +91,7 @@
 min_speed     = 1
 hp_loss_pct   = 0
 flags         = "TerrainSpeed", "DamageSlows", "CanOccupy", "BuildAnywhere",
-                "CollectRansom"
+                "CollectRansom", "ZOC"
 
 [unitclass_sea]
 name          = _("Sea")
@@ -160,7 +162,7 @@
 ;
 ; "HelpWonder"	= can help build wonders
 ; "TradeRoute"	= can establish trade routes
-; "IgZOC"	= (land only) ignore Zones of Control (ZOC)
+; "IgZOC"	= ignore Zones of Control (ZOC) even if unit class has "ZOC" flag
 ; "NonMil"	= a non-military unit, does not cause unhappiness
 ; "IgTer"	= ignore terrain/road/rail, treat every tile as 1/3 move cost
 ; "OneAttack"	= can only make a single attack, regardless of movement points
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to