(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
This commit is contained in:
tron
2005-10-23 13:04:44 +00:00
parent 2cc2154ad2
commit 47137cefb7
38 changed files with 442 additions and 453 deletions

View File

@@ -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)