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

This subforum contains all the issues which we already resolved.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.
Attachments
zz-bugtest-template_0.0.1.zip
(817 Bytes) Downloaded 176 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

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

Post 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
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post by eradicator »

Why can't you just remove that flag when a new game is loaded?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
DarkShadow44
Filter Inserter
Filter Inserter
Posts: 358
Joined: Thu Jun 01, 2017 12:05 pm
Contact:

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

Post 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.
posila
Factorio Staff
Factorio Staff
Posts: 5409
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

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

Post by posila »

Thanks for the report.
I agree not clearing the flag is a bug, and it's fixed for 1.1.37
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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 ;)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Resolved Problems and Bugs”