summaryrefslogtreecommitdiffstats
path: root/pokescripting/SpriteWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/SpriteWrapper.cpp')
-rw-r--r--pokescripting/SpriteWrapper.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/pokescripting/SpriteWrapper.cpp b/pokescripting/SpriteWrapper.cpp
index 7c0bc396..47fd585b 100644
--- a/pokescripting/SpriteWrapper.cpp
+++ b/pokescripting/SpriteWrapper.cpp
@@ -18,7 +18,17 @@
// Header include
#include "SpriteWrapper.h"
-Pokescripting::SpriteWrapper::SpriteWrapper(const Pokemod::Sprite* sprite, QObject* parent) :
+// Pokescripting includes
+#include "PokemodWrapper.h"
+
+Pokescripting::SpriteWrapper* Pokescripting::SpriteWrapper::create(const Pokemod::Sprite* sprite, PokemodWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, sprite->id())))
+ m_instances[Signiture(parent, sprite->id())] = new SpriteWrapper(sprite, parent);
+ return qobject_cast<SpriteWrapper*>(m_instances[Signiture(parent, sprite->id())]);
+}
+
+Pokescripting::SpriteWrapper::SpriteWrapper(const Pokemod::Sprite* sprite, PokemodWrapper* parent) :
ObjectWrapper(sprite, parent),
m_sprite(sprite)
{