--- a/station_cmd.c Sat Sep 25 10:24:11 2004 +0000
+++ b/station_cmd.c Sat Sep 25 13:58:27 2004 +0000
@@ -764,7 +764,9 @@
// Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station)
est = -1;
- if ((ret=CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << direction, _patches.nonuniform_stations ? &est : NULL)) == CMD_ERROR) return CMD_ERROR;
+ // If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
+ // for detail info, see: https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365
+ if ((ret=CheckFlatLandBelow(tile_org, w_org, h_org, flags&~DC_EXEC, 5 << direction, _patches.nonuniform_stations ? &est : NULL)) == CMD_ERROR) return CMD_ERROR;
cost = ret + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len;
// Make sure there are no similar stations around us.
@@ -813,6 +815,11 @@
byte *layout_ptr;
uint station_index = st->index;
+ // Now really clear the land below the station
+ // It should never return CMD_ERROR.. but you never know ;)
+ // (a bit strange function name for it, but it really does clear the land, when DC_EXEC is in flags)
+ if (CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << direction, _patches.nonuniform_stations ? &est : NULL) == CMD_ERROR) return CMD_ERROR;
+
st->train_tile = finalvalues[0];
if (!st->facilities) st->xy = finalvalues[0];
st->facilities |= FACIL_TRAIN;