diff options
author | truelight <truelight@openttd.org> | 2004-12-04 17:54:56 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2004-12-04 17:54:56 +0000 |
commit | b8f6d41418982163965dd5beb0b39dbdce1fbe8f (patch) | |
tree | 68d3e795694a875138c369707ed74b5b4b022d49 /industry_cmd.c | |
parent | 0434287ef826a4ed72cd8528a52a86ae8b70a948 (diff) | |
download | openttd-b8f6d41418982163965dd5beb0b39dbdce1fbe8f.tar.xz |
(svn r942) -Merged branch/network back into the trunk
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index 93d3b0578..43cefea1b 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -969,7 +969,9 @@ static void MaybePlantFarmField(Industry *i) { uint tile; if (CHANCE16(1,8)) { - tile = TileAddWrap(i->xy, ((i->width>>1) + Random() % 31 - 16), ((i->height>>1) + Random() % 31 - 16)); + int x = (i->width>>1) + Random() % 31 - 16; + int y = (i->height>>1) + Random() % 31 - 16; + tile = TileAddWrap(i->xy, x, y); if (tile != TILE_WRAPPED) PlantFarmField(tile); } @@ -1391,7 +1393,7 @@ static Industry *AllocateIndustry() for(i=_industries; i != endof(_industries); i++) { if (i->xy == 0) { int index = i - _industries; - if (index > _total_industries) _total_industries++; + if (index > _total_industries) _total_industries = index; return i; } } @@ -1476,7 +1478,9 @@ static void DoCreateNewIndustry(Industry *i, uint tile, int type, const Industry if (i->type == IT_FARM || i->type == IT_FARM_2) { tile = i->xy + TILE_XY((i->width >> 1), (i->height >> 1)); for(j=0; j!=50; j++) { - uint new_tile = TileAddWrap(tile, Random() % 31 - 16, Random() % 31 - 16); + int x = Random() % 31 - 16; + int y = Random() % 31 - 16; + uint new_tile = TileAddWrap(tile, x, y); if (new_tile != TILE_WRAPPED) PlantFarmField(new_tile); } @@ -1898,8 +1902,7 @@ static void Load_INDY() _total_industries = 0; while ((index = SlIterateArray()) != -1) { SlObject(DEREF_INDUSTRY(index), _industry_desc); - if (index + 1 > _total_industries) - _total_industries = index + 1; + if (index > _total_industries) _total_industries = index; } } |