summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-13 17:11:28 +0000
committeralberth <alberth@openttd.org>2010-03-13 17:11:28 +0000
commit7cc68f493d10ed81d24b9e7a0e9631436643869f (patch)
tree1f7fef2560b9bc81461bd8f17f21bdc1d80c2a91 /src/autoreplace_cmd.cpp
parent19afc9fdc0f009c93f31ea8fccdf95ce1372cc58 (diff)
downloadopenttd-7cc68f493d10ed81d24b9e7a0e9631436643869f.tar.xz
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 26a92e519..bce3f1ea5 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -628,7 +628,10 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
Vehicle *v = Vehicle::GetIfValid(p1);
if (v == NULL) return CMD_ERROR;
- if (!CheckOwnership(v->owner)) return CMD_ERROR;
+ CommandCost ret = CheckOwnership(v->owner);
+ ret.SetGlobalErrorMessage();
+ if (ret.Failed()) return ret;
+
if (!v->IsInDepot()) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;