diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-09-05 20:41:05 +0000 |
commit | b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7 (patch) | |
tree | 6609f31b1635d948cf7a216c7fea72cfb3c905a0 /pokemod/MapWarp.cpp | |
parent | b99ffef4aa68dd5f0af64de9aec0f610e267d8cc (diff) | |
download | sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.gz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.tar.xz sigen-b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7.zip |
[FIX] Moving stuff for the move to the new name, Sigma Game Engine (sigen for short)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@249 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapWarp.cpp')
-rw-r--r-- | pokemod/MapWarp.cpp | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp deleted file mode 100644 index cc922a33..00000000 --- a/pokemod/MapWarp.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2007-2008 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "MapWarp.h" - -// Pokemod includes -#include "Macros.h" -#include "Map.h" -#include "Pokemod.h" - -const QStringList Pokemod::MapWarp::TypeStr = QStringList() << "Door" << "Warp" << "Hole" << "Boundary"; - -Pokemod::MapWarp::MapWarp(const MapWarp& warp) : - Object(warp.parent(), warp.id()) -{ - *this = warp; -} - -Pokemod::MapWarp::MapWarp(const Map* parent, const int id) : - Object(parent, id), - m_name(""), - m_coordinate(0, 0), - m_type(Door), - m_toMap(INT_MAX), - m_toWarp(INT_MAX), - m_script("", "") -{ -} - -Pokemod::MapWarp::MapWarp(const MapWarp& warp, const Map* parent, const int id) : - Object(parent, id) -{ - *this = warp; -} - -Pokemod::MapWarp::MapWarp(const QDomElement& xml, const Map* parent, const int id) : - Object(parent, id) -{ - LOAD_ID(); - load(xml); -} - -void Pokemod::MapWarp::validate() -{ - TEST_BEGIN(); - if (m_name.isEmpty()) - emit(error("Name is empty")); - TEST(setToMap, toMap); - TEST(setToWarp, toWarp); - TEST_END(); -} - -void Pokemod::MapWarp::load(const QDomElement& xml) -{ - LOAD_BEGIN(); - LOAD(name); - LOAD(coordinate); - LOAD(type); - LOAD(toMap); - LOAD(toWarp); - LOAD(script); -} - -QDomElement Pokemod::MapWarp::save() const -{ - SAVE_CREATE(); - SAVE(name); - SAVE(coordinate); - SAVE(type); - SAVE(toMap); - SAVE(toWarp); - SAVE(script); - return xml; -} - -void Pokemod::MapWarp::setName(const QString& name) -{ - CHECK(name); -} - -void Pokemod::MapWarp::setCoordinate(const QPoint& coordinate) -{ - if ((qobject_cast<const Map*>(parent())->width() <= coordinate.x()) || (qobject_cast<const Map*>(parent())->height() <= coordinate.y())) - emit(error(bounds("coordinate"))); - else - CHECK(coordinate); -} - -void Pokemod::MapWarp::setType(const Type type) -{ - CHECK(type); -} - -void Pokemod::MapWarp::setToMap(const int toMap) -{ - if (qobject_cast<const Pokemod*>(pokemod())->mapIndex(toMap) == INT_MAX) - emit(error(bounds("toMap"))); - else - CHECK(toMap); -} - -void Pokemod::MapWarp::setToWarp(const int toWarp) -{ - if (qobject_cast<const Pokemod*>(pokemod())->mapIndex(m_toMap) == INT_MAX) - emit(error(bounds("toMap"))); - else if (qobject_cast<const Pokemod*>(pokemod())->mapById(m_toMap)->warpIndex(toWarp) == INT_MAX) - emit(error(bounds("toWarp"))); - else - CHECK(toWarp); -} - -void Pokemod::MapWarp::setScript(const Script& script) -{ - CHECK(script); -} - -QString Pokemod::MapWarp::name() const -{ - return m_name; -} - -QPoint Pokemod::MapWarp::coordinate() const -{ - return m_coordinate; -} - -Pokemod::MapWarp::Type Pokemod::MapWarp::type() const -{ - return m_type; -} - -int Pokemod::MapWarp::toMap() const -{ - return m_toMap; -} - -int Pokemod::MapWarp::toWarp() const -{ - return m_toWarp; -} - -Pokemod::Script Pokemod::MapWarp::script() const -{ - return m_script; -} - -Pokemod::MapWarp& Pokemod::MapWarp::operator=(const MapWarp& rhs) -{ - if (this == &rhs) - return *this; - COPY(name); - COPY(coordinate); - COPY(type); - COPY(toMap); - COPY(toWarp); - COPY(script); - return *this; -} |