From b81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 5 Sep 2008 20:41:05 +0000 Subject: [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 --- sigmod/MapWildListEncounter.cpp | 128 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sigmod/MapWildListEncounter.cpp (limited to 'sigmod/MapWildListEncounter.cpp') diff --git a/sigmod/MapWildListEncounter.cpp b/sigmod/MapWildListEncounter.cpp new file mode 100644 index 00000000..4ff41f4a --- /dev/null +++ b/sigmod/MapWildListEncounter.cpp @@ -0,0 +1,128 @@ +/* + * Copyright 2007-2008 Ben Boeckel + * + * 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 . + */ + +// Header include +#include "MapWildListEncounter.h" + +// Pokemod includes +#include "Macros.h" +#include "MapWildList.h" +#include "Pokemod.h" +#include "Rules.h" +#include "Species.h" + +Pokemod::MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter) : + Object(encounter.parent(), encounter.id()) +{ + *this = encounter; +} + +Pokemod::MapWildListEncounter::MapWildListEncounter(const MapWildList* parent, const int id) : + Object(parent, id), + m_species(INT_MAX), + m_level(1), + m_weight(1) +{ +} + +Pokemod::MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter, const MapWildList* parent, const int id) : + Object(parent, id) +{ + *this = encounter; +} + +Pokemod::MapWildListEncounter::MapWildListEncounter(const QDomElement& xml, const MapWildList* parent, const int id) : + Object(parent, id) +{ + LOAD_ID(); + load(xml); +} + +void Pokemod::MapWildListEncounter::validate() +{ + TEST_BEGIN(); + TEST(setSpecies, species); + TEST(setLevel, level); + TEST(setWeight, weight); + TEST_END(); +} + +void Pokemod::MapWildListEncounter::load(const QDomElement& xml) +{ + LOAD_BEGIN(); + LOAD(species); + LOAD(level); + LOAD(weight); +} + +QDomElement Pokemod::MapWildListEncounter::save() const +{ + SAVE_CREATE(); + SAVE(species); + SAVE(level); + SAVE(weight); + return xml; +} + +void Pokemod::MapWildListEncounter::setSpecies(const int species) +{ + if (qobject_cast(pokemod())->speciesIndex(species) == INT_MAX) + emit(error(bounds("species"))); + else + CHECK(species); +} + +void Pokemod::MapWildListEncounter::setLevel(const int level) +{ + if (!level || (qobject_cast(pokemod())->rules()->maxLevel() <= level)) + emit(error(bounds("level"))); + else + CHECK(level); +} + +void Pokemod::MapWildListEncounter::setWeight(const int weight) +{ + if (!weight) + emit(error(bounds("weight"))); + else + CHECK(weight); +} + +int Pokemod::MapWildListEncounter::species() const +{ + return m_species; +} + +int Pokemod::MapWildListEncounter::level() const +{ + return m_level; +} + +int Pokemod::MapWildListEncounter::weight() const +{ + return m_weight; +} + +Pokemod::MapWildListEncounter& Pokemod::MapWildListEncounter::operator=(const MapWildListEncounter& rhs) +{ + if (this == &rhs) + return *this; + COPY(species); + COPY(level); + COPY(weight); + return *this; +} -- cgit