Mercurial > hg > openttd
changeset 19216:4b152b00ba27 draft
(svn r24101) -Codechange: Reverse a condition for increased readability.
author | alberth <alberth@openttd.org> |
---|---|
date | Sun, 08 Apr 2012 17:26:01 +0000 |
parents | a4e7c26673b4 |
children | f379f2281802 |
files | src/town_cmd.cpp |
diffstat | 1 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2744,18 +2744,17 @@ if (!Object::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_OBJECTS); TileIndex tile = t->xy; - if (CircularTileSearch(&tile, 9, SearchTileForStatue, NULL)) { - if (flags & DC_EXEC) { - Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE); - DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); - cur_company.Restore(); - BuildObject(OBJECT_STATUE, tile, _current_company, t); - SetBit(t->statues, _current_company); // Once found and built, "inform" the Town. - MarkTileDirtyByTile(tile); - } - return CommandCost(); + if (!CircularTileSearch(&tile, 9, SearchTileForStatue, NULL)) return_cmd_error(STR_ERROR_STATUE_NO_SUITABLE_PLACE); + + if (flags & DC_EXEC) { + Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE); + DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); + cur_company.Restore(); + BuildObject(OBJECT_STATUE, tile, _current_company, t); + SetBit(t->statues, _current_company); // Once found and built, "inform" the Town. + MarkTileDirtyByTile(tile); } - return_cmd_error(STR_ERROR_STATUE_NO_SUITABLE_PLACE); + return CommandCost(); } static CommandCost TownActionFundBuildings(Town *t, DoCommandFlag flags)