diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -789,11 +789,11 @@ CommandCost CmdBuildTrainDepot(TileIndex if (flags & DC_EXEC) { Depot *d = new Depot(tile); - MakeRailDepot(tile, _current_company, dir, (RailType)p1); + d->town_index = ClosestTownFromTile(tile, UINT_MAX)->index; + + MakeRailDepot(tile, _current_company, d->index, dir, (RailType)p1); MarkTileDirtyByTile(tile); - d->town_index = ClosestTownFromTile(tile, UINT_MAX)->index; - AddSideToSignalBuffer(tile, INVALID_DIAGDIR, _current_company); YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir)); }