diff options
Diffstat (limited to 'sigmod/MapEffect.cpp')
| -rw-r--r-- | sigmod/MapEffect.cpp | 75 |
1 files changed, 20 insertions, 55 deletions
diff --git a/sigmod/MapEffect.cpp b/sigmod/MapEffect.cpp index 4a16bc06..241a7ce3 100644 --- a/sigmod/MapEffect.cpp +++ b/sigmod/MapEffect.cpp @@ -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) -{ +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) + +GETTER(MapEffect, QString, name) +GETTER(MapEffect, QPoint, coordinate) +GETTER(MapEffect, int, skin) +GETTER(MapEffect, bool, isGhost) +GETTER(MapEffect, Sigcore::Script, script) + +CHECK(MapEffect, QString&, name) +CHECK_BEGIN(MapEffect, 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); -} - -void Sigmod::MapEffect::setSkin(const int skin) -{ - if (!sigmod()->skinById(skin)) - emit(error(bounds("skin", skin))); - else - CHECK(skin); -} - -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; -} + 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) { |
