(svn r20749) -Fix: allow overbuilding objects with buoys and ship depots
This commit is contained in:
@@ -282,7 +282,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
|
||||
*/
|
||||
CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
if (!IsWaterTile(tile) || tile == 0) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
if (!HasTileWaterClass(tile) || !IsTileOnWater(tile) || tile == 0) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
|
||||
if (GetTileSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
@@ -291,6 +291,13 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
Waypoint *wp = FindDeletedWaypointCloseTo(tile, STR_SV_STNAME_BUOY, OWNER_NONE);
|
||||
if (wp == NULL && !Waypoint::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_STATIONS_LOADING);
|
||||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);
|
||||
if (!IsWaterTile(tile)) {
|
||||
CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (wp == NULL) {
|
||||
wp = new Waypoint(tile);
|
||||
@@ -316,7 +323,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
|
||||
}
|
||||
|
||||
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user