diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-29 12:09:27 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-29 12:09:27 -0500 |
| commit | 8e278873d4bd35a7cd7f3b6d9d7852fa422370b8 (patch) | |
| tree | 9e97b71d30779c07c79ca166e1d704a3de4d5e4f /sigmod/MapEffect.cpp | |
| parent | e801b73a2f9cb845913cf546002c8f50eefc473c (diff) | |
Merged CHECK macro branch
Diffstat (limited to 'sigmod/MapEffect.cpp')
| -rw-r--r-- | sigmod/MapEffect.cpp | 77 |
1 files changed, 21 insertions, 56 deletions
diff --git a/sigmod/MapEffect.cpp b/sigmod/MapEffect.cpp index 7b992892..241a7ce3 100644 --- a/sigmod/MapEffect.cpp +++ b/sigmod/MapEffect.cpp @@ -57,8 +57,8 @@ void Sigmod::MapEffect::validate() TEST_BEGIN(); if (m_name.isEmpty()) emit(error("Name is empty")); - TEST(setCoordinate, coordinate); - TEST(setSkin, skin); + TEST(coordinate); + TEST(skin); TEST_END(); } @@ -83,62 +83,27 @@ QDomElement Sigmod::MapEffect::save() const return xml; } -void Sigmod::MapEffect::setName(const QString& name) -{ - CHECK(name); -} - -void Sigmod::MapEffect::setCoordinate(const QPoint& coordinate) -{ - const Map* map = qobject_cast<const Map*>(parent()); - if ((coordinate.x() < 0) || (coordinate.y() < 0) || (map->width() <= coordinate.x()) || (map->height() <= coordinate.y())) - emit(error(bounds("coordinate", QPoint(0, 0), QPoint(map->width(), map->height()), coordinate))); - else - CHECK(coordinate); -} +SETTER(MapEffect, QString&, Name, name) +SETTER(MapEffect, QPoint&, Coordinate, coordinate) +SETTER(MapEffect, int, Skin, skin) +SETTER(MapEffect, bool, IsGhost, isGhost) +SETTER(MapEffect, Sigcore::Script&, Script, script) -void Sigmod::MapEffect::setSkin(const int skin) -{ - if (!sigmod()->skinById(skin)) - emit(error(bounds("skin", skin))); - else - CHECK(skin); -} +GETTER(MapEffect, QString, name) +GETTER(MapEffect, QPoint, coordinate) +GETTER(MapEffect, int, skin) +GETTER(MapEffect, bool, isGhost) +GETTER(MapEffect, Sigcore::Script, script) -void Sigmod::MapEffect::setIsGhost(const bool isGhost) -{ - CHECK(isGhost); -} - -void Sigmod::MapEffect::setScript(const Sigcore::Script& script) -{ - CHECK(script); -} - -QString Sigmod::MapEffect::name() const -{ - return m_name; -} - -QPoint Sigmod::MapEffect::coordinate() const -{ - return m_coordinate; -} - -int Sigmod::MapEffect::skin() const -{ - return m_skin; -} - -bool Sigmod::MapEffect::isGhost() const -{ - return m_isGhost; -} - -Sigcore::Script Sigmod::MapEffect::script() const -{ - return m_script; -} +CHECK(MapEffect, QString&, name) +CHECK_BEGIN(MapEffect, QPoint&, coordinate) + const Map* map = qobject_cast<const Map*>(parent()); + TBOUNDS_MOD(coordinate_x, 0, map->width() - 1, coordinate.x()) + TBOUNDS_MOD(coordinate_y, 0, map->height() - 1, coordinate.y()) +CHECK_END() +CHECK_INDEX(MapEffect, int, skin, sigmod(), skin) +CHECK(MapEffect, bool, isGhost) +CHECK(MapEffect, Sigcore::Script&, script) Sigmod::MapEffect& Sigmod::MapEffect::operator=(const MapEffect& rhs) { |
