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

[Freeciv-Dev] (PR#18649) [Patch] "RoadNative" unit_class flag

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18649) [Patch] "RoadNative" unit_class flag
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Sun, 16 Jul 2006 16:59:38 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  Any tile with roads is considered native terrain for "RoadNative" units.
  Applies on top of #18623.


  - ML


diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2006-07-17 02:33:53.796875000 +0300
+++ freeciv/common/movement.c   2006-07-17 02:34:01.406250000 +0300
@@ -226,6 +226,12 @@
     /* Unknown is considered native terrain */
     return TRUE;
   }
+
+  if (unit_class_flag(punitclass, UCF_ROAD_NATIVE)
+      && contains_special(special, S_ROAD)) {
+    return TRUE;
+  }
+
   return BV_ISSET(pterrain->native_to, punitclass->id);
 }
 
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2006-07-17 02:29:07.375000000 +0300
+++ freeciv/common/unittype.c   2006-07-17 02:34:01.468750000 +0300
@@ -40,7 +40,8 @@
 */
 
 static const char *unit_class_flag_names[] = {
-  "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile"
+  "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile",
+  "RoadNative"
 };
 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   2006-07-17 02:29:07.437500000 +0300
+++ freeciv/common/unittype.h   2006-07-17 02:34:01.500000000 +0300
@@ -30,6 +30,7 @@
   UCF_DAMAGE_SLOWS,
   UCF_CAN_OCCUPY,
   UCF_MISSILE,
+  UCF_ROAD_NATIVE,
   UCF_LAST
 };
 
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2006-07-17 02:29:29.093750000 +0300
+++ freeciv/data/civ1/units.ruleset     2006-07-17 02:34:01.546875000 +0300
@@ -62,6 +62,7 @@
 ; "DamageSlows"  = Damages units are slowed down
 ; "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
 
 [unitclass_land]
 name          = _("Land")
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2006-07-17 02:29:31.312500000 +0300
+++ freeciv/data/civ2/units.ruleset     2006-07-17 02:34:01.625000000 +0300
@@ -62,6 +62,7 @@
 ; "DamageSlows"  = Damages units are slowed down
 ; "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
 
 [unitclass_missile]
 name          = _("Missile")
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-17 02:29:34.171875000 +0300
+++ freeciv/data/default/units.ruleset  2006-07-17 02:34:01.687500000 +0300
@@ -68,6 +68,7 @@
 ; "DamageSlows"  = Damages units are slowed down
 ; "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
 
 [unitclass_missile]
 name          = _("Missile")
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c    2006-07-17 02:32:11.109375000 +0300
+++ freeciv/server/ruleset.c    2006-07-17 02:39:24.015625000 +0300
@@ -1074,6 +1074,9 @@
         if (ival != F_LAST) {
           freelog(LOG_ERROR, "it's unit_type flag!");
         }
+      } else if (ival == UCF_ROAD_NATIVE && ut->move_type == SEA_MOVING) {
+        freelog(LOG_ERROR, "for unit_class \"%s\": cannot give flag \"%s\" to "
+                "sea moving unit (%s)", ut->name, sval, filename);
       } else {
         BV_SET(ut->flags, ival);
       }

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