diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 00:44:23 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 00:44:23 +0000 |
| commit | 2b653821cc31f18adb5d50bb0bc19048939670dc (patch) | |
| tree | d333bbf0d1dde8fe0c1633bea60785b20ac07841 /pokemod/MapWildListPokemon.cpp | |
| parent | e27ba66952a1e851bb417611e0ed7df1fbf5f945 (diff) | |
[ADD] More GUI classes (only MoveEffect left)
[FIX] Polished up GUI classes
[FIX] renamed methods get*ByID -> get*Index instead for more logical get*ByID
[FIX] Renaming in pokemod to remove mention of Pokémon
[FIX] minor .pro fixes (aesthetic mainly)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@35 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MapWildListPokemon.cpp')
| -rw-r--r-- | pokemod/MapWildListPokemon.cpp | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/pokemod/MapWildListPokemon.cpp b/pokemod/MapWildListPokemon.cpp deleted file mode 100644 index 046c18c3..00000000 --- a/pokemod/MapWildListPokemon.cpp +++ /dev/null @@ -1,133 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/MapWildListPokemon.cpp -// Purpose: Define a species that can be found in the wild -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 18:50:59 2007 -// Copyright: ©2007-2008 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" - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const unsigned _id) : - Object(par, _id), - species(UINT_MAX), - level(1), - weight(1) -{ -} - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const MapWildListPokemon& p, const unsigned _id) : - Object(par, _id) -{ - *this = p; -} - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) -{ - load(fname, _id); -} - -bool PokeMod::MapWildListPokemon::validate() const -{ - bool valid = true; - pokemod.validationMsg(QString("---------Pokémon with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getSpeciesByID(species) == UINT_MAX) - { - pokemod.validationMsg("Invalid species"); - valid = false; - } - if (!level || (pokemod.getRules().getMaxLevel() <= level)) - { - pokemod.validationMsg("Invalid level"); - valid = false; - } - if (!weight) - { - pokemod.validationMsg("Invalid weighting"); - valid = false; - } - return valid; -} - -void PokeMod::MapWildListPokemon::load(const QString& fname, const unsigned _id) throw(Exception) -{ - Ini ini(fname); - 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 PokeMod::MapWildListPokemon::save(const QString& map, const unsigned listId) const throw(Exception) -{ - Ini ini; - ini.addField("id", id); - ini.addField("species", species); - ini.addField("level", level); - ini.addField("weight", weight); - ini.save(QString("%1/map/%2/wildlist/%3/pokemon/%4.pini").arg(pokemod.getPath()).arg(map).arg(listId).arg(id)); -} - -void PokeMod::MapWildListPokemon::setSpecies(const unsigned s) throw(BoundsException) -{ - if (pokemod.getSpeciesByID(s) == UINT_MAX) - throw(BoundsException("MapWildListPokemon", "species")); - species = s; -} - -void PokeMod::MapWildListPokemon::setLevel(const unsigned l) throw(BoundsException) -{ - if (!level || (pokemod.getRules().getMaxLevel() <= level)) - throw(BoundsException("MapWildListPokemon", "level")); - level = l; -} - -void PokeMod::MapWildListPokemon::setWeight(const unsigned w) throw(BoundsException) -{ - if (!w) - throw(BoundsException("MapWildListPokemon", "weight")); - weight = w; -} - -unsigned PokeMod::MapWildListPokemon::getSpecies() const -{ - return species; -} - -unsigned PokeMod::MapWildListPokemon::getLevel() const -{ - return level; -} - -unsigned PokeMod::MapWildListPokemon::getWeight() const -{ - return weight; -} - -PokeMod::MapWildListPokemon& PokeMod::MapWildListPokemon::operator=(const MapWildListPokemon& rhs) -{ - if (this == &rhs) - return *this; - species = rhs.species; - level = rhs.level; - weight = rhs.weight; - return *this; -} |
