summaryrefslogtreecommitdiffstats
path: root/pokescripting/CoinListObjectWrapper.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-08-18 18:51:31 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-08-18 18:51:31 +0000
commitc1793a87ebea8c8e1bb2d5d1a409d105bfae3871 (patch)
treeb7ff53cf9747ad61a80b169e1adad96950f4b16c /pokescripting/CoinListObjectWrapper.cpp
parentfa4764c9e4d86fdfa976bb9fa9f6976e82c496d5 (diff)
downloadsigen-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/CoinListObjectWrapper.cpp')
-rw-r--r--pokescripting/CoinListObjectWrapper.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/pokescripting/CoinListObjectWrapper.cpp b/pokescripting/CoinListObjectWrapper.cpp
index 06ab5dc8..fc33444d 100644
--- a/pokescripting/CoinListObjectWrapper.cpp
+++ b/pokescripting/CoinListObjectWrapper.cpp
@@ -19,16 +19,23 @@
#include "CoinListObjectWrapper.h"
// Pokescripting includes
-#include "ItemWrapper.h"
-#include "SpeciesWrapper.h"
+#include "CoinListWrapper.h"
+#include "PokemodWrapper.h"
-Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, QObject* parent) :
+Pokescripting::CoinListObjectWrapper* Pokescripting::CoinListObjectWrapper::create(const Pokemod::CoinListObject* object, CoinListWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, object->id())))
+ m_instances[Signiture(parent, object->id())] = new CoinListObjectWrapper(object, parent);
+ return qobject_cast<CoinListObjectWrapper*>(m_instances[Signiture(parent, object->id())]);
+}
+
+Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, CoinListWrapper* parent) :
ObjectWrapper(object, parent),
m_object(object)
{
}
-int Pokescripting::CoinListObjectWrapper::type() const
+Pokemod::CoinListObject::Type Pokescripting::CoinListObjectWrapper::type() const
{
return m_object->type();
}
@@ -36,14 +43,14 @@ int Pokescripting::CoinListObjectWrapper::type() const
Pokescripting::ItemWrapper* Pokescripting::CoinListObjectWrapper::itemObject()
{
if (m_object->type() == Pokemod::CoinListObject::Item)
- return ItemWrapper::create(pokemod()->itemById(m_object->object()), this);
+ return pokemod()->item(m_object->object());
return NULL;
}
Pokescripting::SpeciesWrapper* Pokescripting::CoinListObjectWrapper::speciesObject()
{
if (m_object->type() == Pokemod::CoinListObject::Species)
- return SpeciesWrapper::create(pokemod()->speciesById(m_object->object()), this);
+ return pokemod()->species(m_object->object());
return NULL;
}