* Returns a tile somewhat representing the order destination (not suitable for pathfinding). * @param v The vehicle to get the location for. * @param airport Get the airport tile and not the station location for aircraft. * @return destination of order, or INVALID_TILE if none. */
| 560 | * @return destination of order, or INVALID_TILE if none. |
| 561 | */ |
| 562 | TileIndex Order::GetLocation(const Vehicle *v, bool airport) const |
| 563 | { |
| 564 | switch (this->GetType()) { |
| 565 | case OT_GOTO_WAYPOINT: |
| 566 | case OT_GOTO_STATION: |
| 567 | case OT_IMPLICIT: |
| 568 | if (airport && v->type == VEH_AIRCRAFT) return Station::Get(this->GetDestination().ToStationID())->airport.tile; |
| 569 | return BaseStation::Get(this->GetDestination().ToStationID())->xy; |
| 570 | |
| 571 | case OT_GOTO_DEPOT: |
| 572 | if (this->GetDestination() == DepotID::Invalid()) return INVALID_TILE; |
| 573 | return (v->type == VEH_AIRCRAFT) ? Station::Get(this->GetDestination().ToStationID())->xy : Depot::Get(this->GetDestination().ToDepotID())->xy; |
| 574 | |
| 575 | default: |
| 576 | return INVALID_TILE; |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | /** |
| 581 | * Get the distance between two orders of a vehicle. Conditional orders are resolved |
no test coverage detected