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

This patch removes all unsafe terrain, both the unsafe terrain flag
(currently unused, used to set for glaciers, but was removed since it
was annoying) and unsafe ocean for triremes. Instead, triremes simply
cannot travel into an ocean square with no coastline.

There is an issue, though, which is that the server checks its global
knowledge of coastlines to determine whether a trireme can go
somewhere. So the user can try to move the trireme toward unexplored
tiles and whether and if the unexplored tiles are coastline, the move
will succeed and explore them, but if they are ocean, the move will
fail. This might seem wrong - the trireme's refusal to leave the
coastline should depend on the client knowledge, not the server
knowledge. This looks quite a bit harder to implement, though. On the
other hand, if we think about it in terms of deep vs shallow waters,
there most likely is shallow water whereever the trireme is allowed to
go - the client just cannot display it yet. So if this is just a step
on the way to implementing deep vs shallow ocean, perhaps it is ok as
it is.

  - Per

Index: server/generator/startpos.c
===================================================================
--- server/generator/startpos.c	(revision 12614)
+++ server/generator/startpos.c	(working copy)
@@ -223,10 +223,7 @@
     create_tmap(FALSE);
   }
 
-  /* Unsafe terrains separate continents, otherwise small areas of green
-   * near the poles could be populated by a civilization if that pole
-   * was part of a larger continent. */
-  assign_continent_numbers(TRUE);
+  assign_continent_numbers();
 
   /* If the default is given, just use MT_VARIABLE. */
   if (mode == MT_DEFAULT) {
Index: server/generator/mapgen.c
===================================================================
--- server/generator/mapgen.c	(revision 12614)
+++ server/generator/mapgen.c	(working copy)
@@ -390,7 +390,7 @@
 ****************************************************************************/
 static void make_polar_land(void)
 {
-  assign_continent_numbers(FALSE);
+  assign_continent_numbers();
   whole_map_iterate(ptile) {
     if ((tmap_is(ptile, TT_FROZEN ) &&
 	ok_for_separate_poles(ptile))
@@ -1256,7 +1256,7 @@
 
   }
 
-  assign_continent_numbers(FALSE);
+  assign_continent_numbers();
   game_map_init();
 
   print_mapgen_map();
Index: server/settlers.c
===================================================================
--- server/settlers.c	(revision 12614)
+++ server/settlers.c	(working copy)
@@ -805,8 +805,7 @@
     city_map_checked_iterate(pcity->tile, cx, cy, ptile) {
       bool consider = TRUE;
 
-      if (get_worker_city(pcity, cx, cy) == C_TILE_UNAVAILABLE
-	  || terrain_has_flag(pcity->tile->terrain, TER_UNSAFE)) {
+      if (get_worker_city(pcity, cx, cy) == C_TILE_UNAVAILABLE) {
 	/* Don't risk bothering with this tile. */
 	continue;
       }
Index: server/maphand.c
===================================================================
--- server/maphand.c	(revision 12614)
+++ server/maphand.c	(working copy)
@@ -63,12 +63,8 @@
 
   is_land tells us whether we are assigning continent numbers or ocean 
   numbers.
-
-  if skip_unsafe is specified then "unsafe" terrains are skipped.  This
-  is useful for mapgen algorithms.
 **************************************************************************/
-static void assign_continent_flood(struct tile *ptile, bool is_land,
-				   int nr, bool skip_unsafe)
+static void assign_continent_flood(struct tile *ptile, bool is_land, int nr)
 {
   if (tile_get_continent(ptile) != 0) {
     return;
@@ -78,12 +74,6 @@
     return;
   }
 
-  if (skip_unsafe && terrain_has_flag(tile_get_terrain(ptile), TER_UNSAFE)) {
-    /* FIXME: This should check a specialized flag, not the TER_UNSAFE
-     * flag which may not even be present. */
-    return;
-  }
-
   if (!XOR(is_land, is_ocean(tile_get_terrain(ptile)))) {
     return;
   }
@@ -98,7 +88,7 @@
   }
 
   adjc_iterate(ptile, tile1) {
-    assign_continent_flood(tile1, is_land, nr, skip_unsafe);
+    assign_continent_flood(tile1, is_land, nr);
   } adjc_iterate_end;
 }
 
@@ -136,12 +126,8 @@
 
   Continents have numbers 1 to map.num_continents _inclusive_.
   Oceans have (negative) numbers -1 to -map.num_oceans _inclusive_.
-
-  If skip_unsafe is specified then unsafe terrains are not used to
-  connect continents.  This is useful for generator code so that polar
-  regions don't connect landmasses.
 **************************************************************************/
-void assign_continent_numbers(bool skip_unsafe)
+void assign_continent_numbers(void)
 {
   
   /* Initialize */
@@ -165,22 +151,18 @@
       continue; /* Can't assign this. */
     }
 
-    if (!skip_unsafe || !terrain_has_flag(pterrain, TER_UNSAFE)) {
-      if (!is_ocean(pterrain)) {
-	map.num_continents++;
-	continent_sizes
-	  = fc_realloc(continent_sizes,
+    if (!is_ocean(pterrain)) {
+      map.num_continents++;
+      continent_sizes = fc_realloc(continent_sizes,
 		       (map.num_continents + 1) * sizeof(*continent_sizes));
-	continent_sizes[map.num_continents] = 0;
-	assign_continent_flood(ptile, TRUE, map.num_continents, skip_unsafe);
-      } else {
-	map.num_oceans++;
-	ocean_sizes
-	  = fc_realloc(ocean_sizes,
+      continent_sizes[map.num_continents] = 0;
+      assign_continent_flood(ptile, TRUE, map.num_continents);
+    } else {
+      map.num_oceans++;
+      ocean_sizes = fc_realloc(ocean_sizes,
 		       (map.num_oceans + 1) * sizeof(*ocean_sizes));
-	ocean_sizes[map.num_oceans] = 0;
-	assign_continent_flood(ptile, FALSE, -map.num_oceans, skip_unsafe);
-      }
+      ocean_sizes[map.num_oceans] = 0;
+      assign_continent_flood(ptile, FALSE, -map.num_oceans);
     }
   } whole_map_iterate_end;
 
@@ -1420,7 +1402,7 @@
 
   if (ocean_toggled) {
     bounce_units_on_terrain_change(ptile);
-    assign_continent_numbers(FALSE);
+    assign_continent_numbers();
 
     /* New continent numbers for all tiles to all players */
     send_all_known_tiles(NULL);
Index: server/maphand.h
===================================================================
--- server/maphand.h	(revision 12614)
+++ server/maphand.h	(working copy)
@@ -50,7 +50,7 @@
   short last_updated;
 };
 
-void assign_continent_numbers(bool skip_unsafe);
+void assign_continent_numbers(void);
 
 void global_warming(int effect);
 void nuclear_winter(int effect);
Index: server/unittools.c
===================================================================
--- server/unittools.c	(revision 12614)
+++ server/unittools.c	(working copy)
@@ -317,15 +317,13 @@
 
   3. Kill dead units.
 
-  4. Randomly kill units on unsafe terrain or unsafe-ocean.
+  4. Rescue airplanes by returning them to base automatically.
 
-  5. Rescue airplanes by returning them to base automatically.
+  5. Decrease fuel of planes in the air.
 
-  6. Decrease fuel of planes in the air.
+  6. Refuel planes that are in bases.
 
-  7. Refuel planes that are in bases.
-
-  8. Kill planes that are out of fuel.
+  7. Kill planes that are out of fuel.
 ****************************************************************************/
 void player_restore_units(struct player *pplayer)
 {
@@ -349,41 +347,7 @@
       continue; /* Continue iterating... */
     }
 
-    /* 4) Check for units on unsafe terrains. */
-    if (unit_flag(punit, F_TRIREME)) {
-      /* Triremes away from coast have a chance of death. */
-      /* Note if a trireme died on a TER_UNSAFE terrain, this would
-       * erronously give the high seas message.  This is impossible under
-       * the current rulesets. */
-      int loss_chance = unit_loss_pct(pplayer, punit->tile, punit);
-
-      if (myrand(100) < loss_chance) {
-        notify_player(pplayer, punit->tile, E_UNIT_LOST, 
-                         _("Your %s has been lost on the high seas."),
-                         unit_name(punit->type));
-        wipe_unit(punit);
-        continue; /* Continue iterating... */
-      } else if (loss_chance > 0) {
-        if (maybe_make_veteran(punit)) {
-	  notify_player(pplayer, punit->tile, E_UNIT_BECAME_VET,
-                           _("Your %s survived on the high seas "
-	                   "and became more experienced!"), 
-                           unit_name(punit->type));
-        }
-      }
-    } else if (!unit_class_flag(get_unit_class(unit_type(punit)), UCF_ALWAYS_SAFE)
-	       && (myrand(100) < unit_loss_pct(pplayer,
-					       punit->tile, punit))) {
-      /* Units without unit class flag UCF_ALWAYS_SAFE have a chance of
-       * dying if they are on TER_UNSAFE terrain. */
-      notify_player(pplayer, punit->tile, E_UNIT_LOST,
-		       _("Your %s has been lost on unsafe terrain."),
-		       unit_name(punit->type));
-      wipe_unit(punit);
-      continue;			/* Continue iterating... */
-    }
-
-    /* 5) Rescue planes if needed */
+    /* 4) Rescue planes if needed */
     if (is_air_unit(punit)) {
       /* Shall we emergency return home on the last vapors? */
 
@@ -464,10 +428,10 @@
         }
       }
 
-      /* 6) Update fuel */
+      /* 5) Update fuel */
       punit->fuel--;
 
-      /* 7) Automatically refuel air units in cities, airbases, and
+      /* 6) Automatically refuel air units in cities, airbases, and
        *    transporters (carriers). */
       if (is_unit_being_refueled(punit)) {
 	punit->fuel=unit_type(punit)->fuel;
@@ -475,7 +439,7 @@
     }
   } unit_list_iterate_safe_end;
 
-  /* 8) Check if there are air units without fuel */
+  /* 7) Check if there are air units without fuel */
   unit_list_iterate_safe(pplayer->units, punit) {
     if (is_air_unit(punit) && punit->fuel <= 0
         && unit_type(punit)->fuel > 0) {
Index: server/unithand.c
===================================================================
--- server/unithand.c	(revision 12614)
+++ server/unithand.c	(working copy)
@@ -951,6 +951,10 @@
     notify_player(unit_owner(punit), src_tile, E_BAD_COMMAND,
 		     _("%s can only move into your own zone of control."),
 		     unit_type(punit)->name);
+  } else if (reason == MR_TRIREME) {
+    notify_player(unit_owner(punit), src_tile, E_BAD_COMMAND,
+		     _("%s cannot move that far from the coast line."),
+		     unit_type(punit)->name);
   }
   return FALSE;
 }
Index: server/savegame.c
===================================================================
--- server/savegame.c	(revision 12614)
+++ server/savegame.c	(working copy)
@@ -616,7 +616,7 @@
 		secfile_lookup_str(file, "map.t%03d", line),
 		ptile->terrain = char2terrain(ch));
 
-  assign_continent_numbers(FALSE);
+  assign_continent_numbers();
 
   whole_map_iterate(ptile) {
     ptile->spec_sprite = secfile_lookup_str_default(file, NULL,
Index: data/default/terrain.ruleset
===================================================================
--- data/default/terrain.ruleset	(revision 12614)
+++ data/default/terrain.ruleset	(working copy)
@@ -154,8 +154,6 @@
 ;                        separately).
 ;   - UnsafeCoast      = This terrain does not provide a safe coast for
 ;                        F_TRIRIEME units.
-;   - Unsafe           = This terrain is unsafe for alll units that travel
-;                        on it.
 ;   - Oceanic          = This is an "ocean" terrain.  This has a big effect
 ;                        on gameplay.  Naval units can move on oceanic terrain,
 ;                        while land units cannot.  Oceanic tiles can be used
Index: common/unit.c
===================================================================
--- common/unit.c	(revision 12614)
+++ common/unit.c	(working copy)
@@ -1174,69 +1174,6 @@
 }
 
 /**************************************************************************
-  Calculate the chance of losing (as a percentage) if it were to spend a
-  turn at the given location.
-
-  Note this function isn't really useful for AI planning, since it needs
-  to know more.  The AI code uses base_trireme_loss_pct and
-  base_unsafe_terrain_loss_pct directly.
-**************************************************************************/
-int unit_loss_pct(const struct player *pplayer, const struct tile *ptile,
-		  const struct unit *punit)
-{
-  int loss_pct = 0;
-
-  /* Units are never lost if they're inside cities. */
-  if (tile_get_city(ptile)) {
-    return 0; 
-  }
-
-  /* Trireme units may be lost if they stray from coastline. */
-  if (unit_flag(punit, F_TRIREME)) {
-    if (!is_safe_ocean(ptile)) {
-      loss_pct = base_trireme_loss_pct(pplayer, punit);
-    }
-  }
-
-  /* All units may be lost on unsafe terrain.  (Actually units with
-   * class flag UCF_ALWAYS_SAFE are exempt; see base_unsafe_terrain_loss_pct.) */
-  if (terrain_has_flag(tile_get_terrain(ptile), TER_UNSAFE)) {
-    return loss_pct + base_unsafe_terrain_loss_pct(pplayer, punit);
-  }
-
-  return loss_pct;
-}
-
-/**************************************************************************
-  Triremes have a varying loss percentage based on tech and veterancy
-  level.
-**************************************************************************/
-int base_trireme_loss_pct(const struct player *pplayer,
-			  const struct unit *punit)
-{
-  if (get_unit_bonus(punit, EFT_NO_SINK_DEEP) > 0) {
-    return 0;
-  } else if (player_knows_techs_with_flag(pplayer, TF_REDUCE_TRIREME_LOSS2)) {
-    return game.trireme_loss_chance[punit->veteran] / 4;
-  } else if (player_knows_techs_with_flag(pplayer, TF_REDUCE_TRIREME_LOSS1)) {
-    return game.trireme_loss_chance[punit->veteran] / 2;
-  } else {
-    return game.trireme_loss_chance[punit->veteran];
-  }
-}
-
-/**************************************************************************
-  All units without unit class flag UCF_ALWAYS_SAFE have a flat 15% chance
-  of being lost.
-**************************************************************************/
-int base_unsafe_terrain_loss_pct(const struct player *pplayer,
-				 const struct unit *punit)
-{
-  return unit_class_flag(get_unit_class(unit_type(punit)), UCF_ALWAYS_SAFE)
-    ? 0 : 15;
-}
-
-/**************************************************************************
 An "aggressive" unit is a unit which may cause unhappiness
 under a Republic or Democracy.
 A unit is *not* aggressive if one or more of following is true:
Index: common/unittype.c
===================================================================
--- common/unittype.c	(revision 12614)
+++ common/unittype.c	(working copy)
@@ -41,7 +41,7 @@
 
 static const char *unit_class_flag_names[] = {
   "TerrainSpeed", "DamageSlows", "CanOccupy", "Missile",
-  "RoadNative", "BuildAnywhere", "Unreachable", "AlwaysSafe",
+  "RoadNative", "BuildAnywhere", "Unreachable",
   "CollectRansom", "ZOC"
 };
 static const char *flag_names[] = {
Index: common/unit.h
===================================================================
--- common/unit.h	(revision 12614)
+++ common/unit.h	(working copy)
@@ -73,7 +73,7 @@
   MR_BAD_ACTIVITY, MR_BAD_DESTINATION, MR_BAD_MAP_POSITION,
   MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT,
   MR_NO_TRANSPORTER_CAPACITY,
-  MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_CITY
+  MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_CITY, MR_TRIREME
 };
 
 enum add_build_city_result {
@@ -277,13 +277,6 @@
 struct unit *is_non_attack_unit_tile(const struct tile *ptile,
 				     const struct player *pplayer);
 
-int unit_loss_pct(const struct player *pplayer, const struct tile *ptile,
-		  const struct unit *punit);
-int base_trireme_loss_pct(const struct player *pplayer,
-			  const struct unit *punit);
-int base_unsafe_terrain_loss_pct(const struct player *pplayer,
-				 const struct unit *punit);
-
 bool is_my_zoc(const struct player *unit_owner, const struct tile *ptile);
 bool unit_being_aggressive(const struct unit *punit);
 bool unit_type_really_ignores_zoc(const struct unit_type *punittype);
Index: common/unittype.h
===================================================================
--- common/unittype.h	(revision 12614)
+++ common/unittype.h	(working copy)
@@ -33,7 +33,6 @@
   UCF_ROAD_NATIVE,
   UCF_BUILD_ANYWHERE,
   UCF_UNREACHABLE,
-  UCF_ALWAYS_SAFE,
   UCF_COLLECT_RANSOM,     /* Can collect ransom from barbarian leader */
   UCF_ZOC,                /* Is subject to ZOC */
   UCF_LAST
Index: common/aicore/pf_tools.c
===================================================================
--- common/aicore/pf_tools.c	(revision 12614)
+++ common/aicore/pf_tools.c	(working copy)
@@ -38,7 +38,11 @@
                                    const struct tile *src_tile,
                                    const struct tile *dest_tile)
 {
-  if (unit_class_flag(param->class, UCF_TERRAIN_SPEED)) {
+  if (!dest_tile->city
+      && BV_ISSET(param->unit_flags, F_TRIREME)
+      && !is_safe_ocean(dest_tile)) {
+    return PF_IMPOSSIBLE_MC;
+  } else if (unit_class_flag(param->class, UCF_TERRAIN_SPEED)) {
     return map_move_cost(src_tile, dest_tile);
   } else {
     return SINGLE_MOVE;
@@ -535,30 +539,6 @@
 
 /* =====================  Postion Dangerous Callbacks ================ */
 
-/**********************************************************************
-  An example of position-dangerous callback.  For triremes.
-  FIXME: it cheats.
-  Allow one move onto land (for use for ferries and land
-  bombardment)
-***********************************************************************/
-static bool trireme_is_pos_dangerous(const struct tile *ptile,
-				     enum known_type known,
-				     struct pf_parameter *param)
-{
-  /* Assume that unknown tiles are unsafe. */
-  if (known == TILE_UNKNOWN) {
-    return TRUE;
-  }
-
-  /* We test TER_UNSAFE even though under the current ruleset there is no
-   * way for a trireme to be on a TER_UNSAFE tile. */
-  /* Unsafe or unsafe-ocean tiles without cities are dangerous. */
-  /* Pretend all land tiles are safe. */
-  return (ptile->city == NULL
-	  && is_ocean(ptile->terrain)
-	  && (terrain_has_flag(ptile->terrain, TER_UNSAFE) 
-	      || (is_ocean(ptile->terrain) && !is_safe_ocean(ptile))));
-}
 /****************************************************************************
   Position-dangerous callback for air units.
 ****************************************************************************/
@@ -582,34 +562,6 @@
   return TRUE;
 }
 
-/**********************************************************************
-  Position-dangerous callback for sea units other than triremes.
-  Allow one move onto land (for use for ferries and land
-  bombardment)
-***********************************************************************/
-static bool is_overlap_pos_dangerous(const struct tile *ptile,
-				     enum known_type known,
-				     struct pf_parameter *param)
-{
-  /* Unsafe tiles without cities are dangerous. */
-  /* Pretend all land tiles are safe. */
-  return (ptile->city == NULL
-	  && is_native_tile_to_class(param->class, ptile)
-	  && terrain_has_flag(ptile->terrain, TER_UNSAFE));
-}
-
-/**********************************************************************
-  Position-dangerous callback for typical units.
-***********************************************************************/
-static bool is_pos_dangerous(const struct tile *ptile, enum known_type known,
-			     struct pf_parameter *param)
-{
-  /* Unsafe tiles without cities are dangerous. */
-  return (ptile->terrain != T_UNKNOWN
-	  && terrain_has_flag(ptile->terrain, TER_UNSAFE)
-	  && ptile->city == NULL);
-}
-
 /****************************************************************************
   Position-dangerous callback for amphibious movement.
 ****************************************************************************/
@@ -687,15 +639,6 @@
   } else {
     parameter->get_zoc = NULL;
   }
-
-  if (unit_flag(punit, F_TRIREME)
-      && base_trireme_loss_pct(unit_owner(punit), punit) > 0) {
-    parameter->turn_mode = TM_WORST_TIME;
-    parameter->is_pos_dangerous = trireme_is_pos_dangerous;
-  } else if (base_unsafe_terrain_loss_pct(unit_owner(punit), punit) > 0) {
-    parameter->turn_mode = TM_WORST_TIME;
-    parameter->is_pos_dangerous = is_pos_dangerous;
-  }
 }
 
 /**********************************************************************
@@ -705,35 +648,18 @@
 void pft_fill_unit_overlap_param(struct pf_parameter *parameter,
 				 struct unit *punit)
 {
-  const bool trireme_danger = unit_flag(punit, F_TRIREME)
-                     && base_trireme_loss_pct(unit_owner(punit), punit) > 0;
-  const bool danger
-    = base_unsafe_terrain_loss_pct(unit_owner(punit), punit) > 0;
-
   pft_fill_unit_default_parameter(parameter, punit);
 
   switch (get_unit_move_type(unit_type(punit))) {
   case LAND_MOVING:
     parameter->get_MC = land_overlap_move;
     parameter->get_TB = dont_cross_ocean;
-
-    assert(!trireme_danger);
-    if (danger) {
-      parameter->is_pos_dangerous = is_pos_dangerous;
-    }
     break;
   case SEA_MOVING:
     parameter->get_MC = sea_overlap_move;
-
-    if (trireme_danger) {
-      parameter->is_pos_dangerous = trireme_is_pos_dangerous;
-    } else if (danger) {
-      parameter->is_pos_dangerous = is_overlap_pos_dangerous;
-    }
     break;
   case AIR_MOVING:
   case HELI_MOVING:
-    assert(!danger && !trireme_danger);
     parameter->get_MC = single_airmove; /* very crude */
     break;
   default:
@@ -800,7 +726,7 @@
   parameter->sea_scale = move_rate / parameter->sea.move_rate;
   parameter->combined.moves_left_initially *= parameter->sea_scale;
   parameter->combined.move_rate = move_rate;
-  /* To ensure triremes behave correctly: */
+  /* To ensure triremes behave correctly: FIXME: Probably incorrect now */
   parameter->combined.turn_mode = TM_WORST_TIME;
   parameter->combined.get_MC = amphibious_move;
   parameter->combined.get_TB = amphibious_behaviour;
Index: common/movement.c
===================================================================
--- common/movement.c	(revision 12614)
+++ common/movement.c	(working copy)
@@ -163,11 +163,17 @@
 bool can_unit_exist_at_tile(const struct unit *punit,
                             const struct tile *ptile)
 {
-  if (ptile->city && !(is_sailing_unit(punit)
-      && !is_ocean_near_tile(ptile))) {
+  /* Cities are safe havens except for sea units without ocean access. */
+  if (ptile->city
+      && !(is_sailing_unit(punit) && !is_ocean_near_tile(ptile))) {
     return TRUE;
   }
 
+  /* A trireme unit cannot exist in an ocean tile without access to land. */
+  if (unit_flag(punit, F_TRIREME) && !is_safe_ocean(ptile)) {
+    return FALSE;
+  }
+
   return is_native_tile(punit->type, ptile);
 }
 
@@ -266,15 +272,14 @@
     return TRUE;
   }
 
-  /* TODO: check for dangerous positions (like triremes in deep water). */
-
   switch (get_unit_move_type(unit_type(punit))) {
   case LAND_MOVING:
   case SEA_MOVING:
     return TRUE;
   case AIR_MOVING:
+    return tile_has_base_flag(punit->tile, BF_REFUEL);
   case HELI_MOVING:
-    return tile_has_base_flag(punit->tile, BF_REFUEL);
+    return tile_has_base_flag(punit->tile, BF_NO_HP_LOSS);
   default:
     die("Invalid move type");
   }
@@ -374,6 +379,7 @@
     6) There are no peaceful but un-allied units on the target tile.
     7) There is not a peaceful but un-allied city on the target tile.
     8) There is no non-allied unit blocking (zoc) [or igzoc is true].
+    9) Triremes cannot move out of sight from land.
 **************************************************************************/
 enum unit_move_result test_unit_move_to_tile(const struct unit_type *punittype,
 					     const struct player *unit_owner,
@@ -452,6 +458,11 @@
     return MR_ZOC;
   }
 
+  /* 9) */
+  if (unit_type_flag(punittype, F_TRIREME) && !is_safe_ocean(dst_tile)) {
+    return MR_TRIREME;
+  }
+
   return MR_OK;
 }
 
Index: common/terrain.c
===================================================================
--- common/terrain.c	(revision 12614)
+++ common/terrain.c	(working copy)
@@ -113,7 +113,6 @@
     "Starter",
     "CanHaveRiver",
     "UnsafeCoast",
-    "Unsafe",
     "Oceanic"
   };
 
Index: common/terrain.h
===================================================================
--- common/terrain.h	(revision 12614)
+++ common/terrain.h	(working copy)
@@ -75,7 +75,6 @@
   TER_STARTER, /* Players will start on this terrain type. */
   TER_CAN_HAVE_RIVER, /* Terrains with this type can have S_RIVER on them. */
   TER_UNSAFE_COAST,/*this tile is not safe as coast, (all ocean / ice) */ 
-  TER_UNSAFE,  /*unsafe for all units (ice,...) */
   TER_OCEANIC, /* This is an ocean terrain. */
   TER_LAST
 };
Index: common/map.c
===================================================================
--- common/map.c	(revision 12614)
+++ common/map.c	(working copy)
@@ -553,8 +553,13 @@
 ****************************************************************************/
 bool is_safe_ocean(const struct tile *ptile)
 {
-  return count_terrain_flag_near_tile(ptile, FALSE, TRUE,
-				      TER_UNSAFE_COAST) < 100;
+  adjc_iterate(ptile, adjc_tile) {
+    if (adjc_tile->terrain != T_UNKNOWN
+        && !terrain_has_flag(adjc_tile->terrain, TER_UNSAFE_COAST)) {
+      return TRUE;
+    }
+  } adjc_iterate_end;
+  return FALSE;
 }
 
 /***************************************************************
Index: ai/aitools.c
===================================================================
--- ai/aitools.c	(revision 12614)
+++ ai/aitools.c	(working copy)
@@ -544,9 +544,6 @@
   const double p_killed = chance_killed_at(ptile, risk_cost, param);
   double danger = value * p_killed;
 
-  if (terrain_has_flag(ptile->terrain, TER_UNSAFE)) {
-    danger += risk_cost->unsafe_terrain_cost;
-  }
   if (is_ocean(ptile->terrain) && !is_safe_ocean(ptile)) {
     danger += risk_cost->ocean_cost;
   }
@@ -591,7 +588,6 @@
 		    struct unit *punit,
 		    const double fearfulness)
 {
-  const struct player *pplayer = unit_owner(punit);
   /* If we stay a short time on each tile, the danger of each individual tile
    * is reduced. If we do not do this,
    * we will not favour longer but faster routs. */
@@ -603,15 +599,6 @@
   risk_cost->base_value = unit_build_shield_cost(punit->type);
   risk_cost->fearfulness = fearfulness * linger_fraction;
 
-  if (unit_flag(punit, F_TRIREME)) {
-    risk_cost->ocean_cost = risk_cost->base_value
-      * (double)base_trireme_loss_pct(pplayer, punit)
-      / 100.0;
-  } else {
-    risk_cost->ocean_cost = 0;
-  }
-  risk_cost->unsafe_terrain_cost = risk_cost->base_value
-    * (double)base_unsafe_terrain_loss_pct(pplayer, punit) / 100.0;
   risk_cost->enemy_zoc_cost = PF_TURN_FACTOR * 20;
 }
 
Index: client/helpdata.c
===================================================================
--- client/helpdata.c	(revision 12614)
+++ client/helpdata.c	(working copy)
@@ -1224,11 +1224,6 @@
 	    _("* The coastline of this terrain is unsafe."));
     strcat(buf, "\n");
   }
-  if (terrain_has_flag(pterrain, TER_UNSAFE)) {
-    sprintf(buf + strlen(buf),
-	    _("* This terrain is unsafe for units to travel on."));
-    strcat(buf, "\n");
-  }
   if (terrain_has_flag(pterrain, TER_OCEANIC)) {
     sprintf(buf + strlen(buf),
 	    _("* Land units cannot travel on oceanic terrains."));
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to