summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildListPokemon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/MapWildListPokemon.cpp')
-rw-r--r--pokemod/MapWildListPokemon.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/pokemod/MapWildListPokemon.cpp b/pokemod/MapWildListPokemon.cpp
new file mode 100644
index 00000000..896dcdf4
--- /dev/null
+++ b/pokemod/MapWildListPokemon.cpp
@@ -0,0 +1,119 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokemod/MapWildListPokemon.cpp
+// Purpose: Define a Pokémon that can be found in the wild
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Tue Mar 20 18:50:59 2007
+// Copyright: ©2007 Ben Boeckel and Nerdy Productions
+// Licence:
+// 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/>.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MapWildListPokemon.h"
+
+PokeGen::PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod* par, const unsigned _id) :
+ Object(_id, par),
+ species(UINT_MAX),
+ level(1),
+ weight(1)
+{
+}
+
+PokeGen::PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod* par, Ini& ini, const unsigned _id) :
+ Object(_id, par)
+{
+ ImportIni(ini, _id);
+}
+
+bool PokeGen::PokeMod::MapWildListPokemon::Validate()
+{
+ pokemod->ValidationMsg(QString("---------Pokémon with id %1---").arg(id), Pokemod::V_Msg);
+ if (pokemod->GetPokemonByID(species) == UINT_MAX)
+ {
+ pokemod->ValidationMsg("Invalid species");
+ isValid = false;
+ }
+ if (!level || (pokemod->GetMaxLevel() <= level))
+ {
+ pokemod->ValidationMsg("Invalid level");
+ isValid = false;
+ }
+ if (!weight)
+ {
+ pokemod->ValidationMsg("Invalid weighting");
+ isValid = false;
+ }
+ return isValid;
+}
+
+void PokeGen::PokeMod::MapWildListPokemon::ImportIni(Ini& ini, const unsigned _id)
+{
+ if (_id == UINT_MAX)
+ ini.GetValue("id", id);
+ else
+ id = _id;
+ ini.GetValue("species", species);
+ ini.GetValue("level", level, 1);
+ ini.GetValue("weight", weight, 1);
+}
+
+void PokeGen::PokeMod::MapWildListPokemon::ExportIni(QFile& fout, const QString& map, const unsigned listId) const
+{
+ Ini exMapWildListPokemon(QString("mapWildListPokemon %1 ").arg(listId) + map);
+ exMapWildListPokemon.AddField("id", id);
+ exMapWildListPokemon.AddField("species", species);
+ exMapWildListPokemon.AddField("level", level);
+ exMapWildListPokemon.AddField("weight", weight);
+ exMapWildListPokemon.Export(fout);
+}
+
+bool PokeGen::PokeMod::MapWildListPokemon::SetSpecies(const unsigned s)
+{
+ if (pokemod->GetPokemonByID(s) != UINT_MAX)
+ {
+ species = s;
+ return true;
+ }
+ return false;
+}
+
+void PokeGen::PokeMod::MapWildListPokemon::SetLevel(const unsigned l)
+{
+ level = l;
+}
+
+bool PokeGen::PokeMod::MapWildListPokemon::SetWeight(const unsigned w)
+{
+ if (w)
+ {
+ weight = w;
+ return true;
+ }
+ return false;
+}
+
+unsigned PokeGen::PokeMod::MapWildListPokemon::GetSpecies() const
+{
+ return species;
+}
+
+unsigned PokeGen::PokeMod::MapWildListPokemon::GetLevel() const
+{
+ return level;
+}
+
+unsigned PokeGen::PokeMod::MapWildListPokemon::GetWeight() const
+{
+ return weight;
+}