summaryrefslogtreecommitdiffstats
path: root/pokescripting/TrainerWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/TrainerWrapper.cpp')
-rw-r--r--pokescripting/TrainerWrapper.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/pokescripting/TrainerWrapper.cpp b/pokescripting/TrainerWrapper.cpp
index 0c30ceb0..7f19bfb1 100644
--- a/pokescripting/TrainerWrapper.cpp
+++ b/pokescripting/TrainerWrapper.cpp
@@ -19,9 +19,16 @@
#include "TrainerWrapper.h"
// Pokescripting includes
-#include "SkinWrapper.h"
+#include "PokemodWrapper.h"
-Pokescripting::TrainerWrapper::TrainerWrapper(const Pokemod::Trainer* trainer, QObject* parent) :
+Pokescripting::TrainerWrapper* Pokescripting::TrainerWrapper::create(const Pokemod::Trainer* trainer, PokemodWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, trainer->id())))
+ m_instances[Signiture(parent, trainer->id())] = new TrainerWrapper(trainer, parent);
+ return qobject_cast<TrainerWrapper*>(m_instances[Signiture(parent, trainer->id())]);
+}
+
+Pokescripting::TrainerWrapper::TrainerWrapper(const Pokemod::Trainer* trainer, PokemodWrapper* parent) :
ObjectWrapper(trainer, parent),
m_trainer(trainer)
{
@@ -41,7 +48,7 @@ int Pokescripting::TrainerWrapper::TrainerWrapper::moneyFactor() const
Pokescripting::SkinWrapper* Pokescripting::TrainerWrapper::TrainerWrapper::skin()
{
- return SkinWrapper::create(pokemod()->skinById(m_trainer->skin()), this);
+ return pokemod()->skin(m_trainer->skin());
}
int Pokescripting::TrainerWrapper::TrainerWrapper::depth() const
@@ -51,27 +58,27 @@ int Pokescripting::TrainerWrapper::TrainerWrapper::depth() const
return m_trainer->depth();
}
-int Pokescripting::TrainerWrapper::TrainerWrapper::teamIntel() const
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::TrainerWrapper::teamIntel() const
{
return m_trainer->teamIntel();
}
-int Pokescripting::TrainerWrapper::TrainerWrapper::moveIntel() const
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::TrainerWrapper::moveIntel() const
{
return m_trainer->moveIntel();
}
-int Pokescripting::TrainerWrapper::TrainerWrapper::itemIntel() const
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::TrainerWrapper::itemIntel() const
{
return m_trainer->itemIntel();
}
-int Pokescripting::TrainerWrapper::TrainerWrapper::abilityIntel() const
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::TrainerWrapper::abilityIntel() const
{
return m_trainer->abilityIntel();
}
-int Pokescripting::TrainerWrapper::TrainerWrapper::statIntel() const
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::TrainerWrapper::statIntel() const
{
return m_trainer->statIntel();
}