227 |
228 |
228 /* General station properties */ |
229 /* General station properties */ |
229 case 0x82: return 50; |
230 case 0x82: return 50; |
230 case 0x84: return st->string_id; |
231 case 0x84: return st->string_id; |
231 case 0x86: return 0; |
232 case 0x86: return 0; |
232 case 0x9A: return st->had_vehicle_of_type; |
233 case 0x8A: return st->had_vehicle_of_type; |
233 case 0xF0: return st->facilities; |
234 case 0xF0: return st->facilities; |
234 case 0xF1: return st->airport_type; |
235 case 0xF1: return st->airport_type; |
235 case 0xF2: return st->truck_stops->status; |
236 case 0xF2: return st->truck_stops->status; |
236 case 0xF3: return st->bus_stops->status; |
237 case 0xF3: return st->bus_stops->status; |
237 case 0xF6: return st->airport_flags; |
238 case 0xF6: return st->airport_flags; |
238 case 0xF7: return st->airport_flags & 0xFF; |
239 case 0xF7: return st->airport_flags & 0xFF; |
239 case 0xFA: return st->build_date; |
240 case 0xFA: return st->build_date; |
240 } |
241 } |
241 |
242 |
|
243 /* Handle cargo variables (deprecated) */ |
|
244 if (variable >= 0x8C && variable <= 0xEC) { |
|
245 const GoodsEntry *g = &st->goods[GB(variable - 0x8C, 3, 4)]; |
|
246 switch (GB(variable - 0x8C, 0, 3)) { |
|
247 case 0: return g->waiting_acceptance; |
|
248 case 1: return g->waiting_acceptance & 0xFF; |
|
249 case 2: return g->days_since_pickup; |
|
250 case 3: return g->rating; |
|
251 case 4: return g->enroute_from; |
|
252 case 5: return g->enroute_time; |
|
253 case 6: return g->last_speed; |
|
254 case 7: return g->last_age; |
|
255 } |
|
256 } |
|
257 |
242 DEBUG(grf, 1)("Unhandled station property 0x%X", variable); |
258 DEBUG(grf, 1)("Unhandled station property 0x%X", variable); |
243 |
259 |
244 return -1; |
260 return -1; |
245 } |
261 } |
246 |
262 |
274 set = ((cargo - statspec->cargo_threshold) * group->g.real.num_loaded) / (0xfff - statspec->cargo_threshold); |
290 set = ((cargo - statspec->cargo_threshold) * group->g.real.num_loaded) / (0xfff - statspec->cargo_threshold); |
275 return group->g.real.loaded[set]; |
291 return group->g.real.loaded[set]; |
276 } |
292 } |
277 } else { |
293 } else { |
278 if (group->g.real.num_loading > 0) { |
294 if (group->g.real.num_loading > 0) { |
279 set = (cargo * group->g.real.num_loading) / statspec->cargo_threshold; |
295 set = (cargo * group->g.real.num_loading) / (statspec->cargo_threshold + 1); |
280 return group->g.real.loading[set]; |
296 return group->g.real.loading[set]; |
281 } |
297 } |
282 } |
298 } |
283 |
299 |
284 return group->g.real.loading[0]; |
300 return group->g.real.loading[0]; |