diff --git a/src/dbstring_struct.cpp b/src/dbstring_struct.cpp index fbe5b8d3..2adbe3a6 100644 --- a/src/dbstring_struct.cpp +++ b/src/dbstring_struct.cpp @@ -66,7 +66,7 @@ class DbStringXmlHandler : public XmlHandler { public: DbStringXmlHandler(DBString& ref) : ref(ref) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* /* name */, const char** /* atts */) { // no-op } void EndElement(XmlReader& /* stream */, const char* /* name */) { diff --git a/src/ldb_equipment.cpp b/src/ldb_equipment.cpp index b5e39687..f94b1336 100644 --- a/src/ldb_equipment.cpp +++ b/src/ldb_equipment.cpp @@ -74,7 +74,7 @@ class EquipmentXmlHandler : public XmlHandler { int16_t* field; public: EquipmentXmlHandler(rpg::Equipment& ref) : ref(ref), field(NULL) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { if (strcmp(name, "weapon_id") == 0) field = &ref.weapon_id; else if (strcmp(name, "shield_id") == 0) diff --git a/src/ldb_eventcommand.cpp b/src/ldb_eventcommand.cpp index 2f292f22..e53f67bd 100644 --- a/src/ldb_eventcommand.cpp +++ b/src/ldb_eventcommand.cpp @@ -99,7 +99,7 @@ class EventCommandXmlHandler : public XmlHandler { } field; public: EventCommandXmlHandler(rpg::EventCommand& ref) : ref(ref), field(None) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { if (strcmp(name, "code") == 0) field = Code; else if (strcmp(name, "indent") == 0) diff --git a/src/ldb_parameters.cpp b/src/ldb_parameters.cpp index 28b8c83f..964f6c41 100644 --- a/src/ldb_parameters.cpp +++ b/src/ldb_parameters.cpp @@ -65,7 +65,7 @@ class ParametersXmlHandler : public XmlHandler { std::vector* field; public: ParametersXmlHandler(rpg::Parameters& ref) : ref(ref), field(NULL) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { if (strcmp(name, "maxhp") == 0) field = &ref.maxhp; else if (strcmp(name, "maxsp") == 0) diff --git a/src/lmt_rect.cpp b/src/lmt_rect.cpp index 12ec5c5f..c8885be0 100644 --- a/src/lmt_rect.cpp +++ b/src/lmt_rect.cpp @@ -60,7 +60,7 @@ class RectXmlHandler : public XmlHandler { uint32_t* field; public: RectXmlHandler(rpg::Rect& ref) : ref(ref), field(NULL) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { if (strcmp(name, "l") == 0) field = &ref.l; else if (strcmp(name, "t") == 0) diff --git a/src/lmu_movecommand.cpp b/src/lmu_movecommand.cpp index 3d532d84..1efd2925 100644 --- a/src/lmu_movecommand.cpp +++ b/src/lmu_movecommand.cpp @@ -146,7 +146,7 @@ class MoveCommandXmlHandler : public XmlHandler { public: MoveCommandXmlHandler(rpg::MoveCommand& ref) : ref(ref), field(NULL), parameter_string(false) {} - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { if (strcmp(name, "command_id") == 0) field = &ref.command_id; else if (strcmp(name, "parameter_a") == 0) diff --git a/src/reader_flags.cpp b/src/reader_flags.cpp index ace0190b..79327ef7 100644 --- a/src/reader_flags.cpp +++ b/src/reader_flags.cpp @@ -115,7 +115,7 @@ class FlagsXmlHandler : public XmlHandler { FlagsXmlHandler(S& obj) : obj(obj), field(NULL) { } - void StartElement(XmlReader& stream, const char* name, const char** /* atts */) { + void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) { const auto idx = Flags::idx(name); if (idx < 0) { Log::Error("XML: Unrecognized field '%s'", name); diff --git a/src/reader_struct.h b/src/reader_struct.h index 05551e46..d247714a 100644 --- a/src/reader_struct.h +++ b/src/reader_struct.h @@ -196,7 +196,7 @@ struct Primitive { if (dif != 0) { // Fix incorrect read pointer position - Log::Warning("Invalid %s at %" PRIX32 "", typeid(T).name(), stream.Tell()); + Log::Warning("Invalid Primitive at %" PRIX32 "", stream.Tell()); stream.Seek(dif, LcfReader::FromCurrent); } } @@ -267,13 +267,17 @@ struct Primitive { ref = stream.ReadInt(); #ifdef LCF_DEBUG_TRACE fprintf(stderr, " %d\n", ref); +#endif + } else if (length == 0) { + ref = 0; +#ifdef LCF_DEBUG_TRACE + fprintf(stderr, " %d\n", ref); #endif } else { ref = 0; Log::Warning("Invalid integer at %X", stream.Tell()); stream.Seek(length, LcfReader::FromCurrent); } - } static void WriteLcf(const int32_t& ref, LcfWriter& stream) { stream.WriteInt(ref);