26 static void ReadLcf(std::vector<RPG::EventCommand>& ref,
LcfReader& stream, uint32_t length);
27 static void WriteLcf(
const std::vector<RPG::EventCommand>& ref,
LcfWriter& stream);
28 static int LcfSize(
const std::vector<RPG::EventCommand>& ref,
LcfWriter& stream);
29 static void WriteXml(
const std::vector<RPG::EventCommand>& ref,
XmlWriter& stream);
38 if (event_command.
code != 0) {
45 for (
int i = stream.
ReadInt(); i > 0; i--) {
46 param_buf.push_back(stream.
ReadInt());
48 if (!param_buf.empty()) {
49 event_command.
parameters.reserve(param_buf.size());
50 event_command.
parameters.assign(param_buf.begin(), param_buf.end());
60 int32_t count = (int32_t)event_command.
parameters.size();
62 for (
int i = 0; i < count; i++)
74 for (
int i = 0; i < count; i++)
101 if (strcmp(name,
"code") == 0)
103 else if (strcmp(name,
"indent") == 0)
105 else if (strcmp(name,
"string") == 0)
107 else if (strcmp(name,
"parameters") == 0)
110 stream.
Error(
"Unrecognized field '%s'", name);
145 std::vector<RPG::EventCommand>& event_commands,
LcfReader& stream, uint32_t length) {
148 unsigned long startpos = stream.
Tell();
149 unsigned long endpos = startpos + length;
155 uint8_t ch = (uint8_t)stream.
Peek();
161 if (stream.
Tell() >= endpos) {
163 fprintf(stderr,
"Event command corrupted at %" PRIu32
"\n", stream.
Tell());
175 if (i == 4 || stream.
Eof()) {
185 event_commands.push_back(command);
190 int count = event_commands.size();
191 for (
int i = 0; i < count; i++)
193 for (
int i = 0; i < 4; i++)
199 int count = event_commands.size();
200 for (
int i = 0; i < count; i++)
207 std::vector<RPG::EventCommand>::const_iterator it;
208 for (it = event_commands.begin(); it != event_commands.end(); it++)
217 if (strcmp(name,
"EventCommand") != 0)
218 stream.
Error(
"Expecting %s but got %s",
"EventCommand", name);
219 ref.resize(
ref.size() + 1);
224 std::vector<RPG::EventCommand>&
ref;