equal
deleted
inserted
replaced
24 #include "table/build_industry.h" |
24 #include "table/build_industry.h" |
25 #include "genworld.h" |
25 #include "genworld.h" |
26 #include "date.h" |
26 #include "date.h" |
27 #include "water_map.h" |
27 #include "water_map.h" |
28 #include "tree_map.h" |
28 #include "tree_map.h" |
|
29 #include "cargotype.h" |
29 |
30 |
30 void ShowIndustryViewWindow(int industry); |
31 void ShowIndustryViewWindow(int industry); |
31 void BuildOilRig(TileIndex tile); |
32 void BuildOilRig(TileIndex tile); |
32 |
33 |
33 static byte _industry_sound_ctr; |
34 static byte _industry_sound_ctr; |
84 { |
85 { |
85 assert(thistype < IT_END); |
86 assert(thistype < IT_END); |
86 return &_industry_specs[thistype]; |
87 return &_industry_specs[thistype]; |
87 } |
88 } |
88 |
89 |
|
90 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx) |
|
91 { |
|
92 assert(gfx < NUM_INDUSTRY_GFXES); |
|
93 return &_industry_tile_specs[gfx]; |
|
94 } |
|
95 |
89 void DestroyIndustry(Industry *i) |
96 void DestroyIndustry(Industry *i) |
90 { |
97 { |
91 BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
98 BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
92 if (IsTileType(tile_cur, MP_INDUSTRY)) { |
99 if (IsTileType(tile_cur, MP_INDUSTRY)) { |
93 if (GetIndustryIndex(tile_cur) == i->index) { |
100 if (GetIndustryIndex(tile_cur) == i->index) { |
274 return SLOPE_FLAT; |
281 return SLOPE_FLAT; |
275 } |
282 } |
276 |
283 |
277 static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) |
284 static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) |
278 { |
285 { |
279 IndustryGfx gfx = GetIndustryGfx(tile); |
286 const IndustryTileSpec *itspec = GetIndustryTileSpec(GetIndustryGfx(tile)); |
280 CargoID a; |
287 CargoID a; |
281 |
288 |
282 a = _industry_section_accepts_1[gfx]; |
289 a = itspec->accepts_cargo[0]; |
283 if (a != CT_INVALID) ac[a] = (a == 0) ? 1 : 8; |
290 if (a != CT_INVALID) ac[a] = (a == CT_PASSENGERS) ? 1 : 8; |
284 |
291 |
285 a = _industry_section_accepts_2[gfx]; |
292 a = itspec->accepts_cargo[1]; |
286 if (a != CT_INVALID) ac[a] = 8; |
293 if (a != CT_INVALID) ac[a] = 8; |
287 |
294 |
288 a = _industry_section_accepts_3[gfx]; |
295 a = itspec->accepts_cargo[2]; |
289 if (a != CT_INVALID) ac[a] = 8; |
296 if (a != CT_INVALID) ac[a] = 8; |
290 } |
297 } |
291 |
298 |
292 static void GetTileDesc_Industry(TileIndex tile, TileDesc *td) |
299 static void GetTileDesc_Industry(TileIndex tile, TileDesc *td) |
293 { |
300 { |
1152 /* It is almost impossible to have a fully flat land in TG, so what we |
1159 /* It is almost impossible to have a fully flat land in TG, so what we |
1153 * do is that we check if we can make the land flat later on. See |
1160 * do is that we check if we can make the land flat later on. See |
1154 * CheckIfCanLevelIndustryPlatform(). */ |
1161 * CheckIfCanLevelIndustryPlatform(). */ |
1155 if (tileh != SLOPE_FLAT) { |
1162 if (tileh != SLOPE_FLAT) { |
1156 Slope t; |
1163 Slope t; |
1157 byte bits = _industry_section_bits[it->gfx]; |
1164 byte bits = GetIndustryTileSpec(it->gfx)->slopes_refused; |
1158 |
1165 |
1159 if (bits & 0x10) return false; |
1166 if (bits & 0x10) return false; |
1160 |
1167 |
1161 t = ComplementSlope(tileh); |
1168 t = ComplementSlope(tileh); |
1162 |
1169 |
1622 closeit = false; |
1629 closeit = false; |
1623 |
1630 |
1624 mag = abs(percent); |
1631 mag = abs(percent); |
1625 if (mag >= 10) { |
1632 if (mag >= 10) { |
1626 SetDParam(2, mag); |
1633 SetDParam(2, mag); |
1627 SetDParam(0, _cargoc.names_s[i->produced_cargo[j]]); |
1634 SetDParam(0, GetCargo(i->produced_cargo[j])->name); |
1628 SetDParam(1, i->index); |
1635 SetDParam(1, i->index); |
1629 AddNewsItem( |
1636 AddNewsItem( |
1630 percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN, |
1637 percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN, |
1631 NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), |
1638 NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), |
1632 i->xy + TileDiffXY(1, 1), 0 |
1639 i->xy + TileDiffXY(1, 1), 0 |