111 /** |
111 /** |
112 * Accessor for array _industry_tile_specs. |
112 * Accessor for array _industry_tile_specs. |
113 * This will ensure at once : proper access and |
113 * This will ensure at once : proper access and |
114 * not allowing modifications of it. |
114 * not allowing modifications of it. |
115 * @param gfx of industrytile (which is the index in _industry_tile_specs) |
115 * @param gfx of industrytile (which is the index in _industry_tile_specs) |
116 * @param full_check (default to true) verify if an override is available. |
|
117 * If so, use it instead of the gfx provided. |
|
118 * @pre gfx < INVALID_INDUSTRYTILE |
116 * @pre gfx < INVALID_INDUSTRYTILE |
119 * @return a pointer to the corresponding industrytile spec |
117 * @return a pointer to the corresponding industrytile spec |
120 **/ |
118 **/ |
121 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check) |
119 const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx) |
122 { |
120 { |
123 assert(gfx < INVALID_INDUSTRYTILE); |
121 assert(gfx < INVALID_INDUSTRYTILE); |
124 const IndustryTileSpec *its = &_industry_tile_specs[gfx]; |
122 return &_industry_tile_specs[gfx]; |
125 if (full_check && its->grf_prop.override != INVALID_INDUSTRYTILE) { |
|
126 its = &_industry_tile_specs[its->grf_prop.override]; |
|
127 } |
|
128 return its; |
|
129 } |
123 } |
130 |
124 |
131 Industry::~Industry() |
125 Industry::~Industry() |
132 { |
126 { |
133 if (CleaningPool()) return; |
127 if (CleaningPool()) return; |
332 |
326 |
333 static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) |
327 static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) |
334 { |
328 { |
335 IndustryGfx gfx = GetIndustryGfx(tile); |
329 IndustryGfx gfx = GetIndustryGfx(tile); |
336 const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); |
330 const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); |
|
331 if (itspec->grf_prop.override != INVALID_INDUSTRYTILE) itspec = GetIndustryTileSpec(itspec->grf_prop.override); |
337 |
332 |
338 /* When we have to use a callback, we put our data in the next two variables */ |
333 /* When we have to use a callback, we put our data in the next two variables */ |
339 CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)]; |
334 CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)]; |
340 uint8 raw_acceptance[lengthof(itspec->acceptance)]; |
335 uint8 raw_acceptance[lengthof(itspec->acceptance)]; |
341 |
336 |