summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-09-25 13:58:27 +0000
committertruelight <truelight@openttd.org>2004-09-25 13:58:27 +0000
commit75a54521e82f0891633c680c398cb58143204b7f (patch)
tree73575ab8874a986a4a97c54060999f9f5122df1b
parent773737930a7c955420d6f2dc5ef21315ce6aeedb (diff)
downloadopenttd-75a54521e82f0891633c680c398cb58143204b7f.tar.xz
(svn r319) -Fix: [ 1029064 ] Building a station acted weird in some rare situations
-rw-r--r--station_cmd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 921c3bf42..b4aeacfbb 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -764,7 +764,9 @@ int32 CmdBuildRailroadStation(int x_org, int y_org, uint32 flags, uint32 p1, uin
// 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 @@ int32 CmdBuildRailroadStation(int x_org, int y_org, uint32 flags, uint32 p1, uin
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;