From 40f106ba7c2b0055f61e652674701bce53fb06a6 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 7 Mar 2010 20:44:05 +0000 Subject: (svn r19372) -Codechange: CheckTileOwnership() returns a CommandCost. --- src/unmovable_cmd.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/unmovable_cmd.cpp') diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 039a0162f..d3a97b5f3 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -175,7 +175,11 @@ CommandCost CmdPurchaseLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, CommandCost CmdSellLandArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { if (!IsOwnedLandTile(tile)) return CMD_ERROR; - if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) return CMD_ERROR; + if (_current_company != OWNER_WATER) { + CommandCost ret = CheckTileOwnership(tile); + ret.SetGlobalErrorMessage(); + if (ret.Failed()) return ret; + } CommandCost ret = EnsureNoVehicleOnGround(tile); ret.SetGlobalErrorMessage(); @@ -500,7 +504,11 @@ static void ChangeTileOwner_Unmovable(TileIndex tile, Owner old_owner, Owner new static CommandCost TerraformTile_Unmovable(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) { /* Owned land remains unsold */ - if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost(); + if (IsOwnedLand(tile)) { + CommandCost ret = CheckTileOwnership(tile); + ret.SetGlobalErrorMessage(); + if (ret.Succeeded()) return CommandCost(); + } if (AutoslopeEnabled() && (IsStatue(tile) || IsCompanyHQ(tile))) { if (!IsSteepSlope(tileh_new) && (z_new + GetSlopeMaxZ(tileh_new) == GetTileMaxZ(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); -- cgit v1.2.3-54-g00ecf