add empty thing type
This commit is contained in:
parent
3e27d5a79f
commit
19eb56997d
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "thing.h"
|
||||
#include "spritemanager.h"
|
||||
#include "thingstype.h"
|
||||
#include <framework/graphics/graphics.h>
|
||||
|
||||
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)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <framework/core/resourcemanager.h>
|
||||
|
||||
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];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue