summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
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)