changeset 4043:824fd31ce2d0 draft

(svn r5312) - Fix (r5288): Be very strict about terraforming. If a rail tile has a foundation already, bail out.
author Darkvater <Darkvater@openttd.org>
date Mon, 19 Jun 2006 06:49:51 +0000
parents 8b6234cb8e0a
children 904f22a3889f
files clear_cmd.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -259,13 +259,14 @@
 				if (IsSteepSlope(s)) return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK);
 
 				if (IsPlainRailTile(tile)) {
-					/* We need to check if a rail is on a leveled foundation and
-					 * then treat it as such. Important for correct tunneling */
+					/* If a piece of rail is on a foundation, prohibit any terraforming
+					 * of that tile. We do need to check this with the original slope, not
+					 * the would-be one. */
 					extern const TrackBits _valid_tileh_slopes[2][15];
 					TrackBits tb = GetTrackBits(tile);
-					uint foundation = (GetRailFoundation(s, tb) == 0) ? 1 : 0;
 
-					if (tb & ~_valid_tileh_slopes[foundation][s]) return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK);
+					if (GetRailFoundation(GetTileSlope(tile, NULL), tb) != 0) return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK);
+					if (tb & ~_valid_tileh_slopes[0][s]) return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK);
 				} else return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
 			}