diff options
Diffstat (limited to 'pokescripting/MapWrapper.h')
| -rw-r--r-- | pokescripting/MapWrapper.h | 89 |
1 files changed, 12 insertions, 77 deletions
diff --git a/pokescripting/MapWrapper.h b/pokescripting/MapWrapper.h index 50cd207b..573dce4d 100644 --- a/pokescripting/MapWrapper.h +++ b/pokescripting/MapWrapper.h @@ -19,18 +19,20 @@ #define __POKESCRIPTING_MAPWRAPPER__ // Pokescripting includes -#include "MapEffectWrapper.h" -#include "MapTrainerWrapper.h" -#include "MapWarpWrapper.h" -#include "MapWildListWrapper.h" #include "ObjectWrapper.h" -#include "TileWrapper.h" // Pokemod includes #include "../pokemod/Map.h" namespace Pokescripting { +// Forward declarations +class MapEffectWrapper; +class MapTrainerWrapper; +class MapWarpWrapper; +class MapWildListWrapper; +class TileWrapper; + class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper { Q_OBJECT @@ -42,6 +44,11 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper m_instances[map->id()] = new MapWrapper(map, parent); return qobject_cast<MapWrapper*>(m_instances[map->id()]); } + + MapEffectWrapper* effect(const int id); + MapTrainerWrapper* trainer(const int id); + MapWarpWrapper* warp(const int id); + MapWildListWrapper* wildList(const int id); public slots: QString name() const; MapWarpWrapper* flyWarp(); @@ -59,78 +66,6 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper const Pokemod::Map* m_map; }; - -inline MapWrapper::MapWrapper(const Pokemod::Map* map, QObject* parent) : - ObjectWrapper(map, parent), - m_map(map) -{ -} - -inline QString MapWrapper::name() const -{ - return m_map->name(); -} - -inline MapWarpWrapper* MapWrapper::flyWarp() -{ - return MapWarpWrapper::create(m_map->warpById(m_map->flyWarp()), this); -} - -inline int MapWrapper::type() const -{ - return m_map->type(); -} - -inline TileWrapper* MapWrapper::tile(const int row, const int column) -{ - return TileWrapper::create(pokemod()->tileById(m_map->tile(row, column)), this); -} - -inline QPoint MapWrapper::mapSize() const -{ - return m_map->size(); -} - -inline MapEffectWrapper* MapWrapper::effect(const QString& name) -{ - for (int i = 0; i < m_map->effectCount(); ++i) - { - if (m_map->effect(i)->name() == name) - return MapEffectWrapper::create(m_map->effect(i), this); - } - return NULL; -} - -inline MapTrainerWrapper* MapWrapper::trainer(const QString& name) -{ - for (int i = 0; i < m_map->trainerCount(); ++i) - { - if (m_map->trainer(i)->name() == name) - return MapTrainerWrapper::create(m_map->trainer(i), this); - } - return NULL; -} - -inline MapWarpWrapper* MapWrapper::warp(const QString& name) -{ - for (int i = 0; i < m_map->warpCount(); ++i) - { - if (m_map->warp(i)->name() == name) - return MapWarpWrapper::create(m_map->warp(i), this); - } - return NULL; -} - -inline MapWildListWrapper* MapWrapper::wildList(const QString& name) -{ - for (int i = 0; i < m_map->wildListCount(); ++i) - { - if (m_map->wildList(i)->name() == name) - return MapWildListWrapper::create(m_map->wildList(i), this); - } - return NULL; -} - } #endif |
