void RawStruct<RPG::TreeMap>::WriteLcf(const RPG::TreeMap& ref, LcfWriter& stream) { Struct<RPG::MapInfo>::WriteLcf(ref.maps, stream); int count = ref.tree_order.size(); stream.WriteInt(count); for (int i = 0; i < count; i++) stream.WriteInt(ref.tree_order[i]); stream.WriteInt(ref.active_node); Struct<RPG::Start>::WriteLcf(ref.start, stream); }
void RawStruct<std::vector<RPG::EventCommand> >::WriteLcf(const std::vector<RPG::EventCommand>& event_commands, LcfWriter& stream) { int count = event_commands.size(); for (int i = 0; i < count; i++) RawStruct<RPG::EventCommand>::WriteLcf(event_commands[i], stream); for (int i = 0; i < 4; i++) stream.WriteInt(0); }
void Struct<S>::WriteLcf(const std::vector<S>& vec, LcfWriter& stream) { int count = vec.size(); stream.WriteInt(count); for (int i = 0; i < count; i++) { IDReader::WriteID(vec[i], stream); TypeReader<S>::WriteLcf(vec[i], stream); } }
void RawStruct<RPG::EventCommand>::WriteLcf(const RPG::EventCommand& event_command, LcfWriter& stream) { stream.Write(event_command.code); stream.Write(event_command.indent); stream.WriteInt(stream.Decode(event_command.string).size()); stream.Write(stream.Decode(event_command.string)); int count = event_command.parameters.size(); stream.Write(count); for (int i = 0; i < count; i++) stream.Write(event_command.parameters[i]); }
void Struct<RPG::Save>::WriteLcf(const RPG::Save& obj, LcfWriter& stream) { RPG::Save ref = RPG::Save(); int last = -1; for (int i = 0; fields[i] != NULL; i++) { const Field<RPG::Save>* field = fields[i]; if (field->id < last) std::cerr << "field order mismatch: " << field->id << " after " << last << " in struct " << name << std::endl; printf("\n%s", field->name); if (field->IsDefault(obj, ref)) { printf(" -> default"); continue; } stream.WriteInt(field->id); stream.WriteInt(field->LcfSize(obj, stream)); field->WriteLcf(obj, stream); } // stream.WriteInt(0); // This last byte broke savegames }
void Struct<S>::WriteLcf(const S& obj, LcfWriter& stream) { S ref = S(); int last = -1; for (int i = 0; fields[i] != NULL; i++) { const Field<S>* field = fields[i]; if (field->id < last) std::cerr << "field order mismatch: " << field->id << " after " << last << " in struct " << name << std::endl; //printf("\n%s", field->name); if (field->IsDefault(obj, ref)) { //printf(" -> default"); continue; } stream.WriteInt(field->id); stream.WriteInt(field->LcfSize(obj, stream)); field->WriteLcf(obj, stream); } stream.WriteInt(0); }
void RawStruct<RPG::MoveCommand>::WriteLcf(const RPG::MoveCommand& ref, LcfWriter& stream) { stream.WriteInt(ref.command_id); switch (ref.command_id) { case RPG::MoveCommand::Code::switch_on: stream.Write(ref.parameter_a); break; case RPG::MoveCommand::Code::switch_off: stream.Write(ref.parameter_a); break; case RPG::MoveCommand::Code::change_graphic: stream.WriteInt(stream.Decode(ref.parameter_string).size()); stream.Write(ref.parameter_string); stream.Write(ref.parameter_a); break; case RPG::MoveCommand::Code::play_sound_effect: stream.WriteInt(stream.Decode(ref.parameter_string).size()); stream.Write(ref.parameter_string); stream.Write(ref.parameter_a); stream.Write(ref.parameter_b); stream.Write(ref.parameter_c); break; } }