Skip to content
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

Merged
merged 14 commits into from
Sep 18, 2019
Merged

Refactor interpreter control flow #1742

merged 14 commits into from
Sep 18, 2019

Conversation

mateofio
Copy link
Contributor

@mateofio mateofio commented Apr 7, 2019

Depends on #1740

The 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 as RPG_RT. The practical results of this are:

  • Events which run 10k commands will abort the interpreter at the right time
  • Save games that are saved and loaded during executing conditionals will load correctly and be compatible between RPG_RT and Player.

Fixes most of #1707

Retested: #1613

@fdelapena fdelapena added this to the 0.6.1 milestone Apr 11, 2019
@mateofio mateofio force-pushed the event_cond branch 4 times, most recently from 02be291 to 504e1a0 Compare April 15, 2019 00:29
@mateofio mateofio force-pushed the event_cond branch 2 times, most recently from e2f1ede to 203261c Compare April 27, 2019 13:24
@mateofio mateofio marked this pull request as ready for review April 29, 2019 00:40
@Ghabry Ghabry modified the milestones: 0.6.1, 0.6.2 May 6, 2019
@carstene1ns carstene1ns added the Awaiting Rebase Pull requests with conflicting files due to former merge label May 26, 2019
@fdelapena fdelapena removed the Awaiting Rebase Pull requests with conflicting files due to former merge label May 27, 2019
@mateofio mateofio force-pushed the event_cond branch 5 times, most recently from 8e57f21 to 13f9625 Compare August 16, 2019 01:13
@mateofio mateofio force-pushed the event_cond branch 3 times, most recently from 5f06a72 to 00bb79d Compare August 16, 2019 01:49
@mateofio
Copy link
Contributor Author

This has been pretty heavily tested now as part of my work on #1876 .

}

bool Game_Interpreter_Map::CommandDefeatHandler(RPG::EventCommand const& com) { // code 20712
return CommandOptionGeneric(com, 2, {Cmd::EndBattle});
Copy link
Member

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?

Copy link
Contributor Author

@mateofio mateofio Sep 1, 2019

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.
Copy link
Member

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?

Copy link
Contributor Author

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

@fdelapena fdelapena added the Awaiting Rebase Pull requests with conflicting files due to former merge label Sep 1, 2019
@Ghabry Ghabry removed the Awaiting Rebase Pull requests with conflicting files due to former merge label Sep 2, 2019
@Ghabry Ghabry merged commit 4b1f949 into EasyRPG:master Sep 18, 2019
@mateofio mateofio deleted the event_cond branch December 29, 2019 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants