Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13335) [Patch] is_native_terrain()
Home

[Freeciv-Dev] (PR#13335) [Patch] is_native_terrain()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13335) [Patch] is_native_terrain()
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sat, 25 Jun 2005 13:06:24 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  This patch introduces function is_native_terrain(). It's like 
can_unit_exist_at_tile() except that city is not enough to satisfy it.


  - ML


diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2005-06-25 21:55:36.093750000 +0300
+++ freeciv/common/movement.c   2005-06-25 22:58:06.546875000 +0300
@@ -210,20 +210,26 @@
     return TRUE;
   }
 
+  return is_native_terrain(punit, ptile);
+}
+
+/****************************************************************************
+  This terrain is native to unit. Units that require fuel dont survive
+  even on native terrain. All terrains are native to air units.
+****************************************************************************/
+bool is_native_terrain(const struct unit *punit,
+                       const struct tile *ptile)
+{
   switch (unit_types[punit->type].move_type) {
   case LAND_MOVING:
     return !is_ocean(ptile->terrain);
   case SEA_MOVING:
     return is_ocean(ptile->terrain);
-  case AIR_MOVING:
-  case HELI_MOVING:
+  default:
     return TRUE;
   }
-  die("Invalid move type");
-  return FALSE;
 }
 
-
 /****************************************************************************
   Return TRUE iff the unit can "survive" at this location.  This means it can
   not only be physically present at the tile but will be able to survive
diff -Nurd -X.diff_ignore freeciv/common/movement.h freeciv/common/movement.h
--- freeciv/common/movement.h   2005-06-25 21:55:36.093750000 +0300
+++ freeciv/common/movement.h   2005-06-25 22:58:34.000000000 +0300
@@ -32,6 +32,8 @@
 
 enum unit_move_type unit_move_type_from_str(const char *s);
 
+bool is_native_terrain(const struct unit *punit,
+                       const struct tile *ptile);
 bool can_unit_exist_at_tile(const struct unit *punit, const struct tile 
*ptile);
 bool can_unit_survive_at_tile(const struct unit *punit,
                              const struct tile *ptile);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13335) [Patch] is_native_terrain(), Marko Lindqvist <=