diff options
Diffstat (limited to 'pokescripting/StoreWrapper.cpp')
| -rw-r--r-- | pokescripting/StoreWrapper.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pokescripting/StoreWrapper.cpp b/pokescripting/StoreWrapper.cpp index cb368703..111d0bd0 100644 --- a/pokescripting/StoreWrapper.cpp +++ b/pokescripting/StoreWrapper.cpp @@ -19,9 +19,16 @@ #include "StoreWrapper.h" // Pokescripting includes -#include "ItemWrapper.h" +#include "PokemodWrapper.h" -Pokescripting::StoreWrapper::StoreWrapper(const Pokemod::Store* store, QObject* parent) : +Pokescripting::StoreWrapper* Pokescripting::StoreWrapper::create(const Pokemod::Store* store, PokemodWrapper* parent) +{ + if (!m_instances.contains(Signiture(parent, store->id()))) + m_instances[Signiture(parent, store->id())] = new StoreWrapper(store, parent); + return qobject_cast<StoreWrapper*>(m_instances[Signiture(parent, store->id())]); +} + +Pokescripting::StoreWrapper::StoreWrapper(const Pokemod::Store* store, PokemodWrapper* parent) : ObjectWrapper(store, parent), m_store(store) { @@ -37,6 +44,6 @@ QList<Pokescripting::ItemWrapper*> Pokescripting::StoreWrapper::items() QList<int> itemIds = m_store->items(); QList<ItemWrapper*> items; foreach (int id, itemIds) - items.append(ItemWrapper::create(pokemod()->itemById(id), this)); + items.append(pokemod()->item(id)); return items; } |
