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/MapTrainerTeam.cpp | |
| parent | e94d9893b8753e72adb92b2c5eb203830ddf641c (diff) | |
| download | sigen-5b55d13ead7e352ee1feaae72009e8abf5bd071a.tar.gz sigen-5b55d13ead7e352ee1feaae72009e8abf5bd071a.tar.xz sigen-5b55d13ead7e352ee1feaae72009e8abf5bd071a.zip | |
[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/MapTrainerTeam.cpp')
| -rw-r--r-- | pokemod/MapTrainerTeam.cpp | 245 |
1 files changed, 0 insertions, 245 deletions
diff --git a/pokemod/MapTrainerTeam.cpp b/pokemod/MapTrainerTeam.cpp deleted file mode 100644 index 56286885..00000000 --- a/pokemod/MapTrainerTeam.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/MapTrainerTeam.cpp
-// Purpose: Define a Pokémon on a trainer's team
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Mar 20 19:20:21 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 "MapTrainerTeam.h"
-
-PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(const Pokemod *par, const unsigned _id) :
- species(UINT_MAX),
- level(1)
-{
- LogCtor("MapTrainerTeam", _id);
- id = _id;
- pokemod = par;
-}
-
-PokeGen::PokeMod::MapTrainerTeam::MapTrainerTeam(const Pokemod *par, Ini &ini, const unsigned _id)
-{
- LogCtorIni("MapTrainerTeam", _id);
- pokemod = par;
- ImportIni(ini, _id);
- if (id == UINT_MAX)
- LogIdError("MapTrainerTeam");
-}
-
-PokeGen::PokeMod::MapTrainerTeam::~MapTrainerTeam()
-{
- LogDtor("MapTrainerTeam", id, GetSpeciesString());
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::Validate()
-{
- LogValidateStart("MapTrainerTeam", id);
- if (!pokemod->GetPokemon(species))
- {
- LogVarNotValid("MapTrainerTeam", id, "species");
- isValid = false;
- }
- if (pokemod->GetMaxLevel() <= level)
- {
- LogOutOfRange("MapTrainerTeam", id, "level", level, GetSpeciesString());
- isValid = false;
- }
- if (GetItemCount() <= pokemod->GetHoldItems())
- {
- QMap<unsigned, unsigned> idChecker;
- QMap<QString, unsigned> itemChecker;
- for (QList<unsigned>::ConstIterator i = items.begin(); i != items.end(); ++i)
- {
- if (!pokemod->GetItem(*i))
- {
- LogVarNotValid("MapTrainerTeam", id, "item");
- isValid = false;
- }
- ++idChecker[*i];
- ++itemChecker[pokemod->GetItem(*i)->GetName()];
- }
- for (QMap<unsigned, unsigned>::ConstIterator i = idChecker.begin(); i != idChecker.end(); ++i)
- {
- if (1 < i.value())
- {
- LogDuplicateId("MapTrainerTeam", id, "item", i.key());
- isValid = false;
- }
- }
- for (QMap<QString, unsigned>::ConstIterator i = itemChecker.begin(); i != itemChecker.end(); ++i)
- {
- if (1 < i.value())
- {
- LogDuplicateSubmodule("MapTrainerTeam", id, "item", i.key());
- isValid = false;
- }
- }
- }
- else if (GetItemCount())
- {
- Log::Write(QString("MapTrainerTeam Validation: Too many held items in %u", id), PM_DEBUG_ERROR | PM_DEBUG_VALIDATION);
- isValid = false;
- }
- else
- LogSubmoduleEmpty("MapTrainerTeam", id, "item");
- LogValidateOver("MapTrainerTeam", id, isValid, GetSpeciesString());
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::ImportIni(Ini &ini, const unsigned _id)
-{
- LogImportStart("MapTrainerTeam");
- if (_id == UINT_MAX)
- {
- ini.GetValue("id", id);
- if (id == UINT_MAX)
- LogIdNotFound("MapTrainerTeam");
- }
- else
- id = _id;
- unsigned i;
- unsigned j;
- items.clear();
- ini.GetValue("species", species);
- ini.GetValue("level", level, 1);
- ini.GetValue("numItems", i, 0);
- for (unsigned k = 0; k < i; ++k)
- {
- ini.GetValue(QString("item-%u", k), j);
- if (k != UINT_MAX)
- items.append(j);
- }
- LogImportOver("MapTrainerTeam", id);
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::ExportIni(QFile &fout, const QString &map, const unsigned trainerId) const
-{
- LogExportStart("MapTrainerTeam", id);
- Ini exMapTrainerTeam(QString("MapTrainerTeam %u ", trainerId) + map);
- exMapTrainerTeam.AddField("id", id);
- exMapTrainerTeam.AddField("species", species);
- exMapTrainerTeam.AddField("level", level);
- exMapTrainerTeam.AddField("numItems", GetItemCount());
- for (unsigned i = 0; i < GetItemCount(); ++i)
- exMapTrainerTeam.AddField(QString("item-%u", i), items[i]);
- exMapTrainerTeam.Export(fout);
- LogExportOver("MapTrainerTeam", id);
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::SetSpecies(const unsigned s)
-{
- LogSetVar("MapTrainerTeam", id, "species", s);
- if (pokemod->GetPokemon(s))
- species = s;
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::SetSpecies(const QString &s)
-{
- LogSetVar("MapTrainerTeam", id, "species string", s);
- if (const Pokemon *p = pokemod->GetPokemon(s))
- species = p->GetId();
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::SetLevel(const unsigned l)
-{
- LogSetVar("MapTrainerTeam", id, "level", l, GetSpeciesString());
- if (l <= pokemod->GetMaxLevel())
- level = l;
-}
-
-unsigned PokeGen::PokeMod::MapTrainerTeam::GetSpecies() const
-{
- LogFetchVar("MapTrainerTeam", id, "speceis", species);
- return species;
-}
-
-QString PokeGen::PokeMod::MapTrainerTeam::GetSpeciesString() const
-{
- LogFetchVar("MapTrainerTeam", id, "species string", species);
- if (const Pokemon *p = pokemod->GetPokemon(species))
- return p->GetName();
- return "";
-}
-
-unsigned PokeGen::PokeMod::MapTrainerTeam::GetLevel() const
-{
- LogFetchVar("MapTrainerTeam", id, "level", level, GetSpeciesString());
- return level;
-}
-
-unsigned PokeGen::PokeMod::MapTrainerTeam::GetItem(const unsigned i) const
-{
- LogSubmoduleFetch("MapTrainerTeam", id, "item", i);
- if (i < GetItemCount() <= i)
- return items[i];
- LogSubmoduleFetchFail("MapTrainerTeam", id, "item", i);
- return UINT_MAX;
-}
-
-unsigned PokeGen::PokeMod::MapTrainerTeam::GetItemCount() const
-{
- LogSubmoduleCount("MapTrainerTeam", id, "item");
- return items.size();
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::NewItem(const unsigned i)
-{
- LogSubmoduleNew("MapTrainerTeam", id, "item", i);
- if ((GetItemCount() < pokemod->GetHoldItems()) && pokemod->GetItem(i))
- items.append(i);
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::NewItem(const QString &n)
-{
- LogSubmoduleNew("MapTrainerTeam", id, "item", n);
- if (GetItemCount() < pokemod->GetHoldItems())
- {
- if (const Item *i = pokemod->GetItem(n))
- items.append(i->GetId());
- }
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::DeleteItem(const unsigned i)
-{
- LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", i);
- if (i < GetItemCount())
- DeleteItemByID(items[i]);
- else
- LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", i);
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::DeleteItem(const QString &n)
-{
- LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", n);
- if (const Item *i = pokemod->GetItem(n))
- DeleteItemByID(i->GetId());
- else
- LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", n);
-}
-
-void PokeGen::PokeMod::MapTrainerTeam::DeleteItemByID(const unsigned _id)
-{
- LogSubmoduleRemoveStart("MapTrainerTeam", id, "item", _id);
- for (QList<unsigned>::Iterator i = items.begin(); i != items.end(); ++i)
- {
- if (*i == _id)
- {
- LogSubmoduleRemoved("MapTrainerTeam", id, "item", _id);
- items.erase(i);
- }
- }
- LogSubmoduleRemoveFail("MapTrainerTeam", id, "item", _id);
-}
|
