forked from mirror/OpenTTD
(svn r19372) -Codechange: CheckTileOwnership() returns a CommandCost.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user