diff options
Diffstat (limited to 'pokescripting/StoreWrapper.h')
| -rw-r--r-- | pokescripting/StoreWrapper.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pokescripting/StoreWrapper.h b/pokescripting/StoreWrapper.h index cadc527b..09132982 100644 --- a/pokescripting/StoreWrapper.h +++ b/pokescripting/StoreWrapper.h @@ -31,11 +31,17 @@ class POKESCRIPTING_EXPORT StoreWrapper : public ObjectWrapper Q_OBJECT public: - StoreWrapper(const Pokemod::Store* store, QObject* parent); + static StoreWrapper* create(const Pokemod::Store* store, QObject* parent) + { + if (!m_instances.contains(store->id())) + m_instances[store->id()] = new StoreWrapper(store, parent); + return qobject_cast<StoreWrapper*>(m_instances[store->id()]); + } public slots: QString name() const; bool item(const int item) const; private: + StoreWrapper(const Pokemod::Store* store, QObject* parent); StoreWrapper& operator=(const StoreWrapper& rhs); const Pokemod::Store* m_store; |
