diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1243,12 +1243,28 @@ v->pos = v->previous_pos = AircraftGetEntryPoint(v, apc, rotation); } +/** + * Aircraft is about to leave the hangar. + * @param v Aircraft leaving. + */ void AircraftLeaveHangar(Aircraft *v) { + /* Decide direction of hangar entrance/exit. */ + Direction direction; + const Station *st = Station::GetIfValid(v->targetairport); + asert(st != NULL); + switch (st->airport.rotation) { + case DIR_N: direction = DIR_SE; break; + case DIR_S: direction = DIR_NW; break; + case DIR_E: direction = DIR_SW; break; + case DIR_W: direction = DIR_NE; break; + default: NOT_REACHED(); + } + v->cur_speed = 0; v->subspeed = 0; v->progress = 0; - v->direction = DIR_SE; + v->direction = direction; v->vehstatus &= ~VS_HIDDEN; { Vehicle *u = v->Next();