Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13341) [Patch] Non-land paratroopers
Home

[Freeciv-Dev] (PR#13341) [Patch] Non-land paratroopers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13341) [Patch] Non-land paratroopers
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sun, 26 Jun 2005 05:20:34 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  Split and rewritten from #12559.
  Untested - savegame with paratroopers wanted.


  - ML


diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c   2005-06-26 13:58:31.640625000 +0300
+++ freeciv/common/movement.c   2005-06-26 15:07:21.703125000 +0300
@@ -210,7 +210,7 @@
     return TRUE;
   }
 
-  return is_native_terrain(punit, ptile);
+  return is_native_terrain(punit, ptile->terrain);
 }
 
 /****************************************************************************
@@ -218,13 +218,13 @@
   even on native terrain. All terrains are native to air units.
 ****************************************************************************/
 bool is_native_terrain(const struct unit *punit,
-                       const struct tile *ptile)
+                       Terrain_type_id terrain)
 {
   switch (unit_types[punit->type].move_type) {
   case LAND_MOVING:
-    return !is_ocean(ptile->terrain);
+    return !is_ocean(terrain);
   case SEA_MOVING:
-    return is_ocean(ptile->terrain);
+    return is_ocean(terrain);
   default:
     return TRUE;
   }
diff -Nurd -X.diff_ignore freeciv/common/movement.h freeciv/common/movement.h
--- freeciv/common/movement.h   2005-06-26 13:58:31.640625000 +0300
+++ freeciv/common/movement.h   2005-06-26 15:07:29.000000000 +0300
@@ -33,7 +33,7 @@
 enum unit_move_type unit_move_type_from_str(const char *s);
 
 bool is_native_terrain(const struct unit *punit,
-                       const struct tile *ptile);
+                       Terrain_type_id terrain);
 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);
diff -Nurd -X.diff_ignore freeciv/doc/README.rulesets 
freeciv/doc/README.rulesets
--- freeciv/doc/README.rulesets 2005-06-26 13:58:49.218750000 +0300
+++ freeciv/doc/README.rulesets 2005-06-26 14:59:15.453125000 +0300
@@ -144,7 +144,6 @@
     - These flags and roles work only for move_type "Land" units:
       - "Diplomat"
       - "Partisan"
-      - "Paratroopers"
       - "Settler"
       - "IgTer"
       - "Marines"
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c  2005-06-26 13:59:00.234375000 +0300
+++ freeciv/server/unittools.c  2005-06-26 15:18:56.031250000 +0300
@@ -2202,11 +2202,12 @@
     return FALSE;
   }
 
-  if (is_ocean(map_get_player_tile(ptile, pplayer)->terrain)
-      && is_ground_unit(punit)) {
+  /* Safe terrain according to player map? */
+  if (!is_native_terrain(punit, map_get_player_tile(ptile, pplayer)->terrain)) 
{
     notify_player_ex(pplayer, ptile, E_NOEVENT,
-                     _("This unit cannot paradrop into ocean."));
-    return FALSE;    
+                     _("This unit cannot paradrop into %s."),
+                       get_terrain_name(map_get_player_tile(ptile, 
pplayer)->terrain));
+    return FALSE;
   }
 
   if (map_is_known_and_seen(ptile, pplayer)
@@ -2230,16 +2231,16 @@
     }
   }
 
-  if (is_ocean(tile_get_terrain(ptile))
-      && is_ground_unit(punit)) {
+  /* Safe terrain, really? Not transformed since player last saw it. */
+  if (!can_unit_exist_at_tile(punit, ptile)) {
     int srange = unit_type(punit)->vision_range;
 
     show_area(pplayer, ptile, srange);
 
     notify_player_ex(pplayer, ptile, E_UNIT_LOST,
-                     _("Your %s paradropped into the ocean "
+                     _("Your %s paradropped into the %s "
                        "and was lost."),
-                     unit_type(punit)->name);
+                     unit_type(punit)->name, get_terrain_name(ptile->terrain));
     server_remove_unit(punit);
     return TRUE;
   }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13341) [Patch] Non-land paratroopers, Marko Lindqvist <=