From c1793a87ebea8c8e1bb2d5d1a409d105bfae3871 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 18 Aug 2008 18:51:31 +0000 Subject: [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 --- pokescripting/CoinListObjectWrapper.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'pokescripting/CoinListObjectWrapper.cpp') 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(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; } -- cgit