This is a core bug, but it manifests in VotG.

  • There is engine code that creates docking ports based on whether the station has a dock screen. That is, if a station defines a dock screen, but doesn't have docking ports, then we automatically create docking ports. This is particularly useful for extensions adding dock screens to ship classes (most of which do not define docking ports).
  • If a station had a docking screen but later lost it, then we destroy any auto-created docking ports (and undock any ships that might be currently docked).
  • There is a B-nine station in VotG that does not have docking ports, but that inherits from a base-class that adds an introductory dock screen. The dock screen only appears if the player has not yet encountered B-nine.
  • The game auto-generates docking ports for that station because when we first create the station, the player has not yet met B-nine.
  • At some point, a ship might even dock with those auto-generated ports.
  • Later, once the player meets B-nine, the screen disappears (which means we will destroy the auto-generated ports).
  • When we load a system, we run the code to create/destroy auto-generated ports. At this point, we realize that the B-nine station doesn't have dock screens and destroy any auto-generated ports.
  • Unfortunately, we're doing the above in the middle of load, and the entire system has not yet been loaded. In particular, a ship docked with the station might not yet have been loaded. In that case, the pointer from the docking port is NULL.
  • When we destroy the docking ports, we try to tell any docked ships to undock. But because the pointer is NULL (because the ship hasn't been loaded) we crash.


We need a couple of fixes for this:

  1. The code that creates/destroys ports should not fire in the middle of load; it should be deferred until the entire system is loaded.
  2. We need to create the introductory dock screens with the overrideOnly=true flag, and we need to check the flag to make sure we don't auto-create ports if this is the only dock screen.