35 void BuildOilRig(TileIndex tile); |
35 void BuildOilRig(TileIndex tile); |
36 |
36 |
37 static byte _industry_sound_ctr; |
37 static byte _industry_sound_ctr; |
38 static TileIndex _industry_sound_tile; |
38 static TileIndex _industry_sound_tile; |
39 |
39 |
|
40 IndustrySpec _industry_specs[NUM_INDUSTRYTYPES]; |
|
41 IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES]; |
|
42 |
|
43 /** This function initialize the spec arrays of both |
|
44 * industry and industry tiles. |
|
45 * It adjusts the enabling of the industry too, based on climate availability. |
|
46 * This will allow for clearer testings */ |
|
47 void ResetIndustries() |
|
48 { |
|
49 memset(&_industry_specs, 0, sizeof(_industry_specs)); |
|
50 memcpy(&_industry_specs, &_origin_industry_specs, sizeof(_origin_industry_specs)); |
|
51 |
|
52 /* once performed, enable only the current climate industries */ |
|
53 for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) { |
|
54 _industry_specs[i].enabled = HASBIT(_origin_industry_specs[i].climate_availability, _opt.landscape); |
|
55 } |
|
56 |
|
57 |
|
58 memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs)); |
|
59 memcpy(&_industry_tile_specs, &_origin_industry_tile_specs, sizeof(_origin_industry_tile_specs)); |
|
60 } |
|
61 |
40 /** |
62 /** |
41 * Called if a new block is added to the industry-pool |
63 * Called if a new block is added to the industry-pool |
42 */ |
64 */ |
43 static void IndustryPoolNewBlock(uint start_item) |
65 static void IndustryPoolNewBlock(uint start_item) |
44 { |
66 { |
344 am = MoveGoodsToStation(i->xy, i->width, i->height, indspec->produced_cargo[0], cw); |
366 am = MoveGoodsToStation(i->xy, i->width, i->height, indspec->produced_cargo[0], cw); |
345 i->last_mo_transported[0] += am; |
367 i->last_mo_transported[0] += am; |
346 if (am != 0) { |
368 if (am != 0) { |
347 uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production; |
369 uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production; |
348 |
370 |
349 if (newgfx != INDUTILE_NOANIM) { |
371 if (newgfx != INDUSTRYTILE_NOANIM) { |
350 ResetIndustryConstructionStage(tile); |
372 ResetIndustryConstructionStage(tile); |
351 SetIndustryCompleted(tile, true); |
373 SetIndustryCompleted(tile, true); |
352 SetIndustryGfx(tile, newgfx); |
374 SetIndustryGfx(tile, newgfx); |
353 MarkTileDirtyByTile(tile); |
375 MarkTileDirtyByTile(tile); |
354 } |
376 } |
630 if (_game_mode == GM_EDITOR) return; |
652 if (_game_mode == GM_EDITOR) return; |
631 |
653 |
632 TransportIndustryGoods(tile); |
654 TransportIndustryGoods(tile); |
633 |
655 |
634 newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next; |
656 newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next; |
635 if (newgfx != INDUTILE_NOANIM) { |
657 if (newgfx != INDUSTRYTILE_NOANIM) { |
636 ResetIndustryConstructionStage(tile); |
658 ResetIndustryConstructionStage(tile); |
637 SetIndustryGfx(tile, newgfx); |
659 SetIndustryGfx(tile, newgfx); |
638 MarkTileDirtyByTile(tile); |
660 MarkTileDirtyByTile(tile); |
639 return; |
661 return; |
640 } |
662 } |