Index: src/road_gui.cpp =================================================================== --- src/road_gui.cpp (wersja 27201) +++ src/road_gui.cpp (kopia robocza) @@ -642,13 +642,13 @@ case DDSP_REMOVE_BUSSTOP: { TileArea ta(start_tile, end_tile); - DoCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound1D); + DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound1D); break; } case DDSP_REMOVE_TRUCKSTOP: { TileArea ta(start_tile, end_tile); - DoCommandP(ta.tile, ta.w | ta.h << 8, ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound1D); + DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound1D); break; } } Index: src/station_cmd.cpp =================================================================== --- src/station_cmd.cpp (wersja 27201) +++ src/station_cmd.cpp (kopia robocza) @@ -2033,6 +2033,7 @@ * @param p1 bit 0..7: Width of the removal area. * bit 8..15: Height of the removal area. * @param p2 bit 0: 0 For bus stops, 1 for truck stops. + * @param p2 bit 1: 0 to keep roads of all drive-through stops, 1 to remove them. * @param text Unused. * @return The cost of this operation or an error. */ @@ -2040,11 +2041,14 @@ { uint8 width = (uint8)GB(p1, 0, 8); uint8 height = (uint8)GB(p1, 8, 8); + bool keep_drive_through_roads = !HasBit(p2, 1); /* Check for incorrect width / height. */ if (width == 0 || height == 0) return CMD_ERROR; /* Check if the first tile and the last tile are valid */ if (!IsValidTile(tile) || TileAddWrap(tile, width - 1, height - 1) == INVALID_TILE) return CMD_ERROR; + /* Bankrupting company is not supposed to remove roads. */ + if (!keep_drive_through_roads && (flags & DC_BANKRUPT)) return CMD_ERROR; TileArea roadstop_area(tile, width, height); @@ -2054,24 +2058,29 @@ /* Make sure the specified tile is a road stop of the correct type */ if (!IsTileType(cur_tile, MP_STATION) || !IsRoadStop(cur_tile) || (uint32)GetRoadStopType(cur_tile) != GB(p2, 0, 1)) continue; - /* Save the stop info before it is removed */ - bool is_drive_through = IsDriveThroughStopTile(cur_tile); - RoadTypes rts = GetRoadTypes(cur_tile); - RoadBits road_bits = IsDriveThroughStopTile(cur_tile) ? - ((GetRoadStopDir(cur_tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y) : - DiagDirToRoadBits(GetRoadStopDir(cur_tile)); + /* Save information on to-be-restored roads before the stop is removed. */ + RoadTypes rts = ROADTYPES_NONE; + RoadBits road_bits = ROAD_NONE; + Owner road_owner[ROADTYPE_END] = { OWNER_NONE }; + if (IsDriveThroughStopTile(cur_tile)) { + RoadType rt; + FOR_EACH_SET_ROADTYPE(rt, GetRoadTypes(cur_tile)) { + road_owner[rt] = GetRoadOwner(cur_tile, rt); + /* If we don't want to preserve our roads then restore only roads of others. */ + if (keep_drive_through_roads || road_owner[rt] != _current_company) SetBit(rts, rt); + } + road_bits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(cur_tile))); + } - Owner road_owner = GetRoadOwner(cur_tile, ROADTYPE_ROAD); - Owner tram_owner = GetRoadOwner(cur_tile, ROADTYPE_TRAM); CommandCost ret = RemoveRoadStop(cur_tile, flags); if (ret.Failed()) return ret; cost.AddCost(ret); quantity++; - /* If the stop was a drive-through stop replace the road */ - if ((flags & DC_EXEC) && is_drive_through) { + /* Restore roads. */ + if ((flags & DC_EXEC) && rts != ROADTYPES_NONE) { MakeRoadNormal(cur_tile, road_bits, rts, ClosestTownFromTile(cur_tile, UINT_MAX)->index, - road_owner, tram_owner); + road_owner[ROADTYPE_ROAD], road_owner[ROADTYPE_TRAM]); /* Update company infrastructure counts. */ RoadType rt;