src/station_cmd.cpp
changeset 6720 34eab44fd841
parent 6719 70e750141e56
child 6733 733f7bbba1fb
--- a/src/station_cmd.cpp	Sun May 27 01:03:59 2007 +0000
+++ b/src/station_cmd.cpp	Sun May 27 01:59:07 2007 +0000
@@ -615,7 +615,7 @@
 
 // Tries to clear the given area. Returns the cost in case of success.
 // Or an error code if it failed.
-int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station)
+int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, StationID* station, bool check_clear = true)
 {
 	int32 cost = 0;
 	int allowed_z = -1;
@@ -678,7 +678,7 @@
 					return_cmd_error(STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING);
 				}
 			}
-		} else {
+		} else if (check_clear) {
 			int32 ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 			if (CmdFailed(ret)) return ret;
 			cost += ret;
@@ -1280,7 +1280,7 @@
 		/* Do not remove roadtypes! */
 		rts |= cur_rts;
 	}
-	cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL);
+	cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL, !build_over_road);
 	if (CmdFailed(cost)) return cost;
 
 	Station *st = NULL;