diff options
author | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
commit | 47137cefb72d3b3d3bc6fdefc7a4b103429f6d46 (patch) | |
tree | 7a8d1fbbe0d0d6ee2c8e981c57be6a9003505e97 /industry_cmd.c | |
parent | 2cc2154ad26b96b032df2f4fca0ce1634e6330b2 (diff) | |
download | openttd-47137cefb72d3b3d3bc6fdefc7a4b103429f6d46.tar.xz |
(svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts
- use the trinary operator where appropriate
- data types (uint[] -> AcceptedCargo, ...)
- if cascade -> switch
- if (ptr) -> if (ptr != NULL)
- DeMorgan's Law
- Fix some comments
- 0 -> '\0', change magic numbers to symbolic constants
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index f08b68515..66ab18eb1 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1011,14 +1011,11 @@ static void PlantFarmField(TileIndex tile) static void MaybePlantFarmField(const Industry* i) { - TileIndex tile; - - if (CHANCE16(1,8)) { - int x = (i->width>>1) + Random() % 31 - 16; - int y = (i->height>>1) + Random() % 31 - 16; - tile = TileAddWrap(i->xy, x, y); - if (tile != INVALID_TILE) - PlantFarmField(tile); + if (CHANCE16(1, 8)) { + int x = i->width / 2 + Random() % 31 - 16; + int y = i->height / 2 + Random() % 31 - 16; + TileIndex tile = TileAddWrap(i->xy, x, y); + if (tile != INVALID_TILE) PlantFarmField(tile); } } @@ -1237,10 +1234,7 @@ static bool CheckNewIndustry_Lumbermill(TileIndex tile, int type) static bool CheckNewIndustry_BubbleGen(TileIndex tile, int type) { - if (GetTileZ(tile) > 32) { - return false; - } - return true; + return GetTileZ(tile) <= 32; } typedef bool CheckNewIndustryProc(TileIndex tile, int type); @@ -1454,10 +1448,7 @@ static Industry *AllocateIndustry(void) } /* Check if we can add a block to the pool */ - if (AddBlockToPool(&_industry_pool)) - return AllocateIndustry(); - - return NULL; + return AddBlockToPool(&_industry_pool) ? AllocateIndustry() : NULL; } static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, Town *t, byte owner) |