diff options
Diffstat (limited to 'pokescripting/TimeWrapper.h')
| -rw-r--r-- | pokescripting/TimeWrapper.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pokescripting/TimeWrapper.h b/pokescripting/TimeWrapper.h index f82aa229..b8ae979f 100644 --- a/pokescripting/TimeWrapper.h +++ b/pokescripting/TimeWrapper.h @@ -31,12 +31,18 @@ class POKESCRIPTING_EXPORT TimeWrapper : public ObjectWrapper Q_OBJECT public: - TimeWrapper(const Pokemod::Time* time, QObject* parent); + static TimeWrapper* create(const Pokemod::Time* time, QObject* parent) + { + if (!m_instances.contains(time->id())) + m_instances[time->id()] = new TimeWrapper(time, parent); + return qobject_cast<TimeWrapper*>(m_instances[time->id()]); + } public slots: QString name() const; int hour() const; int minute() const; private: + TimeWrapper(const Pokemod::Time* time, QObject* parent); TimeWrapper& operator=(const TimeWrapper& rhs); const Pokemod::Time* m_time; |
