10#include "lcf/rpg/movecommand.h"
39 const auto cmd =
static_cast<rpg::MoveCommand::Code
>(
ref.command_id);
41 case rpg::MoveCommand::Code::switch_on:
44 case rpg::MoveCommand::Code::switch_off:
47 case rpg::MoveCommand::Code::change_graphic:
51 case rpg::MoveCommand::Code::play_sound_effect:
63 const auto cmd =
static_cast<rpg::MoveCommand::Code
>(
ref.command_id);
65 case rpg::MoveCommand::Code::switch_on:
68 case rpg::MoveCommand::Code::switch_off:
71 case rpg::MoveCommand::Code::change_graphic:
76 case rpg::MoveCommand::Code::play_sound_effect:
89 result += LcfReader::IntSize(
ref.command_id);
90 const auto cmd =
static_cast<rpg::MoveCommand::Code
>(
ref.command_id);
92 case rpg::MoveCommand::Code::switch_on:
93 result += LcfReader::IntSize(
ref.parameter_a);
95 case rpg::MoveCommand::Code::switch_off:
96 result += LcfReader::IntSize(
ref.parameter_a);
98 case rpg::MoveCommand::Code::change_graphic:
99 result += LcfReader::IntSize(
stream.Decode(
ref.parameter_string).size());
101 result += LcfReader::IntSize(
ref.parameter_a);
103 case rpg::MoveCommand::Code::play_sound_effect:
104 result += LcfReader::IntSize(
stream.Decode(
ref.parameter_string).size());
106 result += LcfReader::IntSize(
ref.parameter_a);
107 result += LcfReader::IntSize(
ref.parameter_b);
108 result += LcfReader::IntSize(
ref.parameter_c);
116 stream.BeginElement(
"MoveCommand");
117 stream.WriteNode(
"command_id",
ref.command_id);
118 const auto cmd =
static_cast<rpg::MoveCommand::Code
>(
ref.command_id);
120 case rpg::MoveCommand::Code::switch_on:
121 stream.WriteNode(
"parameter_a",
ref.parameter_a);
123 case rpg::MoveCommand::Code::switch_off:
124 stream.WriteNode(
"parameter_a",
ref.parameter_a);
126 case rpg::MoveCommand::Code::change_graphic:
127 stream.WriteNode(
"parameter_string",
ref.parameter_string);
128 stream.WriteNode(
"parameter_a",
ref.parameter_a);
130 case rpg::MoveCommand::Code::play_sound_effect:
131 stream.WriteNode(
"parameter_string",
ref.parameter_string);
132 stream.WriteNode(
"parameter_a",
ref.parameter_a);
133 stream.WriteNode(
"parameter_b",
ref.parameter_b);
134 stream.WriteNode(
"parameter_c",
ref.parameter_c);
138 stream.EndElement(
"MoveCommand");
150 if (
strcmp(name,
"command_id") == 0)
152 else if (
strcmp(name,
"parameter_a") == 0)
154 else if (
strcmp(name,
"parameter_b") == 0)
156 else if (
strcmp(name,
"parameter_c") == 0)
158 else if (
strcmp(name,
"parameter_string") == 0)
161 stream.Error(
"Unrecognized field '%s'", name);
174 XmlReader::Read(
ref.parameter_string,
data);
196 std::vector<rpg::MoveCommand>::const_iterator
it;
197 for (
it = ref.begin();
it != ref.end();
it++)
203 std::vector<rpg::MoveCommand>::const_iterator
it;
204 for (
it = ref.begin();
it != ref.end();
it++)
210 std::vector<rpg::MoveCommand>::const_iterator
it;
211 for (
it = ref.begin();
it != ref.end();
it++)
220 if (
strcmp(name,
"MoveCommand") != 0)
221 stream.Error(
"Expecting %s but got %s",
"MoveCommand", name);
222 ref.resize(
ref.size() + 1);
223 rpg::MoveCommand& obj =
ref.back();
227 std::vector<rpg::MoveCommand>&
ref;
std::vector< rpg::MoveCommand > & ref
void StartElement(XmlReader &stream, const char *name, const char **)
MoveCommandVectorXmlHandler(std::vector< rpg::MoveCommand > &ref)
void CharacterData(XmlReader &, const std::string &data)
void EndElement(XmlReader &, const char *)
MoveCommandXmlHandler(rpg::MoveCommand &ref)
void StartElement(XmlReader &stream, const char *name, const char **)
RootXmlHandler(S &ref, const char *const name)
static void WriteXml(const T &ref, XmlWriter &stream)
static void BeginXml(T &ref, XmlReader &stream)
static void ReadLcf(T &ref, LcfReader &stream, uint32_t length)
static void WriteLcf(const T &ref, LcfWriter &stream)
static int LcfSize(const T &ref, LcfWriter &stream)