changeset 10130:480c1b0837fd draft

(svn r14316) -Fix: do not allow building road over level crossings and drive-through road stops in the wrong direction even when the roadtype is present
author smatz <smatz@openttd.org>
date Sat, 13 Sep 2008 17:37:18 +0000
parents 67099e82faab
children 31d04d81597e
files src/road_cmd.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -523,10 +523,11 @@
 				} break;
 
 				case ROAD_TILE_CROSSING:
-					if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 					other_bits = GetCrossingRoadBits(tile);
 					if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
 					pieces = other_bits; // we need to pay for both roadbits
+
+					if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 					break;
 
 				default:
@@ -578,11 +579,12 @@
 
 		case MP_STATION: {
 			if (!IsDriveThroughStopTile(tile)) goto do_clear;
-			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 
 			RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
 			if (pieces & ~curbits) goto do_clear;
 			pieces = curbits; // we need to pay for both roadbits
+
+			if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 		} break;
 
 		case MP_TUNNELBRIDGE: