pioneerspacesim/pioneer — pull request #3022 by johnbartholomew (2014-07-06 20:59:08+00:00)
Title: Fix assignment of orbital plane for solitary orbital starports

Fixes #3018.

Diagnosis:

1. When a solitary orbital starport is being created in `SystemBody::PopulateAddStations`, `NumToMake` is 1. This results in a divide by zero when the orbital plane of the station is assigned. Since this is done in a section of the code which has floating point exceptions disabled, this error is not caught, but results in an orbital plane matrix containing NaN values.
2. When you jump into Soze, the Frame of the solitary orbital starport ('Valdez Outpost') has its location set based on the orbital parameters. The NaN values infect the position member of the Frame.
3. The TradeShips module creates some NPCs which attempt to fly to and dock with 'Valdez Outpost'.
3. The autopilot for an NPC runs a `ParentSafetyAdjust`, which attempts to find out what Frame the ship is in. The NaNs in Valdez Outpost's Frame infect the results of distance calculations, so the is-in-Frame test always fails. The loop in ParentSafetyAdjust steps out toward the root frame. When it reaches the root frame, it continues to step out to the root frame's parent, which is NULL. This leads to an access violation and crash.