mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r27225) -Change [FS#6262]: Be more lenient about road stop removal when at least one stop could be removed (afd88)
This commit is contained in:
parent
5c80edb7ed
commit
84e5c5a9cb
|
@ -2048,8 +2048,10 @@ CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
|
|
||||||
TileArea roadstop_area(tile, width, height);
|
TileArea roadstop_area(tile, width, height);
|
||||||
|
|
||||||
int quantity = 0;
|
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
CommandCost last_error(STR_ERROR_THERE_IS_NO_STATION);
|
||||||
|
bool had_success = false;
|
||||||
|
|
||||||
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
||||||
/* Make sure the specified tile is a road stop of the correct type */
|
/* 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;
|
if (!IsTileType(cur_tile, MP_STATION) || !IsRoadStop(cur_tile) || (uint32)GetRoadStopType(cur_tile) != GB(p2, 0, 1)) continue;
|
||||||
|
@ -2064,10 +2066,13 @@ CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
Owner road_owner = GetRoadOwner(cur_tile, ROADTYPE_ROAD);
|
Owner road_owner = GetRoadOwner(cur_tile, ROADTYPE_ROAD);
|
||||||
Owner tram_owner = GetRoadOwner(cur_tile, ROADTYPE_TRAM);
|
Owner tram_owner = GetRoadOwner(cur_tile, ROADTYPE_TRAM);
|
||||||
CommandCost ret = RemoveRoadStop(cur_tile, flags);
|
CommandCost ret = RemoveRoadStop(cur_tile, flags);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) {
|
||||||
|
last_error = ret;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
had_success = true;
|
||||||
|
|
||||||
quantity++;
|
|
||||||
/* If the stop was a drive-through stop replace the road */
|
/* If the stop was a drive-through stop replace the road */
|
||||||
if ((flags & DC_EXEC) && is_drive_through) {
|
if ((flags & DC_EXEC) && is_drive_through) {
|
||||||
MakeRoadNormal(cur_tile, road_bits, rts, ClosestTownFromTile(cur_tile, UINT_MAX)->index,
|
MakeRoadNormal(cur_tile, road_bits, rts, ClosestTownFromTile(cur_tile, UINT_MAX)->index,
|
||||||
|
@ -2085,9 +2090,7 @@ CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quantity == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_STATION);
|
return had_success ? cost : last_error;
|
||||||
|
|
||||||
return cost;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue