Fix spec allocation issues when overbuilding a road stop with the same type

This commit is contained in:
Jonathan G Rennison
2022-02-24 18:19:00 +00:00
parent 6b03575dcd
commit 5109083564
2 changed files with 23 additions and 20 deletions

View File

@@ -315,11 +315,11 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis)) :
HasStationReservation(tile);
MakeRailWaypoint(tile, wp->owner, wp->index, axis, layout_ptr[i], GetRailType(tile));
if (old_specindex != map_spec_index) DeallocateSpecFromStation(wp, old_specindex);
SetCustomStationSpecIndex(tile, map_spec_index);
SetRailStationReservation(tile, reserved);
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
DeallocateSpecFromStation(wp, old_specindex);
YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis));
}
DirtyCompanyInfrastructureWindows(wp->owner);
@@ -446,9 +446,9 @@ CommandCost CmdBuildRoadWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
Owner tram_owner = tram_rt != INVALID_ROADTYPE ? GetRoadOwner(cur_tile, RTT_TRAM) : _current_company;
DisallowedRoadDirections drd = IsNormalRoadTile(cur_tile) ? GetDisallowedRoadDirections(cur_tile) : DRD_NONE;
extern CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags);
extern CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags, int replacement_spec_index);
if (IsTileType(cur_tile, MP_STATION) && IsAnyRoadStop(cur_tile)) {
RemoveRoadStop(cur_tile, flags);
RemoveRoadStop(cur_tile, flags, map_spec_index);
}
wp->road_waypoint_area.Add(cur_tile);