equal
deleted
inserted
replaced
967 |
967 |
968 static void MaybePlantFarmField(Industry *i) |
968 static void MaybePlantFarmField(Industry *i) |
969 { |
969 { |
970 uint tile; |
970 uint tile; |
971 if (CHANCE16(1,8)) { |
971 if (CHANCE16(1,8)) { |
972 tile = TileAddWrap(i->xy, ((i->width>>1) + Random() % 31 - 16), ((i->height>>1) + Random() % 31 - 16)); |
972 int x = (i->width>>1) + Random() % 31 - 16; |
|
973 int y = (i->height>>1) + Random() % 31 - 16; |
|
974 tile = TileAddWrap(i->xy, x, y); |
973 if (tile != TILE_WRAPPED) |
975 if (tile != TILE_WRAPPED) |
974 PlantFarmField(tile); |
976 PlantFarmField(tile); |
975 } |
977 } |
976 } |
978 } |
977 |
979 |
1389 Industry *i; |
1391 Industry *i; |
1390 |
1392 |
1391 for(i=_industries; i != endof(_industries); i++) { |
1393 for(i=_industries; i != endof(_industries); i++) { |
1392 if (i->xy == 0) { |
1394 if (i->xy == 0) { |
1393 int index = i - _industries; |
1395 int index = i - _industries; |
1394 if (index > _total_industries) _total_industries++; |
1396 if (index > _total_industries) _total_industries = index; |
1395 return i; |
1397 return i; |
1396 } |
1398 } |
1397 } |
1399 } |
1398 return NULL; |
1400 return NULL; |
1399 } |
1401 } |
1474 i->height++; |
1476 i->height++; |
1475 |
1477 |
1476 if (i->type == IT_FARM || i->type == IT_FARM_2) { |
1478 if (i->type == IT_FARM || i->type == IT_FARM_2) { |
1477 tile = i->xy + TILE_XY((i->width >> 1), (i->height >> 1)); |
1479 tile = i->xy + TILE_XY((i->width >> 1), (i->height >> 1)); |
1478 for(j=0; j!=50; j++) { |
1480 for(j=0; j!=50; j++) { |
1479 uint new_tile = TileAddWrap(tile, Random() % 31 - 16, Random() % 31 - 16); |
1481 int x = Random() % 31 - 16; |
|
1482 int y = Random() % 31 - 16; |
|
1483 uint new_tile = TileAddWrap(tile, x, y); |
1480 if (new_tile != TILE_WRAPPED) |
1484 if (new_tile != TILE_WRAPPED) |
1481 PlantFarmField(new_tile); |
1485 PlantFarmField(new_tile); |
1482 } |
1486 } |
1483 } |
1487 } |
1484 _industry_sort_dirty = true; |
1488 _industry_sort_dirty = true; |
1896 { |
1900 { |
1897 int index; |
1901 int index; |
1898 _total_industries = 0; |
1902 _total_industries = 0; |
1899 while ((index = SlIterateArray()) != -1) { |
1903 while ((index = SlIterateArray()) != -1) { |
1900 SlObject(DEREF_INDUSTRY(index), _industry_desc); |
1904 SlObject(DEREF_INDUSTRY(index), _industry_desc); |
1901 if (index + 1 > _total_industries) |
1905 if (index > _total_industries) _total_industries = index; |
1902 _total_industries = index + 1; |
|
1903 } |
1906 } |
1904 } |
1907 } |
1905 |
1908 |
1906 const ChunkHandler _industry_chunk_handlers[] = { |
1909 const ChunkHandler _industry_chunk_handlers[] = { |
1907 { 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST}, |
1910 { 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST}, |