diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 4bc5e35091..9f1a2aa6c7 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1558,6 +1558,7 @@ CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailTy MakeRailStation(tile, st->owner, st->index, axis, *it, rt); /* Free the spec if we overbuild something */ DeallocateSpecFromStation(st, old_specindex); + if (statspec == nullptr) DeleteNewGRFInspectWindow(GSF_STATIONS, tile); SetCustomStationSpecIndex(tile, *specindex); SetStationTileRandomBits(tile, GB(Random(), 0, 4)); diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index aee8f9dbd0..60aee126bd 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -26,6 +26,7 @@ #include "vehicle_func.h" #include "string_func.h" #include "company_func.h" +#include "newgrf_debug.h" #include "newgrf_station.h" #include "newgrf_roadstop.h" #include "company_base.h" @@ -315,6 +316,7 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi MarkTileDirtyByTile(tile); DeallocateSpecFromStation(wp, old_specindex); + if (spec == nullptr) DeleteNewGRFInspectWindow(GSF_STATIONS, tile); YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis)); } DirtyCompanyInfrastructureWindows(wp->owner);