diff options
Diffstat (limited to 'pokescripting/BadgeWrapper.cpp')
| -rw-r--r-- | pokescripting/BadgeWrapper.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pokescripting/BadgeWrapper.cpp b/pokescripting/BadgeWrapper.cpp index 7fdcfef7..0d495a15 100644 --- a/pokescripting/BadgeWrapper.cpp +++ b/pokescripting/BadgeWrapper.cpp @@ -19,9 +19,16 @@ #include "BadgeWrapper.h" // Pokescripting includes -#include "SpriteWrapper.h" +#include "PokemodWrapper.h" -Pokescripting::BadgeWrapper::BadgeWrapper(const Pokemod::Badge* badge, QObject* parent) : +Pokescripting::BadgeWrapper* Pokescripting::BadgeWrapper::create(const Pokemod::Badge* badge, PokemodWrapper* parent) +{ + if (!m_instances.contains(Signiture(parent, badge->id()))) + m_instances[Signiture(parent, badge->id())] = new BadgeWrapper(badge, parent); + return qobject_cast<BadgeWrapper*>(m_instances[Signiture(parent, badge->id())]); +} + +Pokescripting::BadgeWrapper::BadgeWrapper(const Pokemod::Badge* badge, PokemodWrapper* parent) : ObjectWrapper(badge, parent), m_badge(badge) { @@ -34,12 +41,12 @@ QString Pokescripting::BadgeWrapper::name() const Pokescripting::SpriteWrapper* Pokescripting::BadgeWrapper::face() { - return SpriteWrapper::create(pokemod()->spriteById(m_badge->face()), this); + return pokemod()->sprite(m_badge->face()); } Pokescripting::SpriteWrapper* Pokescripting::BadgeWrapper::badge() { - return SpriteWrapper::create(pokemod()->spriteById(m_badge->badge()), this); + return pokemod()->sprite(m_badge->badge()); } int Pokescripting::BadgeWrapper::obey() const @@ -47,7 +54,7 @@ int Pokescripting::BadgeWrapper::obey() const return m_badge->obey(); } -Pokemod::Fraction Pokescripting::BadgeWrapper::stat(const int stat) const +Pokemod::Fraction Pokescripting::BadgeWrapper::stat(const Pokemod::Stat stat) const { return m_badge->stat(stat); } |
