Equipment fixes

Various fixes.

In particular, this should fix the missile crash (#3038), and items vanishing from the cargo list (#3039, #3040). It doesn't fix the warnings about non-existent "icons/goods/missile_guided.png" files, because I haven't yet tracked down exactly which piece of code is trying to load those files.

There are also a couple of code fixes that do not relate to known/reported bugs.

Needs review and testing to confirm that it does actually fix the bugs it's supposed to fix.