diff options
Diffstat (limited to 'pokescripting/CoinListObjectWrapper.cpp')
| -rw-r--r-- | pokescripting/CoinListObjectWrapper.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pokescripting/CoinListObjectWrapper.cpp b/pokescripting/CoinListObjectWrapper.cpp index 06ab5dc8..fc33444d 100644 --- a/pokescripting/CoinListObjectWrapper.cpp +++ b/pokescripting/CoinListObjectWrapper.cpp @@ -19,16 +19,23 @@ #include "CoinListObjectWrapper.h" // Pokescripting includes -#include "ItemWrapper.h" -#include "SpeciesWrapper.h" +#include "CoinListWrapper.h" +#include "PokemodWrapper.h" -Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, QObject* parent) : +Pokescripting::CoinListObjectWrapper* Pokescripting::CoinListObjectWrapper::create(const Pokemod::CoinListObject* object, CoinListWrapper* parent) +{ + if (!m_instances.contains(Signiture(parent, object->id()))) + m_instances[Signiture(parent, object->id())] = new CoinListObjectWrapper(object, parent); + return qobject_cast<CoinListObjectWrapper*>(m_instances[Signiture(parent, object->id())]); +} + +Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, CoinListWrapper* parent) : ObjectWrapper(object, parent), m_object(object) { } -int Pokescripting::CoinListObjectWrapper::type() const +Pokemod::CoinListObject::Type Pokescripting::CoinListObjectWrapper::type() const { return m_object->type(); } @@ -36,14 +43,14 @@ int Pokescripting::CoinListObjectWrapper::type() const Pokescripting::ItemWrapper* Pokescripting::CoinListObjectWrapper::itemObject() { if (m_object->type() == Pokemod::CoinListObject::Item) - return ItemWrapper::create(pokemod()->itemById(m_object->object()), this); + return pokemod()->item(m_object->object()); return NULL; } Pokescripting::SpeciesWrapper* Pokescripting::CoinListObjectWrapper::speciesObject() { if (m_object->type() == Pokemod::CoinListObject::Species) - return SpeciesWrapper::create(pokemod()->speciesById(m_object->object()), this); + return pokemod()->species(m_object->object()); return NULL; } |
