(svn r19319) -Codechange: EnsureNoVehicleOnGround() returns a CommandCost.

This commit is contained in:
alberth
2010-03-05 21:20:22 +00:00
parent ef1b27a18d
commit 4c0d4990f5
10 changed files with 109 additions and 42 deletions

View File

@@ -179,7 +179,10 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID *
Owner owner = GetTileOwner(tile);
if (!CheckOwnership(owner)) return CMD_ERROR;
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
CommandCost ret = EnsureNoVehicleOnGround(tile);
ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
Slope tileh = GetTileSlope(tile, NULL);
if (tileh != SLOPE_FLAT &&
@@ -390,7 +393,11 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
if (HasStationInUse(wp->index, INVALID_COMPANY)) return_cmd_error(STR_ERROR_BUOY_IS_IN_USE);
/* remove the buoy if there is a ship on tile when company goes bankrupt... */
if (!(flags & DC_BANKRUPT) && !EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
if (!(flags & DC_BANKRUPT)) {
CommandCost ret = EnsureNoVehicleOnGround(tile);
ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
if (flags & DC_EXEC) {
wp->facilities &= ~FACIL_DOCK;