equal
deleted
inserted
replaced
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 int _total_industries; //general counter |
|
41 uint16 _industry_counts[NUM_INDUSTRYTYPES]; // Number of industries per type ingame |
|
42 |
|
43 const Industry **_industry_sort; |
|
44 bool _industry_sort_dirty; |
|
45 |
40 IndustrySpec _industry_specs[NUM_INDUSTRYTYPES]; |
46 IndustrySpec _industry_specs[NUM_INDUSTRYTYPES]; |
41 IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES]; |
47 IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES]; |
42 |
48 |
43 /** This function initialize the spec arrays of both |
49 /** This function initialize the spec arrays of both |
44 * industry and industry tiles. |
50 * industry and industry tiles. |
140 } END_TILE_LOOP(tile_cur, 42, 42, i->xy - TileDiff(21, 21)) |
146 } END_TILE_LOOP(tile_cur, 42, 42, i->xy - TileDiff(21, 21)) |
141 } |
147 } |
142 |
148 |
143 _industry_sort_dirty = true; |
149 _industry_sort_dirty = true; |
144 _total_industries--; |
150 _total_industries--; |
|
151 DecIndustryTypeCount(i->type); |
|
152 |
145 DeleteSubsidyWithIndustry(i->index); |
153 DeleteSubsidyWithIndustry(i->index); |
146 DeleteWindowById(WC_INDUSTRY_VIEW, i->index); |
154 DeleteWindowById(WC_INDUSTRY_VIEW, i->index); |
147 InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0); |
155 InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0); |
148 } |
156 } |
149 |
157 |
1349 |
1357 |
1350 _total_industries++; |
1358 _total_industries++; |
1351 i->xy = tile; |
1359 i->xy = tile; |
1352 i->width = i->height = 0; |
1360 i->width = i->height = 0; |
1353 i->type = type; |
1361 i->type = type; |
|
1362 IncIndustryTypeCount(type); |
1354 |
1363 |
1355 i->production_rate[0] = indspec->production_rate[0]; |
1364 i->production_rate[0] = indspec->production_rate[0]; |
1356 i->production_rate[1] = indspec->production_rate[1]; |
1365 i->production_rate[1] = indspec->production_rate[1]; |
1357 |
1366 |
1358 if (_patches.smooth_economy) { |
1367 if (_patches.smooth_economy) { |
1847 { |
1856 { |
1848 CleanPool(&_Industry_pool); |
1857 CleanPool(&_Industry_pool); |
1849 AddBlockToPool(&_Industry_pool); |
1858 AddBlockToPool(&_Industry_pool); |
1850 |
1859 |
1851 _total_industries = 0; |
1860 _total_industries = 0; |
|
1861 memset(&_industry_counts, 0, sizeof(_industry_counts)); |
1852 _industry_sort_dirty = true; |
1862 _industry_sort_dirty = true; |
1853 _industry_sound_tile = 0; |
1863 _industry_sound_tile = 0; |
1854 } |
1864 } |
1855 |
1865 |
1856 extern const TileTypeProcs _tile_type_industry_procs = { |
1866 extern const TileTypeProcs _tile_type_industry_procs = { |
1924 if (!AddBlockIfNeeded(&_Industry_pool, index)) |
1934 if (!AddBlockIfNeeded(&_Industry_pool, index)) |
1925 error("Industries: failed loading savegame: too many industries"); |
1935 error("Industries: failed loading savegame: too many industries"); |
1926 |
1936 |
1927 i = GetIndustry(index); |
1937 i = GetIndustry(index); |
1928 SlObject(i, _industry_desc); |
1938 SlObject(i, _industry_desc); |
|
1939 IncIndustryTypeCount(i->type); |
1929 |
1940 |
1930 _total_industries++; |
1941 _total_industries++; |
1931 } |
1942 } |
1932 } |
1943 } |
1933 |
1944 |