Skip to content

Commit ad6e823

Browse files
authored
Merge pull request #3106 from EasyRPG-NewFeatures/jetrotal-executeCommand-alternative
Add ExecuteCommand(com);
2 parents e43fd15 + 0c11500 commit ad6e823

6 files changed

+12
-13
lines changed

src/game_interpreter.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,10 @@ lcf::rpg::MoveCommand Game_Interpreter::DecodeMove(lcf::DBArray<int32_t>::const_
615615
bool Game_Interpreter::ExecuteCommand() {
616616
auto& frame = GetFrame();
617617
const auto& com = frame.commands[frame.current_command];
618+
return ExecuteCommand(com);
619+
}
618620

621+
bool Game_Interpreter::ExecuteCommand(lcf::rpg::EventCommand const& com) {
619622
switch (static_cast<Cmd>(com.code)) {
620623
case Cmd::ShowMessage:
621624
return CommandShowMessage(com);

src/game_interpreter.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class Game_Interpreter
7575
void InputButton();
7676
void SetupChoices(const std::vector<std::string>& choices, int indent, PendingMessage& pm);
7777

78-
virtual bool ExecuteCommand();
78+
bool ExecuteCommand();
79+
virtual bool ExecuteCommand(lcf::rpg::EventCommand const& com);
7980

8081

8182
/**

src/game_interpreter_battle.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ int Game_Interpreter_Battle::ScheduleNextPage(lcf::rpg::TroopPageCondition::Flag
154154
}
155155

156156
// Execute Command.
157-
bool Game_Interpreter_Battle::ExecuteCommand() {
158-
auto& frame = GetFrame();
159-
const auto& com = frame.commands[frame.current_command];
160-
157+
bool Game_Interpreter_Battle::ExecuteCommand(lcf::rpg::EventCommand const& com) {
161158
switch (static_cast<Cmd>(com.code)) {
162159
case Cmd::CallCommonEvent:
163160
return CommandCallCommonEvent(com);
@@ -194,7 +191,7 @@ bool Game_Interpreter_Battle::ExecuteCommand() {
194191
case Cmd::Maniac_GetBattleInfo:
195192
return CommandManiacGetBattleInfo(com);
196193
default:
197-
return Game_Interpreter::ExecuteCommand();
194+
return Game_Interpreter::ExecuteCommand(com);
198195
}
199196
}
200197

src/game_interpreter_battle.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class Game_Interpreter_Battle : public Game_Interpreter
5757

5858
bool IsForceFleeEnabled() const;
5959

60-
bool ExecuteCommand() override;
60+
bool ExecuteCommand(lcf::rpg::EventCommand const& com) override;
61+
6162
private:
6263
bool CommandCallCommonEvent(lcf::rpg::EventCommand const& com);
6364
bool CommandForceFlee(lcf::rpg::EventCommand const& com);

src/game_interpreter_map.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ void Game_Interpreter_Map::OnMapChange() {
8686
/**
8787
* Execute Command.
8888
*/
89-
bool Game_Interpreter_Map::ExecuteCommand() {
90-
auto& frame = GetFrame();
91-
const auto& com = frame.commands[frame.current_command];
92-
89+
bool Game_Interpreter_Map::ExecuteCommand(lcf::rpg::EventCommand const& com) {
9390
switch (static_cast<Cmd>(com.code)) {
9491
case Cmd::RecallToLocation:
9592
return CommandRecallToLocation(com);
@@ -146,7 +143,7 @@ bool Game_Interpreter_Map::ExecuteCommand() {
146143
case Cmd::ToggleAtbMode:
147144
return CommandToggleAtbMode(com);
148145
default:
149-
return Game_Interpreter::ExecuteCommand();
146+
return Game_Interpreter::ExecuteCommand(com);
150147
}
151148
}
152149

src/game_interpreter_map.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Game_Interpreter_Map : public Game_Interpreter
5151
*/
5252
void OnMapChange();
5353

54-
bool ExecuteCommand() override;
54+
bool ExecuteCommand(lcf::rpg::EventCommand const& com) override;
5555

5656
private:
5757
bool CommandRecallToLocation(lcf::rpg::EventCommand const& com);

0 commit comments

Comments
 (0)