If a GUI is saved with a game, and if the save is loaded but the mod's styles have been changed and are no longer compatible with the saved GUI, the game pops up an error dialog and then just exits completely.
Can it not do this? Can it just print a message to the console then simply not create the element or something?
It would make this a non-issue. Currently it is not really possible to make updates to a mod that make styles incompatible with the old GUI, period, because it completely breaks all previously saved files that saved the old incompatible GUI's in them, and users can therefore never upgrade. Which is kinda no good.
Don't exit the game if a saved GUI has incompatible styles.
Don't exit the game if a saved GUI has incompatible styles.
Last edited by JasonC on Wed May 11, 2016 2:24 am, edited 1 time in total.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
Re: Don't exit the game if a saved GUI has incompatible styles.
Can you provide a small save (limit map to 50x50) and a sample mod with a single GUI element that reproduces the error? I'll get it taken care of for 0.13 if you can do that.
If you want to get ahold of me I'm almost always on Discord.
Re: Don't exit the game if a saved GUI has incompatible styles.
Example created at https://github.com/JC3/StyleUpdateExample:Rseding91 wrote:Can you provide a small save (limit map to 50x50) and a sample mod with a single GUI element that reproduces the error? I'll get it taken care of for 0.13 if you can do that.
- style-update-example-1.0.0: The "first" version of a mod, which provides a GUI with a button.
- style-update-example-2.0.0: The "second" version, where the button and its style have been changed to a checkbox.
- style-update-example-gui-hidden: A game saved with version 1.0.0 and the GUI hidden.
- style-update-example-gui-displayed: A game saved with version 1.0.0 and the GUI displayed.
For instant gratification:
- Install version 2.0.0 of the mod.
- Load style-update-example-gui-displayed.
- The game will produce an error and exit.
The hidden GUI save won't have the issue since the GUI doesn't exist in the save.
A more "realistic" example:
- Install version 1.0.0 of the mod.
- Start a new game.
- Press the "toggle" button in the top left to show the GUI.
- Save the game.
- Update to version 2.0.0 of the mod.
- Load the game.
- The game will produce an error and exit.
- The button in control.lua has been changed to a checkbox.
- The style in data.lua has been changed from a button_style to a checkbox_style to support this.
I propose, for 0.13, that the behavior for incompatible styles be identical to the behavior for styles that no longer exist. But just to be clear: Only when loading from saves. The behavior on ".add()" is already different from the save load behavior (it displays the standard Lua error box and also doesn't exit the game) and that should probably remain unchanged because it helps during development.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.