diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 18:51:31 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 18:51:31 +0000 |
| commit | c1793a87ebea8c8e1bb2d5d1a409d105bfae3871 (patch) | |
| tree | b7ff53cf9747ad61a80b169e1adad96950f4b16c /pokescripting/BadgeWrapper.cpp | |
| parent | fa4764c9e4d86fdfa976bb9fa9f6976e82c496d5 (diff) | |
| download | sigen-c1793a87ebea8c8e1bb2d5d1a409d105bfae3871.tar.gz sigen-c1793a87ebea8c8e1bb2d5d1a409d105bfae3871.tar.xz sigen-c1793a87ebea8c8e1bb2d5d1a409d105bfae3871.zip | |
[FIX] Script to make a tarball now defaults to HEAD for the revision
[FIX] Enumeration types used to help remove some checks
[FIX] Macro code moved to static members of Object (not all though)
[FIX] Scripting wrappers now share information by keeping track of already-created instances of the wrapper
[FIX] Scripting methods are now Q_SCRIPTABLE and not slots
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@239 6ecfd1a5-f3ed-3746-8530-beee90d26b22
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); } |
