summaryrefslogtreecommitdiff
path: root/src/unmovable_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-07 20:44:05 +0000
committeralberth <alberth@openttd.org>2010-03-07 20:44:05 +0000
commit40f106ba7c2b0055f61e652674701bce53fb06a6 (patch)
tree4762f0523de8c1b7c40f469f9cee3ea8cb1b5a1e /src/unmovable_cmd.cpp
parent8f335d4cbd46ef88fabd476a747cf0d4dc18add2 (diff)
downloadopenttd-40f106ba7c2b0055f61e652674701bce53fb06a6.tar.xz
(svn r19372) -Codechange: CheckTileOwnership() returns a CommandCost.
Diffstat (limited to 'src/unmovable_cmd.cpp')
-rw-r--r--src/unmovable_cmd.cpp12
1 files changed, 10 insertions, 2 deletions
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]);