Page 1 of 1

[posila] [1.1.35] game.auto_save persists after error+load

Posted: Wed Jul 21, 2021 8:51 pm
by eradicator
If game.auto_save is used right before an error, then it will auto-save on the next map loaded instead.

Code: Select all

    game.auto_save('_bugreport_of_the_wrong_map')
    error('Please load another savegame')
  1. Install the demo mod (didn't test zip, might need to extract)
  2. start a new map
  3. Wait a second till it errors
  4. load any other savegame
  5. watch the new savegame being auto_saved.

Re: [1.1.35] game.auto_save persists after error+load

Posted: Thu Jul 22, 2021 10:23 am
by Klonan
The auto save command flags the game to autosave next time it is processsing actions,
So this is not a bug

The reason is that the game cannot handle just saving at an arbitrary point in the middle of script updating,
We have to save at a consistent point of time relative to game and script updates

Re: [1.1.35] game.auto_save persists after error+load

Posted: Thu Jul 22, 2021 11:14 am
by eradicator
Why can't you just remove that flag when a new game is loaded?

Re: [1.1.35] game.auto_save persists after error+load

Posted: Thu Jul 22, 2021 12:30 pm
by DarkShadow44
eradicator wrote: Thu Jul 22, 2021 11:14 am Why can't you just remove that flag when a new game is loaded?
Just so that I understand you correctly, you don't need it to save before the error, you just want it to mistakenly save a loaded map?
It would make sense to clear that flag on load, even if that case should never happen.

Re: [1.1.35] game.auto_save persists after error+load

Posted: Thu Jul 22, 2021 2:49 pm
by posila
Thanks for the report.
I agree not clearing the flag is a bug, and it's fixed for 1.1.37

Re: [1.1.35] game.auto_save persists after error+load

Posted: Thu Jul 22, 2021 4:52 pm
by eradicator
DarkShadow44 wrote: Thu Jul 22, 2021 12:30 pm Just so that I understand you correctly, you don't need it to save before the error, you just want it to mistakenly save a
loaded map?
I don't want to load anything. I just want that API commands do not leak into other savegames.
DarkShadow44 wrote: Thu Jul 22, 2021 12:30 pm It would make sense to clear that flag on load, even if that case should never happen.
First post contains a mod that makes it happen every time ;). I was trying to be nice and save the map for the user before throwing an error. But forgot to throw the error one tick later.
posila wrote: Thu Jul 22, 2021 2:49 pm Thanks for the report.
I agree not clearing the flag is a bug, and it's fixed for 1.1.37
Thank you! Finally someone understands ;)