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

 Instead of checking just if disbanded city was on land tile and unit
is sea unit, make generic check for native terrain.
 There also was a bug that units moved out sometimes get disbanded
too. Fix for that is needed to S2_1 too.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c	2007-01-22 17:18:36.000000000 +0200
+++ freeciv/server/citytools.c	2007-01-25 13:01:03.000000000 +0200
@@ -1078,22 +1078,25 @@
   /* make sure ships are not left on land when city is removed. */
   unit_list_iterate_safe(ptile->units, punit) {
     bool moved;
+    struct unit_type *punittype = unit_type(punit);
 
-    if (!is_sailing_unit(punit)) {
+    if (is_native_tile(punittype, ptile)) {
       continue;
     }
 
     handle_unit_activity_request(punit, ACTIVITY_IDLE);
     moved = FALSE;
     adjc_iterate(ptile, tile1) {
-      if (is_ocean(tile_get_terrain(tile1))) {
+      if (!moved && is_native_tile(punittype, tile1)) {
 	if (could_unit_move_to_tile(punit, tile1) == 1) {
 	  moved = handle_unit_move_request(punit, tile1, FALSE, TRUE);
 	  if (moved) {
 	    notify_player(unit_owner(punit), NULL, E_UNIT_RELOCATED,
-			     _("Moved %s out of disbanded city %s "
-			       "to avoid being landlocked."),
-			     unit_type(punit)->name, pcity->name);
+                          _("Moved %s out of disbanded city %s "
+                            "since it cannot stay on %s."),
+                          unit_type(punit)->name, pcity->name,
+                          get_name(tile_get_terrain(ptile)));
+            break;
 	  }
 	}
       }
@@ -1107,17 +1110,6 @@
     }
   } unit_list_iterate_safe_end;
 
-  /* Destroy final ineligible units (land units in ocean city) */
-  unit_list_iterate_safe(ptile->units, punit) {
-    if (is_ocean(tile_get_terrain(ptile)) && is_ground_unit(punit)) {
-      notify_player(unit_owner(punit), NULL, E_UNIT_LOST,
-		       _("When %s was disbanded your %s could not "
-			 "get out, and it was therefore lost."),
-		       pcity->name, unit_type(punit)->name);
-      wipe_unit(punit);
-    }
-  } unit_list_iterate_safe_end;
-
   /* Any remaining supported units are destroyed */
   unit_list_iterate_safe(pcity->units_supported, punit) {
     wipe_unit(punit);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to