diff options
Diffstat (limited to 'pokescripting/SpeciesWrapper.cpp')
| -rw-r--r-- | pokescripting/SpeciesWrapper.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/pokescripting/SpeciesWrapper.cpp b/pokescripting/SpeciesWrapper.cpp index 9c2737e4..23f76082 100644 --- a/pokescripting/SpeciesWrapper.cpp +++ b/pokescripting/SpeciesWrapper.cpp @@ -19,17 +19,19 @@ #include "SpeciesWrapper.h" // Pokescripting includes -#include "AbilityWrapper.h" -#include "EggGroupWrapper.h" -#include "ItemWrapper.h" -#include "SkinWrapper.h" +#include "PokemodWrapper.h" #include "SpeciesAbilityWrapper.h" #include "SpeciesItemWrapper.h" #include "SpeciesMoveWrapper.h" -#include "SpriteWrapper.h" -#include "TypeWrapper.h" -Pokescripting::SpeciesWrapper::SpeciesWrapper(const Pokemod::Species* species, QObject* parent) : +Pokescripting::SpeciesWrapper* Pokescripting::SpeciesWrapper::create(const Pokemod::Species* species, PokemodWrapper* parent) +{ + if (!m_instances.contains(Signiture(parent, species->id()))) + m_instances[Signiture(parent, species->id())] = new SpeciesWrapper(species, parent); + return qobject_cast<SpeciesWrapper*>(m_instances[Signiture(parent, species->id())]); +} + +Pokescripting::SpeciesWrapper::SpeciesWrapper(const Pokemod::Species* species, PokemodWrapper* parent) : ObjectWrapper(species, parent), m_species(species) { @@ -56,17 +58,17 @@ QString Pokescripting::SpeciesWrapper::name() const return m_species->name(); } -int Pokescripting::SpeciesWrapper::baseStat(const int stat) const +int Pokescripting::SpeciesWrapper::baseStat(const Pokemod::Stat stat) const { return m_species->baseStat(stat); } -int Pokescripting::SpeciesWrapper::effortValue(const int stat) const +int Pokescripting::SpeciesWrapper::effortValue(const Pokemod::Stat stat) const { return m_species->effortValue(stat); } -int Pokescripting::SpeciesWrapper::growth() const +Pokemod::Species::Style Pokescripting::SpeciesWrapper::growth() const { return m_species->growth(); } @@ -124,27 +126,27 @@ QString Pokescripting::SpeciesWrapper::pokedexEntry() const Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::frontMaleSprite() { - return SpriteWrapper::create(pokemod()->spriteById(m_species->frontMaleSprite()), this); + return pokemod()->sprite(m_species->frontMaleSprite()); } Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::backMaleSprite() { - return SpriteWrapper::create(pokemod()->spriteById(m_species->backMaleSprite()), this); + return pokemod()->sprite(m_species->backMaleSprite()); } Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::frontFemaleSprite() { - return SpriteWrapper::create(pokemod()->spriteById(m_species->frontFemaleSprite()), this); + return pokemod()->sprite(m_species->frontFemaleSprite()); } Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::backFemaleSprite() { - return SpriteWrapper::create(pokemod()->spriteById(m_species->backFemaleSprite()), this); + return pokemod()->sprite(m_species->backFemaleSprite()); } Pokescripting::SkinWrapper* Pokescripting::SpeciesWrapper::skin() { - return SkinWrapper::create(pokemod()->skinById(m_species->skin()), this); + return pokemod()->skin(m_species->skin()); } Pokemod::Fraction Pokescripting::SpeciesWrapper::genderFactor() const @@ -169,7 +171,7 @@ QList<Pokescripting::TypeWrapper*> Pokescripting::SpeciesWrapper::types() QList<int> typeIds = m_species->types(); QList<TypeWrapper*> types; foreach (int id, typeIds) - types.append(TypeWrapper::create(pokemod()->typeById(id), this)); + types.append(pokemod()->type(id)); return types; } @@ -178,7 +180,7 @@ QList<Pokescripting::EggGroupWrapper*> Pokescripting::SpeciesWrapper::eggGroups( QList<int> eggGroupIds = m_species->eggGroups(); QList<EggGroupWrapper*> eggGroups; foreach (int id, eggGroupIds) - eggGroups.append(EggGroupWrapper::create(pokemod()->eggGroupById(id), this)); + eggGroups.append(pokemod()->eggGroup(id)); return eggGroups; } |
