diff options
Diffstat (limited to 'pokescripting/ObjectWrapper.cpp')
| -rw-r--r-- | pokescripting/ObjectWrapper.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/pokescripting/ObjectWrapper.cpp b/pokescripting/ObjectWrapper.cpp index 1158c46f..d1af3220 100644 --- a/pokescripting/ObjectWrapper.cpp +++ b/pokescripting/ObjectWrapper.cpp @@ -18,9 +18,12 @@ // Header include #include "ObjectWrapper.h" -QMap<int, Pokescripting::ObjectWrapper*> Pokescripting::ObjectWrapper::m_instances; +// Pokescripting includes +#include "PokemodWrapper.h" -Pokescripting::ObjectWrapper::ObjectWrapper(const Pokemod::Object* object, QObject* parent) : +QMap<Pokescripting::ObjectWrapper::Signiture, Pokescripting::ObjectWrapper*> Pokescripting::ObjectWrapper::m_instances; + +Pokescripting::ObjectWrapper::ObjectWrapper(const Pokemod::Object* object, ObjectWrapper* parent) : Config(parent), m_object(object) { @@ -31,7 +34,26 @@ int Pokescripting::ObjectWrapper::id() const return m_object->id(); } -const Pokemod::Pokemod* Pokescripting::ObjectWrapper::pokemod() const +const Pokescripting::ObjectWrapper* Pokescripting::ObjectWrapper::parent() const +{ + return m_parent; +} + +Pokescripting::ObjectWrapper* Pokescripting::ObjectWrapper::parent() +{ + return m_parent; +} + +const Pokescripting::PokemodWrapper* Pokescripting::ObjectWrapper::pokemod() const +{ + if (m_parent) + return m_parent->pokemod(); + return qobject_cast<const PokemodWrapper*>(m_parent); +} + +Pokescripting::PokemodWrapper* Pokescripting::ObjectWrapper::pokemod() { - return qobject_cast<const Pokemod::Pokemod*>(m_object->pokemod()); + if (m_parent) + return m_parent->pokemod(); + return qobject_cast<PokemodWrapper*>(m_parent); } |
