diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-18 12:19:06 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-18 12:19:06 -0400 |
| commit | 6f7038314c9485f4ee278c23c5adfa6d3546e5f9 (patch) | |
| tree | bc81a96944739908bb8886bd13200d0e5bb4e6c4 /sigmod/MapEffect.cpp | |
| parent | 92fd5b0489a98fe19dc6f798f7ae990d2fa28922 (diff) | |
MapEffect now uses a QRect instead of a QPoint
Diffstat (limited to 'sigmod/MapEffect.cpp')
| -rw-r--r-- | sigmod/MapEffect.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sigmod/MapEffect.cpp b/sigmod/MapEffect.cpp index 061780ca..5f96d15a 100644 --- a/sigmod/MapEffect.cpp +++ b/sigmod/MapEffect.cpp @@ -39,7 +39,7 @@ MapEffect::MapEffect(const MapEffect& effect) : MapEffect::MapEffect(const Map* parent, const int id) : Object(parent, id), m_name(""), - m_position(0, 0), + m_area(0, 0, 0, 0), m_skin(-1), m_isGhost(false), m_script("", "") @@ -64,8 +64,9 @@ void MapEffect::validate() TEST_BEGIN(); if (m_name.isEmpty()) emit(error("Name is empty")); - TEST(position); - TEST(skin); + TEST(area); + if (m_area.height() || m_area.width()) + TEST(skin); TEST_END(); } @@ -73,7 +74,7 @@ void MapEffect::load(const QDomElement& xml) { LOAD_BEGIN(); LOAD(name); - LOAD(position); + LOAD(area); LOAD(skin); LOAD(isGhost); LOAD(script); @@ -83,7 +84,7 @@ QDomElement MapEffect::save() const { SAVE_CREATE(); SAVE(name); - SAVE(position); + SAVE(area); SAVE(skin); SAVE(isGhost); SAVE(script); @@ -91,22 +92,24 @@ QDomElement MapEffect::save() const } SETTER(MapEffect, QString&, Name, name) -SETTER(MapEffect, QPoint&, Position, position) +SETTER(MapEffect, QRect&, Area, area) SETTER(MapEffect, int, Skin, skin) SETTER(MapEffect, bool, IsGhost, isGhost) SETTER(MapEffect, Script&, Script, script) GETTER(MapEffect, QString, name) -GETTER(MapEffect, QPoint, position) +GETTER(MapEffect, QRect, area) GETTER(MapEffect, int, skin) GETTER(MapEffect, bool, isGhost) GETTER(MapEffect, Script, script) CHECK(MapEffect, QString&, name) -CHECK_BEGIN(MapEffect, QPoint&, position) +CHECK_BEGIN(MapEffect, QRect&, area) 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()) + TBOUNDS_MOD(area_x, 0, map->width() - 1, area.x()) + TBOUNDS_MOD(area_y, 0, map->height() - 1, area.y()) + TBOUNDS_MOD(area_width, 0, map->width() - area.x(), area.width()) + TBOUNDS_MOD(area_height, 0, map->height() - area.y(), area.height()) CHECK_END() CHECK_INDEX(MapEffect, int, skin, game(), skin) CHECK(MapEffect, bool, isGhost) @@ -117,7 +120,7 @@ MapEffect& MapEffect::operator=(const MapEffect& rhs) if (this == &rhs) return *this; COPY(name); - COPY(position); + COPY(area); COPY(skin); COPY(isGhost); COPY(script); |
