summaryrefslogtreecommitdiff
path: root/src/company_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/company_cmd.cpp
parent8f335d4cbd46ef88fabd476a747cf0d4dc18add2 (diff)
downloadopenttd-40f106ba7c2b0055f61e652674701bce53fb06a6.tar.xz
(svn r19372) -Codechange: CheckTileOwnership() returns a CommandCost.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 29343a09b..e1b3e34f5 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -266,20 +266,19 @@ bool CheckOwnership(Owner owner, TileIndex tile)
* the given tile. If that isn't the case an
* appropriate error will be given.
* @param tile the tile to check.
- * @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 CheckTileOwnership(TileIndex tile)
+CommandCost CheckTileOwnership(TileIndex tile)
{
Owner owner = GetTileOwner(tile);
assert(owner < OWNER_END);
- if (owner == _current_company) return true;
- _error_message = STR_ERROR_OWNED_BY;
+ if (owner == _current_company) return CommandCost();
/* no need to get the name of the owner unless we're the local company (saves some time) */
if (IsLocalCompany()) GetNameOfOwner(owner, tile);
- return false;
+ return_cmd_error(STR_ERROR_OWNED_BY);
}
static void GenerateCompanyName(Company *c)