summaryrefslogtreecommitdiffstats
path: root/pokescripting/WeatherWrapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/WeatherWrapper.h')
-rw-r--r--pokescripting/WeatherWrapper.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/pokescripting/WeatherWrapper.h b/pokescripting/WeatherWrapper.h
index 6de468fe..29b11740 100644
--- a/pokescripting/WeatherWrapper.h
+++ b/pokescripting/WeatherWrapper.h
@@ -31,10 +31,16 @@ class POKESCRIPTING_EXPORT WeatherWrapper : public ObjectWrapper
Q_OBJECT
public:
- WeatherWrapper(const Pokemod::Weather* weather, QObject* parent);
+ static WeatherWrapper* create(const Pokemod::Weather* weather, QObject* parent)
+ {
+ if (!m_instances.contains(weather->id()))
+ m_instances[weather->id()] = new WeatherWrapper(weather, parent);
+ return qobject_cast<WeatherWrapper*>(m_instances[weather->id()]);
+ }
public slots:
QString name() const;
private:
+ WeatherWrapper(const Pokemod::Weather* weather, QObject* parent);
WeatherWrapper& operator=(const WeatherWrapper& rhs);
const Pokemod::Weather* m_weather;