Skip to content

Commit c5f402a

Browse files
committed
Use DBArray for EventCommand::parameters
1 parent 3c3ceac commit c5f402a

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/game_interpreter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ void Game_Interpreter::SkipToNextConditional(std::initializer_list<Cmd> codes, i
481481
}
482482
}
483483

484-
int Game_Interpreter::DecodeInt(std::vector<int32_t>::const_iterator& it) {
484+
int Game_Interpreter::DecodeInt(lcf::DBArray<int32_t>::const_iterator& it) {
485485
int value = 0;
486486

487487
for (;;) {
@@ -495,7 +495,7 @@ int Game_Interpreter::DecodeInt(std::vector<int32_t>::const_iterator& it) {
495495
return value;
496496
}
497497

498-
const std::string Game_Interpreter::DecodeString(std::vector<int32_t>::const_iterator& it) {
498+
const std::string Game_Interpreter::DecodeString(lcf::DBArray<int32_t>::const_iterator& it) {
499499
std::ostringstream out;
500500
int len = DecodeInt(it);
501501

@@ -507,7 +507,7 @@ const std::string Game_Interpreter::DecodeString(std::vector<int32_t>::const_ite
507507
return result;
508508
}
509509

510-
lcf::rpg::MoveCommand Game_Interpreter::DecodeMove(std::vector<int32_t>::const_iterator& it) {
510+
lcf::rpg::MoveCommand Game_Interpreter::DecodeMove(lcf::DBArray<int32_t>::const_iterator& it) {
511511
lcf::rpg::MoveCommand cmd;
512512
cmd.command_id = *it++;
513513

@@ -2696,9 +2696,9 @@ bool Game_Interpreter::CommandMoveEvent(lcf::rpg::EventCommand const& com) { //
26962696
route.repeat = com.parameters[2] != 0;
26972697
route.skippable = com.parameters[3] != 0;
26982698

2699-
std::vector<int32_t>::const_iterator it;
2700-
for (it = com.parameters.begin() + 4; it < com.parameters.end(); )
2699+
for (auto it = com.parameters.begin() + 4; it < com.parameters.end(); ) {
27012700
route.move_commands.push_back(DecodeMove(it));
2701+
}
27022702

27032703
event->ForceMoveRoute(route, move_freq);
27042704
}

src/game_interpreter.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "async_handler.h"
2525
#include "game_character.h"
2626
#include "game_actor.h"
27+
#include <lcf/dbarray.h>
2728
#include <lcf/rpg/fwd.h>
2829
#include <lcf/rpg/eventcommand.h>
2930
#include "system.h"
@@ -253,9 +254,9 @@ class Game_Interpreter
253254
bool CommandExitGame(lcf::rpg::EventCommand const& com);
254255
bool CommandToggleFullscreen(lcf::rpg::EventCommand const& com);
255256

256-
int DecodeInt(std::vector<int32_t>::const_iterator& it);
257-
const std::string DecodeString(std::vector<int32_t>::const_iterator& it);
258-
lcf::rpg::MoveCommand DecodeMove(std::vector<int32_t>::const_iterator& it);
257+
int DecodeInt(lcf::DBArray<int32_t>::const_iterator& it);
258+
const std::string DecodeString(lcf::DBArray<int32_t>::const_iterator& it);
259+
lcf::rpg::MoveCommand DecodeMove(lcf::DBArray<int32_t>::const_iterator& it);
259260

260261
void SetSubcommandIndex(int indent, int idx);
261262
uint8_t& ReserveSubcommandIndex(int indent);

0 commit comments

Comments
 (0)