-
Notifications
You must be signed in to change notification settings - Fork 199
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
Refactor interpreter control flow #1742
Conversation
02be291
to
504e1a0
Compare
e2f1ede
to
203261c
Compare
8e57f21
to
13f9625
Compare
5f06a72
to
00bb79d
Compare
This has been pretty heavily tested now as part of my work on #1876 . |
src/game_interpreter_map.cpp
Outdated
} | ||
|
||
bool Game_Interpreter_Map::CommandDefeatHandler(RPG::EventCommand const& com) { // code 20712 | ||
return CommandOptionGeneric(com, 2, {Cmd::EndBattle}); |
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.
Where do these numbers that are the 2nd parameter for CommandOptionGeneric come from?
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.
These are the values that subcommand_path.back()
has to be to trigger this action.
There are example frame dumps in #1707
This deserves an enum to help make the code more self documenting.
frame = &_state.stack[current_frame_idx]; | ||
|
||
// Only do auto increment if the command didn't manually | ||
// change the index. |
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.
Under which cases does this happen?
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.
Any commands that need to manipulate the index
internally. The show message is one complex example.
Loop commands are another
After end loop, the next command is not Loop but instead is the first command inside the loop.
- Don't loop over choices or number input - Increment index after choices and number input (broken in earlier commit)
ce06c7d
to
62e286b
Compare
Depends on #1740The PR refactors control flow to use
subcommand_path
chunks. The goal is to ensure that every event command is either executed or skipped the same asRPG_RT
. The practical results of this are:Fixes most of #1707
Retested: #1613