diff options
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r-- | src/water_cmd.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 01c25157f..6b881352e 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -168,7 +168,10 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o) static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags) { if (!IsShipDepot(tile)) return CMD_ERROR; - if (!CheckTileOwnership(tile)) return CMD_ERROR; + + CommandCost ret = CheckTileOwnership(tile); + ret.SetGlobalErrorMessage(); + if (ret.Failed()) return ret; TileIndex tile2 = GetOtherShipDepotTile(tile); @@ -244,10 +247,14 @@ static CommandCost RemoveShiplift(TileIndex tile, DoCommandFlag flags) { TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile)); - if (!CheckTileOwnership(tile) && GetTileOwner(tile) != OWNER_NONE) return CMD_ERROR; + if (GetTileOwner(tile) != OWNER_NONE) { + CommandCost ret = CheckTileOwnership(tile); + ret.SetGlobalErrorMessage(); + if (ret.Failed()) return ret; + } /* make sure no vehicle is on the tile. */ - CommandCost ret = EnsureNoVehicleOnGround(tile); + ret = EnsureNoVehicleOnGround(tile); if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta); if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta); ret.SetGlobalErrorMessage(); @@ -361,7 +368,11 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags) ret.SetGlobalErrorMessage(); if (ret.Failed()) return ret; - if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR; + if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE) { + CommandCost ret = CheckTileOwnership(tile); + ret.SetGlobalErrorMessage(); + if (ret.Failed()) return ret; + } if (flags & DC_EXEC) { DoClearSquare(tile); |