MCPcopy Create free account
hub / github.com/EasyRPG/Player / OnFinishStackFrame

Method OnFinishStackFrame

src/game_interpreter.cpp:809–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807}
808
809bool Game_Interpreter::OnFinishStackFrame() {
810 auto& frame = GetFrame();
811
812 const bool is_base_frame = _state.stack.size() == 1;
813
814 if (main_flag && is_base_frame && !Game_Battle::IsBattleRunning()) {
815 Main_Data::game_system->ClearMessageFace();
816 }
817
818 int event_id = frame.event_id;
819
820 if (is_base_frame && event_id > 0) {
821 Game_Event* evnt = Game_Map::GetEvent(event_id);
822 if (!evnt) {
823 Output::Error("Call stack finished with invalid event id {}. This can be caused by a vehicle teleport?", event_id);
824 } else if (main_flag) {
825 evnt->OnFinishForegroundEvent();
826 }
827 }
828
829 if (!main_flag && is_base_frame) {
830 // Parallel events will never clear the base stack frame. Instead we just
831 // reset the index back to 0 and wait for a frame.
832 // This not only optimizes away copying event code, it's also RPG_RT compatible.
833 frame.current_command = 0;
834 } else {
835 // If a called frame, or base frame of foreground interpreter, pop the stack.
836 _state.stack.pop_back();
837 }
838
839 if (is_base_frame) {
840#ifdef ENABLE_DYNAMIC_INTERPRETER_CONFIG
841 // Individual runtime flags that may still be set will be cleared by
842 // CommandEasyRpgSetInterpreterFlag if neccessary
843 _state.easyrpg_runtime_flags.conf_override_active = false;
844#endif
845 }
846
847 return !is_base_frame;
848}
849
850std::vector<std::string> Game_Interpreter::GetChoices(int max_num_choices) {
851 const auto& frame = GetFrame();

Callers

nothing calls this directly

Calls 3

ClearMessageFaceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected