equal
deleted
inserted
replaced
34 if (!HasBit(grf_type, 7)) return GB(grf_type, 0, 6); |
34 if (!HasBit(grf_type, 7)) return GB(grf_type, 0, 6); |
35 |
35 |
36 return _industry_mngr.GetID(GB(grf_type, 0, 6), grf_id); |
36 return _industry_mngr.GetID(GB(grf_type, 0, 6), grf_id); |
37 } |
37 } |
38 |
38 |
|
39 static uint32 GetGRFParameter(IndustryType ind_id, byte parameter) |
|
40 { |
|
41 const IndustrySpec *indspec = GetIndustrySpec(ind_id); |
|
42 const GRFFile *file = indspec->grf_prop.grffile; |
|
43 |
|
44 if (parameter >= file->param_end) return 0; |
|
45 return file->param[parameter]; |
|
46 } |
|
47 |
39 /** |
48 /** |
40 * Finds the distance for the closest tile with water/land given a tile |
49 * Finds the distance for the closest tile with water/land given a tile |
41 * @param tile the tile to find the distance too |
50 * @param tile the tile to find the distance too |
42 * @param water whether to find water or land |
51 * @param water whether to find water or land |
43 * @note FAILS when an industry should be seen as water |
52 * @note FAILS when an industry should be seen as water |
266 case 0x67: |
275 case 0x67: |
267 case 0x68: return GetCountAndDistanceOfClosestInstance(parameter, variable == 0x68 ? GB(GetRegister(0x101), 0, 8) : 0, industry); |
276 case 0x68: return GetCountAndDistanceOfClosestInstance(parameter, variable == 0x68 ? GB(GetRegister(0x101), 0, 8) : 0, industry); |
268 |
277 |
269 /* Get a variable from the persistent storage */ |
278 /* Get a variable from the persistent storage */ |
270 case 0x7C: return industry->psa.Get(parameter); |
279 case 0x7C: return industry->psa.Get(parameter); |
|
280 |
|
281 /* Read GRF parameter */ |
|
282 case 0x7F: return GetGRFParameter(industry->type, parameter); |
271 |
283 |
272 /* Industry structure access*/ |
284 /* Industry structure access*/ |
273 case 0x80: return industry->xy; |
285 case 0x80: return industry->xy; |
274 case 0x81: return GB(industry->xy, 8, 8); |
286 case 0x81: return GB(industry->xy, 8, 8); |
275 /* Pointer to the town the industry is associated with */ |
287 /* Pointer to the town the industry is associated with */ |