Skip to content

Commit

Permalink
Minor: Defined "ExecutionType::ManiacHook" & clarified Push instances…
Browse files Browse the repository at this point in the history
… inside battle interpreter
  • Loading branch information
florianessl committed Feb 7, 2025
1 parent 513dd4a commit 0d39709
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/game_interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ template<InterpreterExecutionType type_ex>
inline void Game_Interpreter::Push(Game_CommonEvent* ev) {
static_assert(type_ex == InterpreterExecutionType::AutoStart || type_ex == InterpreterExecutionType::Parallel
|| type_ex == InterpreterExecutionType::Call || type_ex == InterpreterExecutionType::DeathHandler
|| type_ex == InterpreterExecutionType::DebugCall, "Unexpected ExecutionType for CommonEvent"
|| type_ex == InterpreterExecutionType::DebugCall || type_ex == InterpreterExecutionType::ManiacHook, "Unexpected ExecutionType for CommonEvent"
);
PushInternal(ev, type_ex);
}
Expand Down
6 changes: 3 additions & 3 deletions src/game_interpreter_battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int Game_Interpreter_Battle::ScheduleNextPage(lcf::rpg::TroopPageCondition::Flag
continue;
}
Clear();
Push<ExecutionType::Eval, EventType::None>(page.event_commands, 0); // FIXME: clarify type_src & type_ex for battle events
Push<ExecutionType::Action, EventType::BattleEvent>(page.event_commands, 0);
executed[i] = true;
return i + 1;
}
Expand Down Expand Up @@ -647,7 +647,7 @@ bool Game_Interpreter_Battle::ManiacBattleHook(ManiacBattleHookType hook_type, i
}

// pushes the common event to be run into the queue of events.
maniac_interpreter->Push<ExecutionType::Call>(common_event); // FIXME: clarify type_src & type_ex for battle events
maniac_interpreter->Push<ExecutionType::ManiacHook>(common_event);

// pushes the change variable events into the interpreters
// event queue, so we don't run into a race condition.
Expand Down Expand Up @@ -685,7 +685,7 @@ bool Game_Interpreter_Battle::ManiacBattleHook(ManiacBattleHookType hook_type, i
}

// Push is actually "push_back", so this gets added before other events.
maniac_interpreter->Push<ExecutionType::Eval, EventType::None>(pre_commands, 0); // FIXME: clarify type_src & type_ex for battle events
maniac_interpreter->Push<ExecutionType::ManiacHook, EventType::None>(pre_commands, 0);

// Necessary to start the sub-event.
maniac_interpreter->Update();
Expand Down
3 changes: 2 additions & 1 deletion src/game_interpreter_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ namespace Game_Interpreter_Shared {
DeathHandler = 10,
/* Event code was dynamically evaluated. (ManiacCallCommand) */
Eval,
DebugCall
DebugCall,
ManiacHook
};
static constexpr auto kExecutionType = lcf::makeEnumTags<ExecutionType>(
"Action",
Expand Down

0 comments on commit 0d39709

Please # to comment.