65 struct Industry { |
65 struct Industry { |
66 TileIndex xy; ///< coordinates of the primary tile the industry is built one |
66 TileIndex xy; ///< coordinates of the primary tile the industry is built one |
67 byte width; |
67 byte width; |
68 byte height; |
68 byte height; |
69 const Town* town; ///< Nearest town |
69 const Town* town; ///< Nearest town |
70 CargoID produced_cargo[2]; ///< 2 production cargo slots |
|
71 uint16 cargo_waiting[2]; ///< amount of cargo produced per cargo |
70 uint16 cargo_waiting[2]; ///< amount of cargo produced per cargo |
72 byte production_rate[2]; ///< production rate for each cargo |
71 byte production_rate[2]; ///< production rate for each cargo |
73 CargoID accepts_cargo[3]; ///< 3 input cargo slots |
|
74 byte prod_level; ///< general production level |
72 byte prod_level; ///< general production level |
75 uint16 last_mo_production[2]; ///< stats of last month production per cargo |
73 uint16 last_mo_production[2]; ///< stats of last month production per cargo |
76 uint16 last_mo_transported[2]; ///< stats of last month transport per cargo |
74 uint16 last_mo_transported[2]; ///< stats of last month transport per cargo |
77 byte pct_transported[2]; ///< percentage transported per cargo |
75 byte pct_transported[2]; ///< percentage transported per cargo |
78 uint16 total_production[2]; ///< total units produced per cargo |
76 uint16 total_production[2]; ///< total units produced per cargo |
79 uint16 total_transported[2]; ///< total units transported per cargo |
77 uint16 total_transported[2]; ///< total units transported per cargo |
80 uint16 counter; ///< used for animation and/or production (if available cargo) |
78 uint16 counter; ///< used for animation and/or production (if available cargo) |
81 |
79 |
82 byte type; ///< type of industry. see IT_COAL_MINE and others |
80 IndustryType type; ///< type of industry. see IT_COAL_MINE and others |
83 OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE |
81 OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE |
84 byte random_color; ///< randomized colour of the industry, for display purpose |
82 byte random_color; ///< randomized colour of the industry, for display purpose |
85 Year last_prod_year; ///< last year of production |
83 Year last_prod_year; ///< last year of production |
86 byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry |
84 byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry |
87 |
85 |
105 CargoID produced_cargo[2]; |
103 CargoID produced_cargo[2]; |
106 byte production_rate[2]; |
104 byte production_rate[2]; |
107 byte minimal_cargo; ///< minimum amount of cargo transported to the stations |
105 byte minimal_cargo; ///< minimum amount of cargo transported to the stations |
108 ///< If the waiting cargo is less than this number, no cargo is moved to it |
106 ///< If the waiting cargo is less than this number, no cargo is moved to it |
109 CargoID accepts_cargo[3]; ///< 3 accepted cargos |
107 CargoID accepts_cargo[3]; ///< 3 accepted cargos |
|
108 uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargos) |
110 IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs |
109 IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs |
111 byte climate_availability; ///< Bitmask, giving landscape enums as bit position |
110 byte climate_availability; ///< Bitmask, giving landscape enums as bit position |
112 IndustyBehaviour behaviour; ///< How this industry will behave, and how others entities can use it |
111 IndustyBehaviour behaviour; ///< How this industry will behave, and how others entities can use it |
113 byte map_colour; ///< colour used for the small map |
112 byte map_colour; ///< colour used for the small map |
114 StringID name; ///< Displayed name of the industry |
113 StringID name; ///< Displayed name of the industry |
116 StringID closure_text; ///< Message appearing when the industry closes |
115 StringID closure_text; ///< Message appearing when the industry closes |
117 StringID production_up_text; ///< Message appearing when the industry's production is increasing |
116 StringID production_up_text; ///< Message appearing when the industry's production is increasing |
118 StringID production_down_text; ///< Message appearing when the industry's production is decreasing |
117 StringID production_down_text; ///< Message appearing when the industry's production is decreasing |
119 byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game |
118 byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game |
120 byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation |
119 byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation |
|
120 uint8 number_of_sounds; ///< Number of sounds available in the sounds array |
|
121 const uint8 *random_sounds; ///< array of random sounds. |
121 /* Newgrf stuff coming in */ |
122 /* Newgrf stuff coming in */ |
122 uint16 callback_flags; ///< Flags telling which grf callback is set |
123 uint16 callback_flags; ///< Flags telling which grf callback is set |
123 byte subst_id; |
124 byte subst_id; |
124 uint32 grfid; |
125 uint32 grfid; |
125 byte override; |
126 byte override; |
132 CargoID accepts_cargo[3]; ///< Cargo accepted by this tile |
133 CargoID accepts_cargo[3]; ///< Cargo accepted by this tile |
133 Slope slopes_refused; ///< slope pattern on which this tile cannot be built |
134 Slope slopes_refused; ///< slope pattern on which this tile cannot be built |
134 byte anim_production; ///< Animation frame to start when goods are produced |
135 byte anim_production; ///< Animation frame to start when goods are produced |
135 byte anim_next; ///< Next frame in an animation |
136 byte anim_next; ///< Next frame in an animation |
136 bool anim_state; ///< When true, the tile has to be drawn using the animation |
137 bool anim_state; ///< When true, the tile has to be drawn using the animation |
137 ///< state instead of the construction state |
138 ///< state instead of the construction state |
138 }; |
139 }; |
139 |
140 |
|
141 /* industry_cmd.cpp*/ |
140 const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data |
142 const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data |
141 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data |
143 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data |
|
144 void ResetIndustries(); |
|
145 void PlantRandomFarmField(const Industry *i); |
|
146 |
|
147 /* smallmap_gui.cpp */ |
|
148 void BuildIndustriesLegend(); |
142 |
149 |
143 DECLARE_OLD_POOL(Industry, Industry, 3, 8000) |
150 DECLARE_OLD_POOL(Industry, Industry, 3, 8000) |
144 |
151 |
145 /** |
152 /** |
146 * Check if an Industry really exists. |
153 * Check if an Industry really exists. |
214 #define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? GetIndustry(i->index + 1U) : NULL) if (IsValidIndustry(i)) |
221 #define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? GetIndustry(i->index + 1U) : NULL) if (IsValidIndustry(i)) |
215 #define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0) |
222 #define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0) |
216 |
223 |
217 VARDEF const Industry** _industry_sort; |
224 VARDEF const Industry** _industry_sort; |
218 VARDEF bool _industry_sort_dirty; |
225 VARDEF bool _industry_sort_dirty; |
219 |
|
220 |
|
221 void DeleteIndustry(Industry *is); |
|
222 void PlantRandomFarmField(const Industry *i); |
|
223 |
226 |
224 enum { |
227 enum { |
225 IT_COAL_MINE = 0, |
228 IT_COAL_MINE = 0, |
226 IT_POWER_STATION = 1, |
229 IT_POWER_STATION = 1, |
227 IT_SAWMILL = 2, |
230 IT_SAWMILL = 2, |