diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-01-18 18:54:47 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-01-18 18:54:47 -0500 |
| commit | e30ee1a42fef0346b57333de118d9f3ca18bfa84 (patch) | |
| tree | 3795534079a88f65e0000d9208c690f21c4926af | |
| parent | 640b12f68997d7862df3a8d6cea1f40fc5ae8cca (diff) | |
| download | sigen-e30ee1a42fef0346b57333de118d9f3ca18bfa84.tar.gz sigen-e30ee1a42fef0346b57333de118d9f3ca18bfa84.tar.xz sigen-e30ee1a42fef0346b57333de118d9f3ca18bfa84.zip | |
Changed MapEffect coordinate to position
| -rw-r--r-- | sigmod/MapEffect.cpp | 22 | ||||
| -rw-r--r-- | sigmod/MapEffect.h | 10 | ||||
| -rw-r--r-- | sigmod/test/TestMapEffect.cpp | 22 | ||||
| -rw-r--r-- | sigmod/test/TestMapEffect.h | 2 | ||||
| -rw-r--r-- | sigmodr/EffectItem.cpp | 6 | ||||
| -rw-r--r-- | sigscript/MapEffectWrapper.cpp | 8 | ||||
| -rw-r--r-- | sigscript/MapEffectWrapper.h | 4 |
7 files changed, 37 insertions, 37 deletions
diff --git a/sigmod/MapEffect.cpp b/sigmod/MapEffect.cpp index 241a7ce3..66a90dc6 100644 --- a/sigmod/MapEffect.cpp +++ b/sigmod/MapEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2007-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ Sigmod::MapEffect::MapEffect(const MapEffect& effect) : Sigmod::MapEffect::MapEffect(const Map* parent, const int id) : Object(parent, id), m_name(""), - m_coordinate(0, 0), + m_position(0, 0), m_skin(-1), m_isGhost(false), m_script("", "") @@ -57,7 +57,7 @@ void Sigmod::MapEffect::validate() TEST_BEGIN(); if (m_name.isEmpty()) emit(error("Name is empty")); - TEST(coordinate); + TEST(position); TEST(skin); TEST_END(); } @@ -66,7 +66,7 @@ void Sigmod::MapEffect::load(const QDomElement& xml) { LOAD_BEGIN(); LOAD(name); - LOAD(coordinate); + LOAD(position); LOAD(skin); LOAD(isGhost); LOAD(script); @@ -76,7 +76,7 @@ QDomElement Sigmod::MapEffect::save() const { SAVE_CREATE(); SAVE(name); - SAVE(coordinate); + SAVE(position); SAVE(skin); SAVE(isGhost); SAVE(script); @@ -84,22 +84,22 @@ QDomElement Sigmod::MapEffect::save() const } SETTER(MapEffect, QString&, Name, name) -SETTER(MapEffect, QPoint&, Coordinate, coordinate) +SETTER(MapEffect, QPoint&, Position, position) 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, QPoint, position) GETTER(MapEffect, int, skin) GETTER(MapEffect, bool, isGhost) GETTER(MapEffect, Sigcore::Script, script) CHECK(MapEffect, QString&, name) -CHECK_BEGIN(MapEffect, QPoint&, coordinate) +CHECK_BEGIN(MapEffect, QPoint&, position) 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()) + TBOUNDS_MOD(position_x, 0, map->width() - 1, position.x()) + TBOUNDS_MOD(position_y, 0, map->height() - 1, position.y()) CHECK_END() CHECK_INDEX(MapEffect, int, skin, sigmod(), skin) CHECK(MapEffect, bool, isGhost) @@ -110,7 +110,7 @@ Sigmod::MapEffect& Sigmod::MapEffect::operator=(const MapEffect& rhs) if (this == &rhs) return *this; COPY(name); - COPY(coordinate); + COPY(position); COPY(skin); COPY(isGhost); COPY(script); diff --git a/sigmod/MapEffect.h b/sigmod/MapEffect.h index 4ae0f376..5a8a62cc 100644 --- a/sigmod/MapEffect.h +++ b/sigmod/MapEffect.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2007-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,19 +48,19 @@ class SIGMOD_EXPORT MapEffect : public Object QDomElement save() const; void setName(const QString& name); - void setCoordinate(const QPoint& coordinate); + void setPosition(const QPoint& position); void setSkin(const int skin); void setIsGhost(const bool isGhost); void setScript(const Sigcore::Script& script); QString name() const; - QPoint coordinate() const; + QPoint position() const; int skin() const; bool isGhost() const; Sigcore::Script script() const; bool nameCheck(const QString& name) const; - bool coordinateCheck(const QPoint& coordinate) const; + bool positionCheck(const QPoint& position) const; bool skinCheck(const int skin) const; bool isGhostCheck(const bool isGhost) const; bool scriptCheck(const Sigcore::Script& script) const; @@ -68,7 +68,7 @@ class SIGMOD_EXPORT MapEffect : public Object MapEffect& operator=(const MapEffect& rhs); private: QString m_name; - QPoint m_coordinate; + QPoint m_position; int m_skin; bool m_isGhost; Sigcore::Script m_script; diff --git a/sigmod/test/TestMapEffect.cpp b/sigmod/test/TestMapEffect.cpp index c0e29a89..95ad3c12 100644 --- a/sigmod/test/TestMapEffect.cpp +++ b/sigmod/test/TestMapEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +77,7 @@ void TestMapEffect::validation() m_sigmod->map(0)->setWidth(25); m_sigmod->map(0)->setHeight(25); - m_effect1->setCoordinate(QPoint(20, 20)); + m_effect1->setPosition(QPoint(20, 20)); m_effect1->validate(); QCOMPARE(m_warnings.size(), 0); @@ -126,7 +126,7 @@ void TestMapEffect::loading() m_sigmod->newSkin(); m_effect1->setName("Bar"); - m_effect1->setCoordinate(QPoint(3, 3)); + m_effect1->setPosition(QPoint(3, 3)); m_effect1->setSkin(1); m_effect1->setIsGhost(true); m_effect1->setScript(Sigcore::Script("python", "import os")); @@ -136,7 +136,7 @@ void TestMapEffect::loading() m_effect1->load(xml.firstChildElement("MapEffect")); QCOMPARE(m_effect1->name(), QString("Foo")); - QCOMPARE(m_effect1->coordinate(), QPoint(20, 20)); + QCOMPARE(m_effect1->position(), QPoint(20, 20)); QCOMPARE(m_effect1->skin(), 0); QCOMPARE(m_effect1->isGhost(), false); QCOMPARE(m_effect1->script(), Sigcore::Script()); @@ -155,22 +155,22 @@ void TestMapEffect::setName() QCOMPARE(m_errors.size(), 0); } -void TestMapEffect::setCoordinate() +void TestMapEffect::setPosition() { - m_effect2->setCoordinate(QPoint(20, 30)); + m_effect2->setPosition(QPoint(20, 30)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 1); - m_effect2->setCoordinate(QPoint(30, 20)); + m_effect2->setPosition(QPoint(30, 20)); QCOMPARE(m_warnings.size(), 0); QCOMPARE(m_errors.size(), 2); - m_effect2->setCoordinate(QPoint(20, 20)); - m_effect2->setCoordinate(QPoint(20, 20)); + m_effect2->setPosition(QPoint(20, 20)); + m_effect2->setPosition(QPoint(20, 20)); - QCOMPARE(m_effect2->coordinate(), QPoint(20, 20)); + QCOMPARE(m_effect2->position(), QPoint(20, 20)); QCOMPARE(m_changedCount, 1); @@ -229,7 +229,7 @@ void TestMapEffect::assignment() *m_effect3 = *m_effect2; QCOMPARE(m_effect3->name(), QString("Foo")); - QCOMPARE(m_effect3->coordinate(), QPoint(20, 20)); + QCOMPARE(m_effect3->position(), QPoint(20, 20)); QCOMPARE(m_effect3->skin(), 2); QCOMPARE(m_effect3->isGhost(), true); QCOMPARE(m_effect3->script(), Sigcore::Script("python", "import os")); diff --git a/sigmod/test/TestMapEffect.h b/sigmod/test/TestMapEffect.h index 9a07d96b..f1f65a97 100644 --- a/sigmod/test/TestMapEffect.h +++ b/sigmod/test/TestMapEffect.h @@ -43,7 +43,7 @@ class TestMapEffect : public TestSigmodObject void loading(); void setName(); - void setCoordinate(); + void setPosition(); void setSkin(); void setIsGhost(); void setScript(); diff --git a/sigmodr/EffectItem.cpp b/sigmodr/EffectItem.cpp index 9b6c3327..e297ebb0 100644 --- a/sigmodr/EffectItem.cpp +++ b/sigmodr/EffectItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +100,7 @@ void Sigmodr::EffectItem::mousePressEvent(QGraphicsSceneMouseEvent* event) void Sigmodr::EffectItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { QGraphicsItem::mouseMoveEvent(event); - m_effect->setCoordinate(scenePos().toPoint()); + m_effect->setPosition(scenePos().toPoint()); } void Sigmodr::EffectItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) @@ -111,6 +111,6 @@ void Sigmodr::EffectItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) void Sigmodr::EffectItem::effectChanged() { - setPos(m_effect->coordinate()); + setPos(m_effect->position()); update(); } diff --git a/sigscript/MapEffectWrapper.cpp b/sigscript/MapEffectWrapper.cpp index d51cdca0..da10d478 100644 --- a/sigscript/MapEffectWrapper.cpp +++ b/sigscript/MapEffectWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,10 +41,10 @@ QString Sigscript::MapEffectWrapper::name() const return m_effect->name(); } -QPoint Sigscript::MapEffectWrapper::coordinate() const +QPoint Sigscript::MapEffectWrapper::position() const { - ALLOW_OVERRIDE_SO(effect, QPoint, coordinate); - return m_effect->coordinate(); + ALLOW_OVERRIDE_SO(effect, QPoint, position); + return m_effect->position(); } Sigscript::SkinWrapper* Sigscript::MapEffectWrapper::skin() diff --git a/sigscript/MapEffectWrapper.h b/sigscript/MapEffectWrapper.h index 5199f87f..f99ed73e 100644 --- a/sigscript/MapEffectWrapper.h +++ b/sigscript/MapEffectWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ class SIGSCRIPT_EXPORT MapEffectWrapper : public ObjectWrapper static MapEffectWrapper* create(const Sigmod::MapEffect* effect, MapWrapper* parent); Q_SCRIPTABLE QString name() const; - Q_SCRIPTABLE QPoint coordinate() const; + Q_SCRIPTABLE QPoint position() const; Q_SCRIPTABLE SkinWrapper* skin(); Q_SCRIPTABLE bool isGhost() const; Q_SCRIPTABLE Sigcore::Script script() const; |
