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

 This patch adds unit class flag "RiverNative" that works identically
to "RoadNative", but for river tiles instead of road tiles. These
units consider any tile with river native terrain.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2008-06-24 01:37:50.000000000 +0300
+++ freeciv/common/movement.c   2008-07-22 21:58:00.000000000 +0300
@@ -239,6 +239,10 @@
       && contains_special(special, S_ROAD)) {
     return TRUE;
   }
+  if (uclass_has_flag(punitclass, UCF_RIVER_NATIVE)
+      && contains_special(special, S_RIVER)) {
+    return TRUE;
+  }
 
   return BV_ISSET(pterrain->native_to, uclass_index(punitclass));
 }
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2007-09-14 14:51:37.000000000 +0300
+++ freeciv/common/unittype.c   2008-07-22 21:55:11.000000000 +0300
@@ -41,7 +41,7 @@
 
 static const char *unit_class_flag_names[] = {
   "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile",
-  "RoadNative", "BuildAnywhere", "Unreachable",
+  "RoadNative", "RiverNative", "BuildAnywhere", "Unreachable",
   "CollectRansom", "ZOC", "CanFortify"
 };
 static const char *flag_names[] = {
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h   2007-09-14 14:51:37.000000000 +0300
+++ freeciv/common/unittype.h   2008-07-22 21:56:02.000000000 +0300
@@ -30,7 +30,8 @@
   UCF_DAMAGE_SLOWS,
   UCF_CAN_OCCUPY,         /* Can occupy enemy cities */
   UCF_MISSILE,
-  UCF_ROAD_NATIVE,
+  UCF_ROAD_NATIVE,        /* Considers any road tile native terrain */
+  UCF_RIVER_NATIVE,       /* Considers any river tile native terrain */
   UCF_BUILD_ANYWHERE,
   UCF_UNREACHABLE,
   UCF_COLLECT_RANSOM,     /* Can collect ransom from barbarian leader */
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2008-05-07 17:44:45.000000000 +0300
+++ freeciv/data/civ1/units.ruleset     2008-07-22 21:57:02.000000000 +0300
@@ -62,6 +62,7 @@
 ; "CanOccupy"     = Military units of this class can occupy enemy cities
 ; "Missile"       = Unit is destroyed when it attacks
 ; "RoadNative"    = Road tiles are always considered native terrain
+; "RiverNative"   = River tiles are always considered native terrain
 ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
 ; "Unreachable"   = Unit can be attacked only by units with "AttackAny" flag 
or on
 ;                   city or airbase
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2008-05-07 17:44:46.000000000 +0300
+++ freeciv/data/civ2/units.ruleset     2008-07-22 21:56:54.000000000 +0300
@@ -62,6 +62,7 @@
 ; "CanOccupy"     = Military units of this class can occupy enemy cities
 ; "Missile"       = Unit is destroyed when it attacks
 ; "RoadNative"    = Road tiles are always considered native terrain
+; "RiverNative"   = River tiles are always considered native terrain
 ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
 ; "Unreachable"   = Unit can be attacked only by units with "AttackAny" flag 
or on
 ;                   city or airbase
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2008-06-26 21:53:51.000000000 +0300
+++ freeciv/data/default/units.ruleset  2008-07-22 22:20:30.000000000 +0300
@@ -68,6 +68,7 @@
 ; "CanOccupy"     = Military units of this class can occupy enemy cities
 ; "Missile"       = Unit is destroyed when it attacks
 ; "RoadNative"    = Road tiles are always considered native terrain
+; "RiverNative"   = River tiles are always considered native terrain
 ; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
 ; "Unreachable"   = Unit can be attacked only by units with "AttackAny" flag 
or on
 ;                   city or airbase
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c    2008-07-10 12:49:29.000000000 +0300
+++ freeciv/server/ruleset.c    2008-07-22 22:06:23.000000000 +0300
@@ -1117,7 +1117,8 @@
                   filename,
                   uclass_rule_name(ut));
         }
-      } else if (ival == UCF_ROAD_NATIVE && ut->move_type == SEA_MOVING) {
+      } else if (ut->move_type == SEA_MOVING
+                 && ( ival == UCF_ROAD_NATIVE || ival == UCF_RIVER_NATIVE)) {
         freelog(LOG_ERROR, "\"%s\" unit_class \"%s\": cannot give \"%s\" flag"
                 " to sea moving unit",
                 filename,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to