diff --git a/src/otclient/core/thing.cpp b/src/otclient/core/thing.cpp index e0461360..6066047a 100644 --- a/src/otclient/core/thing.cpp +++ b/src/otclient/core/thing.cpp @@ -22,6 +22,7 @@ #include "thing.h" #include "spritemanager.h" +#include "thingstype.h" #include Thing::Thing() : m_id(0) @@ -30,6 +31,7 @@ Thing::Thing() : m_id(0) m_yPattern = 0; m_zPattern = 0; m_animation = 0; + m_type = g_thingsType.getEmptyThingType(); } void Thing::internalDraw(const Point& p, int layers, Otc::SpriteMask mask) diff --git a/src/otclient/core/thingstype.cpp b/src/otclient/core/thingstype.cpp index f569f1d6..0ec5a4d1 100644 --- a/src/otclient/core/thingstype.cpp +++ b/src/otclient/core/thingstype.cpp @@ -26,6 +26,7 @@ #include ThingsType g_thingsType; +ThingType ThingsType::m_emptyThingType; bool ThingsType::load(const std::string& file) { @@ -121,8 +122,7 @@ ThingType *ThingsType::getThingType(uint16 id, Categories category) // assert wrokground if(id >= m_things[category].size()) { //logTraceErrorOnce("got an invalid type"); - static ThingType emptyType; - return &emptyType; + return &m_emptyThingType; } return &m_things[category][id]; diff --git a/src/otclient/core/thingstype.h b/src/otclient/core/thingstype.h index aeef9824..06a3ebd8 100644 --- a/src/otclient/core/thingstype.h +++ b/src/otclient/core/thingstype.h @@ -43,6 +43,7 @@ public: void parseThingType(std::stringstream& fin, ThingType& thingType); + ThingType *getEmptyThingType() { return &m_emptyThingType; } ThingType *getThingType(uint16 id, Categories category); uint32 getSignature() { return m_signature; } @@ -51,6 +52,7 @@ private: uint32 m_signature; ThingTypeList m_things[LastCategory]; + static ThingType m_emptyThingType; }; extern ThingsType g_thingsType;