summaryrefslogtreecommitdiffstats
path: root/sigmod/MapWarp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmod/MapWarp.cpp')
-rw-r--r--sigmod/MapWarp.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/sigmod/MapWarp.cpp b/sigmod/MapWarp.cpp
index 39868edc..214a1eb7 100644
--- a/sigmod/MapWarp.cpp
+++ b/sigmod/MapWarp.cpp
@@ -39,6 +39,7 @@ MapWarp::MapWarp(const MapWarp& warp) :
MapWarp::MapWarp(const Map* parent, const int id) :
Object(parent, id),
m_name(""),
+ m_position(0, 0),
m_area(),
m_toMap(INT_MAX),
m_toWarp(INT_MAX),
@@ -64,6 +65,7 @@ void MapWarp::validate()
TEST_BEGIN();
if (m_name.isEmpty())
emit(error("Name is empty"));
+ TEST(position);
TEST(toMap);
TEST(toWarp);
TEST_END();
@@ -73,6 +75,7 @@ void MapWarp::load(const QDomElement& xml)
{
LOAD_BEGIN();
LOAD(name);
+ LOAD(position);
LOAD(area);
LOAD(toMap);
LOAD(toWarp);
@@ -83,6 +86,7 @@ QDomElement MapWarp::save() const
{
SAVE_CREATE();
SAVE(name);
+ SAVE(position);
SAVE(area);
SAVE(toMap);
SAVE(toWarp);
@@ -91,18 +95,25 @@ QDomElement MapWarp::save() const
}
SETTER(MapWarp, QString&, Name, name)
+SETTER(MapWarp, QPoint&, Position, position)
SETTER(MapWarp, QPainterPath&, Area, area)
SETTER(MapWarp, int, ToMap, toMap)
SETTER(MapWarp, int, ToWarp, toWarp)
SETTER(MapWarp, Script&, Script, script)
GETTER(MapWarp, QString, name)
+GETTER(MapWarp, QPoint, position)
GETTER(MapWarp, QPainterPath, area)
GETTER(MapWarp, int, toMap)
GETTER(MapWarp, int, toWarp)
GETTER(MapWarp, Script, script)
CHECK(MapWarp, QString&, name)
+CHECK_BEGIN(MapWarp, QPoint&, position)
+ const Map* map = qobject_cast<const Map*>(parent());
+ TBOUNDS_MOD(position_x, 0, map->width() - 1, position.x())
+ TBOUNDS_MOD(position_y, 0, map->height() - 1, position.y())
+CHECK_END()
CHECK(MapWarp, QPainterPath&, area)
CHECK_INDEX(MapWarp, int, toMap, game(), map)
CHECK_BEGIN(MapWarp, int, toWarp)
@@ -121,6 +132,7 @@ MapWarp& MapWarp::operator=(const MapWarp& rhs)
if (this == &rhs)
return *this;
COPY(name);
+ COPY(position);
COPY(area);
COPY(toMap);
COPY(toWarp);