diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2007-09-21 15:36:22 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2007-09-21 15:36:22 +0000 |
| commit | 5b55d13ead7e352ee1feaae72009e8abf5bd071a (patch) | |
| tree | 6c2838312dd7f42769280e24e8abc16b53c165cb /pokemod/MapWildListPokemon.cpp | |
| parent | e94d9893b8753e72adb92b2c5eb203830ddf641c (diff) | |
[FIX] Neural Network methods complete
[FIX] Wrapped Node up into the layer
[FIX] Wrapped NatureEffect into Nature
[FIX] Getting around to fixing up the design of the PokéMod stuff
[FIX] Creating new subclasses now returns pointer to new subclass
[FIX] Simplified interfaces
[FIX] Minor style issues
[FIX] Renamed CoinItem to CoinListObject
[FIX] Renamed MapTrainerTeam to MapTrainerPokemon
[FIX] Renamed MapWildPokemon to MapWildListPokemon
[FIX] Moved global enums to relevant classes
[FIX] Removed general logging features
[DEL] pokemod/Debug.{h, cpp}
[DEL] pokemod/Path.{h, cpp}
[FIX] Using QFile rather than custom Path class for checking for files
[FIX] Set* methods now return a bool to let the caller know if anything actually changed (if it can fail, otherwise it is void)
[ADD] Compliation without errors is required for pokemod from now on before commits
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@24 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapWildListPokemon.cpp')
| -rw-r--r-- | pokemod/MapWildListPokemon.cpp | 119 |
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; +} |
