Closed BottledByte closed 1 year ago
... How could I miss something as big as that?! 😱
Yeah, it's the correct solution. Shouldn't be too hard, just have to get around to it tomorrow or something.
I see you have fixed this with commit deeef551e38afe171b1907c5dbde6ea73e7f138d using the solution I described... and now there is a segfault when loading existing saves :smile:
I was not sure about whether simply adding DesignManager
deserialization to save file loading without any checks is a proper solution, because it breaks existing saves (which makes the engine crash with a segfault).
I do not know your policy when it comes to backwards compatibility and I am completely OK with this solution - I am using "nightly" version of the mod and I am well-aware that it comes with both benefits and drawbacks :slightly_smiling_face:
However, it would make sense to me to either:
If it is possible, I think first solution is better in long-term, because of the save migration it offers. Other players may have save files they would like to keep and use.
Otherwise, the fix works :+1: and you can close this issue if you are OK with this saves thing.
Mmm, I can't think of any versioning mechanism available to me that would salvage the savefile... and it occurs to me that the Launchpad won't be able to roll back to the preceding commit on its own. Ouch. That's a bit of functionality I hadn't considered before...
You should be able to keep playing your if you manually install the right version, though.
I see... if I understood you correctly, now all save files created prior to aforementioned commit stopped working and you cannot migrate them in any way now...
Good thing is that it is possible to salvage save files. It is in fact relatively simple. I will write the steps down here for posterity.
scripts/server/components/
ObjectManager.as
thereload(SaveFile& file)
of ObjectManager
classfile >> designs;
and save the fileObjectManager.as
Not exactly optimal save migration, but it works OK for me.
However, is there a way to allow hotfixing save file migrations in the future?
Is mod's version info/number stored somewhere in the save files, so it can be reused in load()
hooks to properly deserialize (and migrate) them?
From what I understood
If such versioning mechanism is not in place yet, then I am thinking about whether it does not worth to break the save file format once more and adding it. Having a versioning mechanism like that seems useful to me in long-term.
There's not really any convenient place to put it, as far as I know... 😐
I see... :slightly_frowning_face:
I guess there is not much to be done here anyway. The issue is fixed, so it's time to close this.
And thanks for a such fast response and fix :+1:
PS: I suggest to label this issue post-mortem as a bug
for posterity. I saw you were using that label in the past.
Build and maintenance cost discounts provided by logistics mechanic after building several ships of the same design get reset after saving and loading the game.
Found in commit 61e21ee0201440d7b88028254a6b3f20760e35cd
Screenshot at the time of save:
After loading (Net budget and Scout cost are different):
Reproduction steps
Additional notes
I have skimmed through the scripts and tried to figure out the reason and it appears that the
DesignManager
object is not saved and loaded along withObjectManager
.Adding
DesignManager
tosave()
andload()
methods ofObjectManager
seemingly fixed the issue, but I am not sure if it is a correct solution.