* Get the center tile of the waypoint. * @return The center tile if the waypoint exists, otherwise the tile with the waypoint name. */
| 42 | * @return The center tile if the waypoint exists, otherwise the tile with the waypoint name. |
| 43 | */ |
| 44 | TileIndex GetCenterTile() const |
| 45 | { |
| 46 | if (!this->wp->IsInUse()) return this->wp->xy; |
| 47 | |
| 48 | StationType type; |
| 49 | switch (this->vt) { |
| 50 | case VEH_TRAIN: |
| 51 | type = StationType::RailWaypoint; |
| 52 | break; |
| 53 | |
| 54 | case VEH_ROAD: |
| 55 | type = StationType::RoadWaypoint; |
| 56 | break; |
| 57 | |
| 58 | case VEH_SHIP: |
| 59 | type = StationType::Buoy; |
| 60 | break; |
| 61 | |
| 62 | default: |
| 63 | NOT_REACHED(); |
| 64 | } |
| 65 | return this->wp->GetTileArea(type).GetCenterTile(); |
| 66 | } |
| 67 | |
| 68 | public: |
| 69 | /** |
no test coverage detected