New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #9720: Delay start of GS/AI to after loading of savegame #9745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#YOLO
@glx22 Needs a rebase (and someone who understands GS/AI well enough to approve/merge it 🙂 ) |
Back to draft because #10206 (comment) |
|
#10241 already fixed the crash reported in #9720, but here I'm addressing #9720 (comment) |
src/script/script_instance.cpp
Outdated
return false; | ||
} | ||
|
||
default: NOT_REACHED(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_script_sl_byte
is coming from the savegame, isn't it? So might throwing some error/exception that the data is corrupt be a better option than crashing the game?
*/ | ||
void Load(int version); | ||
static ScriptData *Load(int version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite fond of the two Load
functions with the same name and wildly different behaviours. What about something like LoadFromSavegame
and LoadIntoInstance
(for the next function)?
Fixes #9720.
Motivation / Problem
See #9720 (comment)
Description
During loading, AI/GS saved data is stored in
ScriptConfig
.AI/GS are started after loading is fully completed.
On AI/GS start, the saved data is put on stack right after initialisation.
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.