diff src/station_cmd.cpp @ 5953:81aac4ab6860 draft

(svn r8619) -Fix: store the ownership of a water tile in the buoy tile and set the ownership of the water tile when the buoy is removed. This solves the issue of removing ownership from canal tiles thus making is possible for other players to remove the canal tile.
author rubidium <rubidium@openttd.org>
date Wed, 07 Feb 2007 17:52:21 +0000
parents cfb5c65a5119
children 9d9c1c80f583
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1806,7 +1806,15 @@
 		st->facilities &= ~FACIL_DOCK;
 		st->had_vehicle_of_type &= ~HVOT_BUOY;
 
-		MakeWater(tile);
+		/* We have to set the water tile's state to the same state as before the
+		 * buoy was placed. Otherwise one could plant a buoy on a canal edge,
+		 * remove it and flood the land (if the canal edge is at level 0) */
+		Owner o = GetTileOwner(tile);
+		if (o == OWNER_WATER) {
+			MakeWater(tile);
+		} else {
+			MakeCanal(tile, o);
+		}
 		MarkTileDirtyByTile(tile);
 
 		UpdateStationVirtCoordDirty(st);