(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.

This commit is contained in:
alberth
2010-03-13 17:11:28 +00:00
parent 19afc9fdc0
commit 7cc68f493d
15 changed files with 268 additions and 80 deletions

View File

@@ -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);
}
/**