Always call ReadLcf even if len is 0
This correctly resets the System::party array from it's
default of { 1 }, to {} when the ldb file has a 0 sized starting party.
MODIFY
src/lmu_movecommand.cpp
src/lmu_movecommand.cpp
#include "rpg_movecommand.h"
#include "reader_struct.h"
+#include <iostream>
template <>
struct RawStruct<RPG::MoveCommand> {
@@ -174,11 +175,11 @@ void RawStruct<RPG::MoveCommand>::BeginXml(RPG::MoveCommand& ref, XmlReader& str
void RawStruct<std::vector<RPG::MoveCommand> >::ReadLcf(std::vector<RPG::MoveCommand>& ref, LcfReader& stream, uint32_t length) {
unsigned long startpos = stream.Tell();
unsigned long endpos = startpos + length;
- do {
+ while (stream.Tell() != endpos) {
RPG::MoveCommand command;
RawStruct<RPG::MoveCommand>::ReadLcf(command, stream, 0);
ref.push_back(command);
- } while (stream.Tell() != endpos);
+ }
}
void RawStruct<std::vector<RPG::MoveCommand> >::WriteLcf(const std::vector<RPG::MoveCommand>& ref, LcfWriter& stream) {

MODIFY
src/reader_struct.cpp
src/reader_struct.cpp
@@ -65,10 +65,8 @@ void Struct<S>::ReadLcf(S& obj, LcfReader& stream) {
break;
chunk_info.length = stream.ReadInt();
- if (chunk_info.length == 0)
- continue;
- typename field_map_type::const_iterator it = field_map.find(chunk_info.ID);
+ auto it = field_map.find(chunk_info.ID);
if (it != field_map.end()) {
#ifdef LCF_DEBUG_TRACE
printf("0x%02x (size: %d, pos: 0x%x): %s\n", chunk_info.ID, chunk_info.length, stream.Tell(), it->second->name);

Always call ReadLcf even if len is 0

This correctly resets the System::party array from it's
default of { 1 }, to {} when the ldb file has a 0 sized starting party.