* Find a free terminal or helipad, and if available, assign it. * @param v Aircraft looking for a free terminal or helipad. * @param i First terminal to examine. * @param last_terminal Terminal number to stop examining. * @return A terminal or helipad has been found, and has been assigned to the aircraft. */
| 1970 | * @return A terminal or helipad has been found, and has been assigned to the aircraft. |
| 1971 | */ |
| 1972 | static bool FreeTerminal(Aircraft *v, uint8_t i, uint8_t last_terminal) |
| 1973 | { |
| 1974 | assert(last_terminal <= lengthof(_airport_terminal_mapping)); |
| 1975 | Station *st = Station::Get(v->targetairport); |
| 1976 | for (; i < last_terminal; i++) { |
| 1977 | if (!st->airport.blocks.Any(_airport_terminal_mapping[i].blocks)) { |
| 1978 | /* TERMINAL# HELIPAD# */ |
| 1979 | v->state = _airport_terminal_mapping[i].state; // start moving to that terminal/helipad |
| 1980 | st->airport.blocks.Set(_airport_terminal_mapping[i].blocks); // occupy terminal/helipad |
| 1981 | return true; |
| 1982 | } |
| 1983 | } |
| 1984 | return false; |
| 1985 | } |
| 1986 | |
| 1987 | /** |
| 1988 | * Get the number of terminals at the airport. |
no test coverage detected