diff options
author | alberth <alberth@openttd.org> | 2012-04-08 17:26:01 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2012-04-08 17:26:01 +0000 |
commit | f607538882b1963e25849b4b440a47dc1d258044 (patch) | |
tree | 855c27b2ae9a0fa62062c0b3d99b05ab99b8ae96 /src | |
parent | 1e817ae2412bc0f00129688c271c7d4f23d33b74 (diff) | |
download | openttd-f607538882b1963e25849b4b440a47dc1d258044.tar.xz |
(svn r24101) -Codechange: Reverse a condition for increased readability.
Diffstat (limited to 'src')
-rw-r--r-- | src/town_cmd.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 8731a5d78..99b58f3e6 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2744,18 +2744,17 @@ static CommandCost TownActionBuildStatue(Town *t, DoCommandFlag flags) 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) |