summaryrefslogtreecommitdiffstats
path: root/pokescripting/SpeciesItemWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/SpeciesItemWrapper.cpp')
-rw-r--r--pokescripting/SpeciesItemWrapper.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/pokescripting/SpeciesItemWrapper.cpp b/pokescripting/SpeciesItemWrapper.cpp
index dcab30a0..23d4afa1 100644
--- a/pokescripting/SpeciesItemWrapper.cpp
+++ b/pokescripting/SpeciesItemWrapper.cpp
@@ -19,9 +19,17 @@
#include "SpeciesItemWrapper.h"
// Pokescripting includes
-#include "ItemWrapper.h"
+#include "PokemodWrapper.h"
+#include "SpeciesWrapper.h"
-Pokescripting::SpeciesItemWrapper::SpeciesItemWrapper(const Pokemod::SpeciesItem* item, QObject* parent) :
+Pokescripting::SpeciesItemWrapper* Pokescripting::SpeciesItemWrapper::create(const Pokemod::SpeciesItem* item, SpeciesWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, item->id())))
+ m_instances[Signiture(parent, item->id())] = new SpeciesItemWrapper(item, parent);
+ return qobject_cast<SpeciesItemWrapper*>(m_instances[Signiture(parent, item->id())]);
+}
+
+Pokescripting::SpeciesItemWrapper::SpeciesItemWrapper(const Pokemod::SpeciesItem* item, SpeciesWrapper* parent) :
ObjectWrapper(item, parent),
m_item(item)
{
@@ -29,7 +37,7 @@ Pokescripting::SpeciesItemWrapper::SpeciesItemWrapper(const Pokemod::SpeciesItem
Pokescripting::ItemWrapper* Pokescripting::SpeciesItemWrapper::item()
{
- return ItemWrapper::create(pokemod()->itemById(m_item->item()), this);
+ return pokemod()->item(m_item->item());
}
int Pokescripting::SpeciesItemWrapper::weight() const