diff options
Diffstat (limited to 'pokemod/Weather.cpp')
| -rw-r--r-- | pokemod/Weather.cpp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/pokemod/Weather.cpp b/pokemod/Weather.cpp new file mode 100644 index 00000000..59ff9135 --- /dev/null +++ b/pokemod/Weather.cpp @@ -0,0 +1,102 @@ +/* + * Copyright 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 "Weather.h" + +// Pokemod includes +#include "Pokemod.h" +#include "Script.h" + +Weather::Weather(const Weather& weather) : + Object("Weather", weather.parent(), weather.id()) +{ + *this = weather; +} + +Weather::Weather(const Pokemod* parent, const int id) : + Object("Weather", parent, id), + m_name(""), + m_script("", "") +{ +} + +Weather::Weather(const Weather& weather, const Pokemod* parent, const int id) : + Object("Weather", parent, id) +{ + *this = weather; +} + +Weather::Weather(const QDomElement& xml, const Pokemod* parent, const int id) : + Object("Weather", parent, id) +{ + load(xml, id); +} + +Weather::~Weather() +{ +} + +void Weather::validate() +{ + if (m_name.isEmpty()) + emit(error("Name is empty")); +} + +void Weather::load(const QDomElement& xml, int id) +{ + LOAD_ID(); + LOAD(QString, name); + LOAD(Script, script); +} + +QDomElement Weather::save() const +{ + SAVE_CREATE(); + SAVE(QString, name); + SAVE(Script, script); + return xml; +} + +void Weather::setName(const QString& name) +{ + CHECK(name); +} + +void Weather::setScript(const Script& script) +{ + CHECK(script); +} + +QString Weather::name() const +{ + return m_name; +} + +Script Weather::script() const +{ + return m_script; +} + +Weather& Weather::operator=(const Weather& rhs) +{ + if (this == &rhs) + return *this; + COPY(name); + COPY(script); + return *this; +} |
