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 | |
parent | 92fd5b0489a98fe19dc6f798f7ae990d2fa28922 (diff) | |
download | sigen-6f7038314c9485f4ee278c23c5adfa6d3546e5f9.tar.gz sigen-6f7038314c9485f4ee278c23c5adfa6d3546e5f9.tar.xz sigen-6f7038314c9485f4ee278c23c5adfa6d3546e5f9.zip |
MapEffect now uses a QRect instead of a QPoint
Diffstat (limited to 'sigmod')
-rw-r--r-- | sigmod/MapEffect.cpp | 25 | ||||
-rw-r--r-- | sigmod/MapEffect.h | 15 |
2 files changed, 22 insertions, 18 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); diff --git a/sigmod/MapEffect.h b/sigmod/MapEffect.h index b2077385..c00684bd 100644 --- a/sigmod/MapEffect.h +++ b/sigmod/MapEffect.h @@ -105,11 +105,12 @@ class SIGMOD_EXPORT MapEffect : public Object */ void setName(const QString& name); /** - * Sets the starting position of the effect on the map. + * Sets the area of the map the effect takes up. If the size is set to (0, 0), + * the skin determines its size. * - * \param position The starting position of the effect. + * \param area The area of the map the effect takes up. */ - void setPosition(const QPoint& position); + void setArea(const QRect& area); /** * Sets the id of the skin used to represent the effect on the map. * @@ -141,11 +142,11 @@ class SIGMOD_EXPORT MapEffect : public Object */ QString name() const; /** - * \sa setPosition + * \sa setArea * * \return The starting position of the effect. */ - QPoint position() const; + QRect area() const; /** * \sa setSkin * @@ -166,7 +167,7 @@ class SIGMOD_EXPORT MapEffect : public Object Sigcore::Script script() const; bool nameCheck(const QString& name) const; - bool positionCheck(const QPoint& position) const; + bool areaCheck(const QRect& area) const; bool skinCheck(const int skin) const; bool isGhostCheck(const bool isGhost) const; bool scriptCheck(const Sigcore::Script& script) const; @@ -174,7 +175,7 @@ class SIGMOD_EXPORT MapEffect : public Object MapEffect& operator=(const MapEffect& rhs); private: QString m_name; - QPoint m_position; + QRect m_area; int m_skin; bool m_isGhost; Sigcore::Script m_script; |