pioneerspacesim/pioneer — pull request #917 by Ziusudra (2012-01-25 05:51:56+00:00)
Title: Trade ships update

Switch to using the ship object ref instead of the ship's label as the key, which simplifies onShipDestroyed and OnGameStart. Also avoids technical possibility of two ships having the same label. This requires a save version bump. I can't think of a way to update old tables that doesn't greatly complicate everything.

Adds amounts to and uses the list of cargo to greatly reduce the number of loops in getSystem.

Adds comments that document how the tables that are global to the module are used.

Moves compiling the list of nearby systems, required to spawn ships in hyperspace, from once per ship to once per system.

Fixes:
#861
dead ship being given order to orbit
active ships being forgotten in systems without starports
ships without any cargo to transfer undocking immediately

Everything except the last two commits was tested, but against an out of date version of master. I'll try to get some testing in over the next couple of days, but would appreciate if others could help.