summaryrefslogtreecommitdiff
path: root/src/company_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/company_cmd.cpp
parent19afc9fdc0f009c93f31ea8fccdf95ce1372cc58 (diff)
downloadopenttd-7cc68f493d10ed81d24b9e7a0e9631436643869f.tar.xz
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index e1b3e34f5..39a889e5e 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -248,17 +248,17 @@ void GetNameOfOwner(Owner owner, TileIndex tile)
* @param owner the owner of the thing to check.
* @param tile optional tile to get the right town.
* @pre if tile == 0 then the owner can't be OWNER_TOWN.
- * @return true iff it's owned by the current company.
+ * @return A succeeded command iff it's owned by the current company, else a failed command.
*/
-bool CheckOwnership(Owner owner, TileIndex tile)
+CommandCost CheckOwnership(Owner owner, TileIndex tile)
{
assert(owner < OWNER_END);
assert(owner != OWNER_TOWN || tile != 0);
- if (owner == _current_company) return true;
- _error_message = STR_ERROR_OWNED_BY;
+ if (owner == _current_company) return CommandCost();
+
GetNameOfOwner(owner, tile);
- return false;
+ return_cmd_error(STR_ERROR_OWNED_BY);
}
/**