equal
deleted
inserted
replaced
286 * (VarAction 2 Variable 0xE2) |
286 * (VarAction 2 Variable 0xE2) |
287 */ |
287 */ |
288 static byte MapAircraftMovementState(const Vehicle *v) |
288 static byte MapAircraftMovementState(const Vehicle *v) |
289 { |
289 { |
290 const Station *st = GetStation(v->u.air.targetairport); |
290 const Station *st = GetStation(v->u.air.targetairport); |
291 byte amdflag = GetAirport(st->airport_type)->MovingData(v->u.air.pos)->flag; |
291 const AirportFTAClass *afc = GetAirport(st->airport_type); |
|
292 byte amdflag = afc->MovingData(v->u.air.pos)->flag; |
292 |
293 |
293 switch (v->u.air.state) { |
294 switch (v->u.air.state) { |
294 case HANGAR: |
295 case HANGAR: |
295 /* The international airport is a special case as helicopters can land in |
296 /* The international airport is a special case as helicopters can land in |
296 * front of the hanger. Helicopters also change their air.state to |
297 * front of the hanger. Helicopters also change their air.state to |
345 |
346 |
346 case ENDTAKEOFF: // Ascent |
347 case ENDTAKEOFF: // Ascent |
347 return AMS_TTDP_CLIMBING; |
348 return AMS_TTDP_CLIMBING; |
348 |
349 |
349 case HELITAKEOFF: // Helicopter is moving to take off position. |
350 case HELITAKEOFF: // Helicopter is moving to take off position. |
350 switch (st->airport_type) { |
351 if (afc->delta_z == 0) { |
351 case AT_SMALL: |
352 return amdflag & AMED_HELI_RAISE ? |
352 case AT_LARGE: |
353 AMS_TTDP_HELI_TAKEOFF_AIRPORT : AMS_TTDP_TO_JUNCTION; |
353 case AT_METROPOLITAN: |
354 } else { |
354 case AT_INTERNATIONAL: |
355 return AMS_TTDP_HELI_TAKEOFF_HELIPORT; |
355 case AT_COMMUTER: |
|
356 case AT_INTERCON: |
|
357 /* Note, Helidepot and Helistation are treated as airports as |
|
358 * helicopters are taking off from ground level. */ |
|
359 case AT_HELIDEPOT: |
|
360 case AT_HELISTATION: |
|
361 if (amdflag & AMED_HELI_RAISE) return AMS_TTDP_HELI_TAKEOFF_AIRPORT; |
|
362 return AMS_TTDP_TO_JUNCTION; |
|
363 |
|
364 case AT_HELIPORT: |
|
365 case AT_OILRIG: |
|
366 return AMS_TTDP_HELI_TAKEOFF_HELIPORT; |
|
367 |
|
368 default: |
|
369 return AMS_TTDP_HELI_TAKEOFF_AIRPORT; |
|
370 } |
356 } |
371 |
357 |
372 case FLYING: |
358 case FLYING: |
373 return AMS_TTDP_FLIGHT_TO_TOWER; |
359 return AMS_TTDP_FLIGHT_TO_TOWER; |
374 |
360 |
381 return AMS_TTDP_TO_INWAY; |
367 return AMS_TTDP_TO_INWAY; |
382 |
368 |
383 case HELILANDING: |
369 case HELILANDING: |
384 case HELIENDLANDING: // Helicoptor is decending. |
370 case HELIENDLANDING: // Helicoptor is decending. |
385 if (amdflag & AMED_HELI_LOWER) { |
371 if (amdflag & AMED_HELI_LOWER) { |
386 switch (st->airport_type) { |
372 return afc->delta_z == 0 ? |
387 case AT_HELIPORT: |
373 AMS_TTDP_HELI_LAND_AIRPORT : AMS_TTDP_HELI_LAND_HELIPORT; |
388 case AT_OILRIG: |
374 } else { |
389 return AMS_TTDP_HELI_LAND_HELIPORT; |
375 return AMS_TTDP_FLIGHT_TO_TOWER; |
390 |
|
391 default: |
|
392 /* Note, Helidepot and Helistation are treated as airports as |
|
393 * helicopters are landing at ground level. */ |
|
394 return AMS_TTDP_HELI_LAND_AIRPORT; |
|
395 } |
|
396 } |
376 } |
397 return AMS_TTDP_FLIGHT_TO_TOWER; |
|
398 |
377 |
399 default: |
378 default: |
400 return AMS_TTDP_HANGAR; |
379 return AMS_TTDP_HANGAR; |
401 } |
380 } |
402 } |
381 } |