diff options
Diffstat (limited to 'pokescripting/ItemWrapper.cpp')
| -rw-r--r-- | pokescripting/ItemWrapper.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pokescripting/ItemWrapper.cpp b/pokescripting/ItemWrapper.cpp index bcb9682a..002efea6 100644 --- a/pokescripting/ItemWrapper.cpp +++ b/pokescripting/ItemWrapper.cpp @@ -19,9 +19,16 @@ #include "ItemWrapper.h" // Pokescripting includes -#include "ItemTypeWrapper.h" +#include "PokemodWrapper.h" -Pokescripting::ItemWrapper::ItemWrapper(const Pokemod::Item* item, QObject* parent) : +Pokescripting::ItemWrapper* Pokescripting::ItemWrapper::create(const Pokemod::Item* item, PokemodWrapper* parent) +{ + if (!m_instances.contains(Signiture(parent, item->id()))) + m_instances[Signiture(parent, item->id())] = new ItemWrapper(item, parent); + return qobject_cast<ItemWrapper*>(m_instances[Signiture(parent, item->id())]); +} + +Pokescripting::ItemWrapper::ItemWrapper(const Pokemod::Item* item, PokemodWrapper* parent) : ObjectWrapper(item, parent), m_item(item) { @@ -39,7 +46,7 @@ bool Pokescripting::ItemWrapper::sellable() const Pokescripting::ItemTypeWrapper* Pokescripting::ItemWrapper::type() { - return ItemTypeWrapper::create(pokemod()->itemTypeById(m_item->type()), this); + return pokemod()->itemType(m_item->type()); } int Pokescripting::ItemWrapper::price() const |
