summaryrefslogtreecommitdiffstats
path: root/sigmod/MapWildListEncounter.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-09-05 20:41:05 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-09-05 20:41:05 +0000
commitb81f5bffa2772eb9bd3c67fb35485ab1ee2d96e7 (patch)
tree6609f31b1635d948cf7a216c7fea72cfb3c905a0 /sigmod/MapWildListEncounter.cpp
parentb99ffef4aa68dd5f0af64de9aec0f610e267d8cc (diff)
downloadsigen-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 'sigmod/MapWildListEncounter.cpp')
-rw-r--r--sigmod/MapWildListEncounter.cpp128
1 files changed, 128 insertions, 0 deletions
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 <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 "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<const Pokemod*>(pokemod())->speciesIndex(species) == INT_MAX)
+ emit(error(bounds("species")));
+ else
+ CHECK(species);
+}
+
+void Pokemod::MapWildListEncounter::setLevel(const int level)
+{
+ if (!level || (qobject_cast<const Pokemod*>(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;
+}