summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2019-09-29 22:48:19 +0200
committerGitHub <noreply@github.com>2019-09-29 22:48:19 +0200
commit041088d317c89050796823928215588b3d61aa57 (patch)
tree125948984d861f591544a043403f7b9940149f3c
parent04f659e768486da4fc73a97a633f140d9733bf78 (diff)
downloadopenttd-041088d317c89050796823928215588b3d61aa57.tar.xz
Fix fbbbc6e1931: Crash when creating orders to stations with relocated station sign. (#7755)
Station::xy is the position of the station sign, and not necessarily a tile of the station.
-rw-r--r--src/order_gui.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index fa56f70cb..7364ccd8a 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -410,8 +410,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
default: NOT_REACHED();
}
if (st->facilities & facil) {
- StationID st_index = GetStationIndex(st->xy);
- order.MakeGoToStation(st_index);
+ order.MakeGoToStation(st->index);
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);
if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_END);