[bug] Please Give player ship designs an internal serial number to avoid upgrade problems.

Posted on Monday, February 23, 2015

I used the designer to create a cargo hull with a bunch of Hyperdrive Plus engines.  I called this design:  "Speedy Cargo I".   Now this design couldn't go anywhere because I had forgotten to include life support.    So I used the designer again, taking the option to use the existing design for "Speedy Cargo I".

I removed one of the "Hyperdrive Plus" engines in the design to add a "life support" module.  Then I saved my new design under the same name: "Speedy Cargo I".   Then I deleted the original "Speedy Cargo I" design.

After this, I tried to upgrade my ship from the old: "Speedy Cargo I" to the new "Speedy Cargo I" design but I could not.   I presume that it is because you are using the name as unique identifier.  

I suggest you create an internal serial number for the ship designs, so that when you enter the upgrade menu, it will show all available designs for that hull size which does not match the internal serial number of the design of the ship you are using.   Display them showing most recent design first.

If using a string:
Some suggestions for format:   XXXXHHHHH:   

XXXX     = Internal date of ship design.  Number of days since January 1st 2013 converted to Hex. 
HHHHH  = Internal time computer when design was saved in seconds.

If using an 32 bit integer:
If the memory required to store this is an issue, you can store this info in a 32 bit integer (or two 16 bit integers).  The first 16 bits can be the internal date of the ship design which gives you 179 years that you can represent in internal date.   The remaining 16 bits, you can use to represent the internal time in rounded off to 2 second units.  There are 43200 2 second units in a day.   So it's 4 bytes for an internal serial number.    

To convert your internal time in seconds (max 86400) to 2 second units just divide your internal time by 2.