From d659ce3189559f13d99234d70fecdd46ae99c812 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 13 Feb 2022 16:28:01 +0000 Subject: [PATCH] Fix c040a69f: rail waypoint spec not being allocated for new waypoints --- src/waypoint_cmd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 7f88554636..0d4a001c6e 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -281,8 +281,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint } /* Check if we can allocate a custom stationspec to this station */ - int map_spec_index = AllocateSpecToStation(spec, wp, (flags & DC_EXEC) != 0); - if (map_spec_index == -1) return_cmd_error(STR_ERROR_TOO_MANY_STATION_SPECS); + if (AllocateSpecToStation(spec, wp, false) == -1) return_cmd_error(STR_ERROR_TOO_MANY_STATION_SPECS); if (flags & DC_EXEC) { if (wp == nullptr) { @@ -305,6 +304,8 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint wp->UpdateVirtCoord(); + byte map_spec_index = AllocateSpecToStation(spec, wp, true); + Company *c = Company::Get(wp->owner); for (int i = 0; i < count; i++) { TileIndex tile = start_tile + i * offset;