summaryrefslogtreecommitdiffstats
path: root/pokescripting/MapWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting/MapWrapper.cpp')
-rw-r--r--pokescripting/MapWrapper.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/pokescripting/MapWrapper.cpp b/pokescripting/MapWrapper.cpp
index 01b9fc5f..9564a995 100644
--- a/pokescripting/MapWrapper.cpp
+++ b/pokescripting/MapWrapper.cpp
@@ -23,9 +23,16 @@
#include "MapTrainerWrapper.h"
#include "MapWarpWrapper.h"
#include "MapWildListWrapper.h"
-#include "TileWrapper.h"
+#include "PokemodWrapper.h"
-Pokescripting::MapWrapper::MapWrapper(const Pokemod::Map* map, QObject* parent) :
+Pokescripting::MapWrapper* Pokescripting::MapWrapper::create(const Pokemod::Map* map, PokemodWrapper* parent)
+{
+ if (!m_instances.contains(Signiture(parent, map->id())))
+ m_instances[Signiture(parent, map->id())] = new MapWrapper(map, parent);
+ return qobject_cast<MapWrapper*>(m_instances[Signiture(parent, map->id())]);
+}
+
+Pokescripting::MapWrapper::MapWrapper(const Pokemod::Map* map, PokemodWrapper* parent) :
ObjectWrapper(map, parent),
m_map(map)
{
@@ -61,14 +68,14 @@ Pokescripting::MapWarpWrapper* Pokescripting::MapWrapper::flyWarp()
return MapWarpWrapper::create(m_map->warpById(m_map->flyWarp()), this);
}
-int Pokescripting::MapWrapper::type() const
+Pokemod::Map::Type Pokescripting::MapWrapper::type() const
{
return m_map->type();
}
Pokescripting::TileWrapper* Pokescripting::MapWrapper::tile(const int row, const int column)
{
- return TileWrapper::create(pokemod()->tileById(m_map->tile(row, column)), this);
+ return pokemod()->tile(m_map->tile(row, column));
}
QPoint Pokescripting::MapWrapper::mapSize() const