* Get the vehicle position when an aircraft is build at the given tile * @param hangar_tile The tile on which the vehicle is build * @return The position (index in airport node array) where the aircraft ends up */
| 195 | * @return The position (index in airport node array) where the aircraft ends up |
| 196 | */ |
| 197 | uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile) |
| 198 | { |
| 199 | const Station *st = Station::GetByTile(hangar_tile); |
| 200 | const AirportFTAClass *apc = st->airport.GetFTA(); |
| 201 | /* When we click on hangar we know the tile it is on. By that we know |
| 202 | * its position in the array of depots the airport has.....we can search |
| 203 | * layout for #th position of depot. Since layout must start with a listing |
| 204 | * of all depots, it is simple */ |
| 205 | for (uint i = 0;; i++) { |
| 206 | if (st->airport.GetHangarTile(i) == hangar_tile) { |
| 207 | assert(apc->layout[i].heading == HANGAR); |
| 208 | return apc->layout[i].position; |
| 209 | } |
| 210 | } |
| 211 | NOT_REACHED(); |
| 212 | } |
no test coverage detected