summaryrefslogtreecommitdiffstats
path: root/pokemod/Pokemod.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-03-31 01:17:59 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-03-31 01:17:59 +0000
commit9a65bc6bb7c8da1dfa5b101579e52845c75848ef (patch)
tree258900f882a6998ac6fa525bd247e302028a8911 /pokemod/Pokemod.cpp
parent8e1ec2aec50999bae30625303f2c96e5b3b7f318 (diff)
downloadsigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.tar.gz
sigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.tar.xz
sigen-9a65bc6bb7c8da1dfa5b101579e52845c75848ef.zip
[FIX] Member variables now use m_ prefix
[FIX] Lots of minor fixes git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@95 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
-rw-r--r--pokemod/Pokemod.cpp2704
1 files changed, 1250 insertions, 1454 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 6add7b59..3de5b185 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -1,33 +1,27 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemod/Pokemod.cpp
-// Purpose: Define a custom PokéMod for PokéGen
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 24 21:41:19 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QDir>
-#include <QListIterator>
#include <QMap>
-#include <QMapIterator>
-#include <QStringListIterator>
#include <QTextStream>
#include <QTime>
+// Pokemod includes
#include "Ability.h"
#include "Author.h"
#include "Badge.h"
@@ -45,6 +39,8 @@
#include "Time.h"
#include "Trainer.h"
#include "Type.h"
+
+// Header include
#include "Pokemod.h"
const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error";
@@ -60,97 +56,95 @@ const QStringList Pokemod::HMStr = QStringList() << "Cut" << "Fly" << "Surf" <<
Pokemod::Pokemod() :
Object("Pokemod", this, 0),
valOutput(NULL),
- title(""),
- version(""),
- description(""),
- startMap(-1),
- startWarp(-1),
- superPCUname(""),
- superPCPasswd(""),
- typeChart(1, 1, Frac(1, 1, Frac::Improper)),
- rules(this),
- path(QString("%1/.kde/share/apps/pokegen/mods").arg(QDir::homePath()))
+ m_title(""),
+ m_version(""),
+ m_description(""),
+ m_startMap(INT_MAX),
+ m_startWarp(INT_MAX),
+ m_superPCUname(""),
+ m_superPCPasswd(""),
+ m_typeChart(1, 1, Frac(1, 1, Frac::Improper)),
+ m_rules(this),
+ m_path(QString("%1/.kde/share/apps/pokegen/mods").arg(QDir::homePath()))
{
}
-Pokemod::Pokemod(const Pokemod& p) :
+Pokemod::Pokemod(const Pokemod& pokemod) :
Object("Pokemod", this, 0),
- rules(this)
+ m_rules(this)
{
- *this = p;
+ *this = pokemod;
}
-Pokemod::Pokemod(const QString& fname) :
+Pokemod::Pokemod(const QString& fileName) :
Object("Pokemod", this, 0),
valOutput(NULL),
- title(""),
- version(""),
- description(""),
- startMap(-1),
- startWarp(-1),
- superPCUname(""),
- superPCPasswd(""),
- typeChart(1, 1, Frac(1, 1, Frac::Improper)),
- rules(this)
+ m_title(""),
+ m_version(""),
+ m_description(""),
+ m_startMap(INT_MAX),
+ m_startWarp(INT_MAX),
+ m_superPCUname(""),
+ m_superPCPasswd(""),
+ m_typeChart(1, 1, Frac(1, 1, Frac::Improper)),
+ m_rules(this)
{
- load(fname);
+ load(fileName);
}
Pokemod::~Pokemod()
{
- for (QListIterator<Ability*> i(abilities); i.hasNext(); )
- delete i.next();
- for (QListIterator<Author*> i(authors); i.hasNext(); )
- delete i.next();
- for (QListIterator<Badge*> i(badges); i.hasNext(); )
- delete i.next();
- for (QListIterator<CoinList*> i(coinLists); i.hasNext(); )
- delete i.next();
- for (QListIterator<Dialog*> i(dialogs); i.hasNext(); )
- delete i.next();
- for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); )
- delete i.next();
- for (QListIterator<Item*> i(items); i.hasNext(); )
- delete i.next();
- for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); )
- delete i.next();
- for (QListIterator<Map*> i(maps); i.hasNext(); )
- delete i.next();
- for (QListIterator<Nature*> i(natures); i.hasNext(); )
- delete i.next();
- for (QListIterator<Species*> i(species); i.hasNext(); )
- delete i.next();
- for (QListIterator<Store*> i(stores); i.hasNext(); )
- delete i.next();
- for (QListIterator<Tile*> i(tiles); i.hasNext(); )
- delete i.next();
- for (QListIterator<Time*> i(times); i.hasNext(); )
- delete i.next();
- for (QListIterator<Trainer*> i(trainers); i.hasNext(); )
- delete i.next();
- for (QListIterator<Type*> i(types); i.hasNext(); )
- delete i.next();
+ foreach (Ability* ability, m_abilities)
+ delete ability;
+ foreach (Author* author, m_authors)
+ delete author;
+ foreach (Badge* badge, m_badges)
+ delete badge;
+ foreach (CoinList* coinList, m_coinLists)
+ delete coinList;
+ foreach (Dialog* dialog, m_dialogs)
+ delete dialog;
+ foreach (EggGroup* eggGroup, m_eggGroups)
+ delete eggGroup;
+ foreach (Item* item, m_items)
+ delete item;
+ foreach (ItemType* itemType, m_itemTypes)
+ delete itemType;
+ foreach (Map* map, m_maps)
+ delete map;
+ foreach (Species* m_species, m_species)
+ delete m_species;
+ foreach (Store* store, m_stores)
+ delete store;
+ foreach (Tile* tile, m_tiles)
+ delete tile;
+ foreach (Time* time, m_times)
+ delete time;
+ foreach (Trainer* trainer, m_trainers)
+ delete trainer;
+ foreach (Type* type, m_types)
+ delete type;
}
bool Pokemod::validate() const
{
bool valid = true;
- validationMsg(QString("Pokemod \"%1\"").arg(title), V_Msg);
- if (title == "")
+ validationMsg(QString("Pokemod \"%1\"").arg(m_title), V_Msg);
+ if (m_title == "")
{
validationMsg("Title is not defined");
valid = false;
}
- if (version == "")
+ if (m_version == "")
{
validationMsg("Version is not defined");
valid = false;
}
- if (description == "")
+ if (m_description == "")
validationMsg("Description is not defined", V_Warn);
- if (getMapIndex(startMap))
+ if (mapIndex(m_startMap))
{
- if (getMapByID(startMap)->getWarpIndex(startWarp) == -1)
+ if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX)
{
validationMsg("Invalid starting warp");
valid = false;
@@ -161,831 +155,433 @@ bool Pokemod::validate() const
validationMsg("Invalid starting map");
valid = false;
}
- if (!QFile::exists(getWalkSkin()))
+ if (!QFile::exists(walkSkin()))
{
validationMsg("Cannot find walking skin");
valid = false;
}
- if (!QFile::exists(getBikeSkin()))
+ if (!QFile::exists(bikeSkin()))
{
validationMsg("Cannot find biking skin");
valid = false;
}
- if (!QFile::exists(getSurfSkin()))
+ if (!QFile::exists(surfSkin()))
{
validationMsg("Cannot find surfing skin");
valid = false;
}
- if (!QFile::exists(getFlySkin()))
+ if (!QFile::exists(flySkin()))
{
validationMsg("Cannot find flying skin");
valid = false;
}
- if (!QFile::exists(getFishSkin()))
+ if (!QFile::exists(fishSkin()))
{
validationMsg("Cannot find fishing skin");
valid = false;
}
- if (!QFile::exists(getSurfFishSkin()))
+ if (!QFile::exists(surfFishSkin()))
{
validationMsg("Cannot find surf fishing skin");
valid = false;
}
- if (superPCUname == "")
+ if (m_superPCUname == "")
validationMsg("Super PC username not defined", V_Warn);
- if (superPCPasswd == "")
+ if (m_superPCPasswd == "")
validationMsg("Super PC password not defined", V_Warn);
- if ((typeChart.getWidth() != getTypeCount()) || (typeChart.getHeight() != getTypeCount()))
+ if ((m_typeChart.width() != typeCount()) || (m_typeChart.height() != typeCount()))
{
validationMsg("TypeChart is invalid");
valid = false;
}
- if (!rules.isValid())
+ if (!m_rules.isValid())
valid = false;
- QMap<int, int> idChecker;
- QMap<QString, int> nameChecker;
- QMap<int, int> timeChecker;
- if (rules.getAbilityAllowed())
+ QMap<int, bool> idChecker;
+ QMap<int, bool> timeChecker;
+ if (m_rules.abilityAllowed())
{
- if (!getAbilityCount())
+ if (!abilityCount())
{
validationMsg("There are no abilities");
valid = false;
}
- for (QListIterator<Ability*> i(abilities); i.hasNext(); i.next())
+ foreach (Ability* ability, m_abilities)
{
- if (!i.peekNext()->isValid())
+ if (!ability->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 abilities with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 abilities with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[ability->id()])
+ validationMsg(QString("Duplicate ability with id %1").arg(ability->id()));
+ idChecker[ability->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
}
- if (!getAuthorCount())
+ if (!authorCount())
{
validationMsg("There are no authors");
valid = false;
}
- for (QListIterator<Author*> i(authors); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 authors with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
+ foreach (Author* author, m_authors)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 authors with the name \"%2\"").arg(i.value()).arg(i.key()));
+ if (!author->isValid())
valid = false;
- }
+ if (idChecker[author->id()])
+ validationMsg(QString("Duplicate author with id %1").arg(author->id()));
+ idChecker[author->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getBadgeCount())
+ if (!badgeCount())
validationMsg("There are no badges", V_Warn);
- for (QListIterator<Badge*> i(badges); i.hasNext(); i.next())
+ foreach (Badge* badge, m_badges)
{
- if (!i.peekNext()->isValid())
+ if (!badge->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 badges with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 badges with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[badge->id()])
+ validationMsg(QString("Duplicate badge with id %1").arg(badge->id()));
+ idChecker[badge->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getCoinListCount())
+ if (!coinListCount())
validationMsg("There are no coin lists", V_Warn);
- for (QListIterator<CoinList*> i(coinLists); i.hasNext(); i.next())
+ foreach (CoinList* coinList, m_coinLists)
{
- if (!i.peekNext()->isValid())
+ if (!coinList->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 coin lists with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 coin lists with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[coinList->id()])
+ validationMsg(QString("Duplicate coin list with id %1").arg(coinList->id()));
+ idChecker[coinList->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getDialogCount())
+ if (!dialogCount())
{
validationMsg("There are no dialogs");
valid = false;
}
- for (QListIterator<Dialog*> i(dialogs); i.hasNext(); i.next())
+ foreach (Dialog* dialog, m_dialogs)
{
- if (!i.peekNext()->isValid())
+ if (!dialog->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 dialogs with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[dialog->id()])
+ validationMsg(QString("Duplicate dialog with id %1").arg(dialog->id()));
+ idChecker[dialog->id()] = true;
}
idChecker.clear();
- if (rules.getBreedingAllowed())
+ if (m_rules.breedingAllowed())
{
- if (!getEggGroupCount())
+ if (!eggGroupCount())
{
validationMsg("There are no egg grous");
valid = false;
}
- for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 egg groups with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
+ foreach (EggGroup* eggGroup, m_eggGroups)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 egg groups with the name \"%2\"").arg(i.value()).arg(i.key()));
+ if (!eggGroup->isValid())
valid = false;
- }
+ if (idChecker[eggGroup->id()])
+ validationMsg(QString("Duplicate egg group with id %1").arg(eggGroup->id()));
+ idChecker[eggGroup->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- }
- if (!getItemCount())
- validationMsg("There are no items", V_Warn);
- for (QListIterator<Item*> i(items); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
}
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
+ if (!itemCount())
+ validationMsg("There are no m_items", V_Warn);
+ foreach (Item* item, m_items)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 items with id %2").arg(i.value()).arg(i.key()));
+ if (!item->isValid())
valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 items with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[item->id()])
+ validationMsg(QString("Duplicate item with id %1").arg(item->id()));
+ idChecker[item->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getItemTypeCount())
- {
- validationMsg("There are no item types", getItemCount() ? V_Error : V_Warn);
- if (getItemCount())
- valid = false;
- }
- for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
+ if (!itemTypeCount())
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 item types with id %2").arg(i.value()).arg(i.key()));
+ validationMsg("There are no item types", itemCount() ? V_Error : V_Warn);
+ if (itemCount())
valid = false;
- }
}
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
+ foreach (ItemType* itemType, m_itemTypes)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 item types with the name \"%2\"").arg(i.value()).arg(i.key()));
+ if (!itemType->isValid())
valid = false;
- }
+ if (idChecker[itemType->id()])
+ validationMsg(QString("Duplicate item type with id %1").arg(itemType->id()));
+ idChecker[itemType->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getMapCount())
+ if (!mapCount())
{
- validationMsg("There are no maps");
+ validationMsg("There are no m_maps");
valid = false;
}
- for (QListIterator<Map*> i(maps); i.hasNext(); i.next())
+ foreach (Map* map, m_maps)
{
- if (!i.peekNext()->isValid())
+ if (!map->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 maps with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 maps with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[map->id()])
+ validationMsg(QString("Duplicate map with id %1").arg(map->id()));
+ idChecker[map->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getMoveCount())
+ if (!moveCount())
{
- validationMsg("There are no moves");
+ validationMsg("There are no m_moves");
valid = false;
}
- for (QListIterator<Move*> i(moves); i.hasNext(); i.next())
+ foreach (Move* move, m_moves)
{
- if (!i.peekNext()->isValid())
+ if (!move->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 moves with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 moves with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[move->id()])
+ validationMsg(QString("Duplicate move with id %1").arg(move->id()));
+ idChecker[move->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (rules.getNatureAllowed())
+ if (m_rules.natureAllowed())
{
- if (!getNatureCount())
+ if (!natureCount())
{
validationMsg("There are no natures");
valid = false;
}
- for (QListIterator<Nature*> i(natures); i.hasNext(); i.next())
+ foreach (Nature* nature, m_natures)
{
- if (!i.peekNext()->isValid())
+ if (!nature->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 natures with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 natures with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[nature->id()])
+ validationMsg(QString("Duplicate ability with id %1").arg(nature->id()));
+ idChecker[nature->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
}
- if (!getSpeciesCount())
+ if (!speciesCount())
{
- validationMsg("There are no species");
+ validationMsg("There are no m_species");
valid = false;
}
- for (QListIterator<Species*> i(species); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 species with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
+ foreach (Species* m_species, m_species)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 species with the name \"%2\"").arg(i.value()).arg(i.key()));
+ if (!m_species->isValid())
valid = false;
- }
+ if (idChecker[m_species->id()])
+ validationMsg(QString("Duplicate m_species with id %1").arg(m_species->id()));
+ idChecker[m_species->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getStoreCount())
- validationMsg("There are no stores", V_Warn);
- for (QListIterator<Store*> i(stores); i.hasNext(); i.next())
+ if (!storeCount())
+ validationMsg("There are no m_stores", V_Warn);
+ foreach (Store* store, m_stores)
{
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 stores with id %2").arg(i.value()).arg(i.key()));
+ if (!store->isValid())
valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 stores with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[store->id()])
+ validationMsg(QString("Duplicate store with id %1").arg(store->id()));
+ idChecker[store->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (getTileCount())
- {
- for (QListIterator<Tile*> i(tiles); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
- valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 tiles with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 tiles with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- idChecker.clear();
- nameChecker.clear();
- }
- else
+ if (!tileCount())
{
- validationMsg("There are no tiles");
+ validationMsg("There are no m_tiles");
valid = false;
}
- if (!getTrainerCount())
+ foreach (Tile* tile, m_tiles)
{
- validationMsg("There are no times", Pokemod::V_Warn);
- }
- for (QListIterator<Trainer*> i(trainers); i.hasNext(); i.next())
- {
- if (!i.peekNext()->isValid())
+ if (!tile->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
+ if (idChecker[tile->id()])
+ validationMsg(QString("Duplicate tile with id %1").arg(tile->id()));
+ idChecker[tile->id()] = true;
}
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
+ idChecker.clear();
+ if (!trainerCount())
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 trainers with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ validationMsg("There are no times", Pokemod::V_Warn);
}
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
+ foreach (Trainer* trainer, m_trainers)
{
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 trianers with the name \"%2\"").arg(i.value()).arg(i.key()));
+ if (!trainer->isValid())
valid = false;
- }
+ if (idChecker[trainer->id()])
+ validationMsg(QString("Duplicate trainer with id %1").arg(trainer->id()));
+ idChecker[trainer->id()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getTimeCount())
+ if (!timeCount())
{
validationMsg("There are no times");
valid = false;
}
- for (QListIterator<Time*> i(times); i.hasNext(); i.next())
+ foreach (Time* time, m_times)
{
- if (!i.peekNext()->isValid())
+ if (!time->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- ++timeChecker[(60 * i.peekNext()->getStartHour()) + i.peekNext()->getStartMinute()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 times with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 times with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<int, int> i(timeChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 times that start at %2:%3").arg(i.value()).arg(i.key() / 60).arg(i.key() % 60));
- valid = false;
- }
+ if (idChecker[time->id()])
+ validationMsg(QString("Duplicate time with id %1").arg(time->id()));
+ idChecker[time->id()] = true;
+ if (timeChecker[(60 * time->hour()) + time->minute()])
+ validationMsg(QString("Duplicate time at %1:%2").arg(time->hour()).arg(time->minute()));
+ timeChecker[(60 * time->hour()) + time->minute()] = true;
}
idChecker.clear();
- nameChecker.clear();
- if (!getTypeCount())
+ if (!typeCount())
{
validationMsg("There are no types");
valid = false;
}
- for (QListIterator<Type*> i(types); i.hasNext(); i.next())
+ foreach (Type* type, m_types)
{
- if (!i.peekNext()->isValid())
+ if (!type->isValid())
valid = false;
- ++idChecker[i.peekNext()->getId()];
- ++nameChecker[i.peekNext()->getName()];
- }
- for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 types with id %2").arg(i.value()).arg(i.key()));
- valid = false;
- }
- }
- for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next())
- {
- if (1 < i.value())
- {
- validationMsg(QString("There are %1 types with the name \"%2\"").arg(i.value()).arg(i.key()));
- valid = false;
- }
+ if (idChecker[type->id()])
+ validationMsg(QString("Duplicate type with id %1").arg(type->id()));
+ idChecker[type->id()] = true;
}
return valid;
}
-int Pokemod::getNewAbilityId() const
-{
- int i = 0;
- for (; (i < getAbilityCount()) && (getAbilityIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewAuthorId() const
-{
- int i = 0;
- for (; (i < getAuthorCount()) && (getAuthorIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewBadgeId() const
-{
- int i = 0;
- for (; (i < getBadgeCount()) && (getBadgeIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewCoinListId() const
-{
- int i = 0;
- for (; (i < getCoinListCount()) && (getCoinListIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewDialogId() const
-{
- int i = 0;
- for (; (i < getDialogCount()) && (getDialogIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewEggGroupId() const
-{
- int i = 0;
- for (; (i < getEggGroupCount()) && (getEggGroupIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewItemId() const
-{
- int i = 0;
- for (; (i < getItemCount()) && (getItemIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewItemTypeId() const
-{
- int i = 0;
- for (; (i < getItemTypeCount()) && (getItemTypeIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewMapId() const
-{
- int i = 0;
- for (; (i < getMapCount()) && (getMapIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewMoveId() const
-{
- int i = 0;
- for (; (i < getMoveCount()) && (getMoveIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewNatureId() const
-{
- int i = 0;
- for (; (i < getNatureCount()) && (getNatureIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewSpeciesId() const
-{
- int i = 0;
- for (; (i < getSpeciesCount()) && (getSpeciesIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewStoreId() const
-{
- int i = 0;
- for (; (i < getStoreCount()) && (getStoreIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewTileId() const
-{
- int i = 0;
- for (; (i < getTileCount()) && (getTileIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewTimeId() const
-{
- int i = 0;
- for (; (i < getTimeCount()) && (getTimeIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewTrainerId() const
-{
- int i = 0;
- for (; (i < getTrainerCount()) && (getTrainerIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-int Pokemod::getNewTypeId() const
-{
- int i = 0;
- for (; (i < getTypeCount()) && (getTypeIndex(i) != -1); ++i)
- ;
- return i;
-}
-
-void Pokemod::load(const QString& fname, const int) throw(Exception)
-{
- Ini ini(fname);
- path = fname.split('\\', QString::SkipEmptyParts).join("/").split("/", QString::SkipEmptyParts).join("/");
- ini.getValue("title", title);
- ini.getValue("version", version);
- ini.getValue("description", description);
- ini.getValue("startMap", startMap);
- ini.getValue("startWarp", startWarp);
- ini.getValue("superPCUname", superPCUname);
- ini.getValue("superPCPasswd", superPCPasswd);
- QDir fdir(getPath());
- if (QFile::exists(QString("%1/rules.pini").arg(getPath())))
- rules.load(QString("%1/rules.pini").arg(getPath()));
- abilities.clear();
+void Pokemod::load(const QString& fileName, const int) throw(Exception)
+{
+ Ini ini(fileName);
+ m_path = fileName.split('\\', QString::SkipEmptyParts).join("/").split("/", QString::SkipEmptyParts).join("/");
+ ini.getValue("title", m_title);
+ ini.getValue("version", m_version);
+ ini.getValue("description", m_description);
+ ini.getValue("startMap", m_startMap);
+ ini.getValue("startWarp", m_startWarp);
+ ini.getValue("superPCUname", m_superPCUname);
+ ini.getValue("superPCPasswd", m_superPCPasswd);
+ QDir fdir(path());
+ if (QFile::exists(QString("%1/rules.pini").arg(path())))
+ m_rules.load(QString("%1/rules.pini").arg(path()));
+ m_abilities.clear();
if (fdir.cd("ability"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newAbility(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newAbility(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- authors.clear();
+ m_authors.clear();
if (fdir.cd("author"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newAuthor(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newAuthor(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- badges.clear();
+ m_badges.clear();
if (fdir.cd("badge"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newBadge(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newBadge(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- coinLists.clear();
+ m_coinLists.clear();
if (fdir.cd("coinlist"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newCoinList(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newCoinList(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- dialogs.clear();
+ m_dialogs.clear();
if (fdir.cd("dialog"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newDialog(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newDialog(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- eggGroups.clear();
+ m_eggGroups.clear();
if (fdir.cd("egggroup"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newEggGroup(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newEggGroup(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- items.clear();
+ m_items.clear();
if (fdir.cd("item"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newItem(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newItem(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- itemTypes.clear();
+ m_itemTypes.clear();
if (fdir.cd("itemtype"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newItemType(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newItemType(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- maps.clear();
+ m_maps.clear();
if (fdir.cd("map"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newMap(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newMap(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- moves.clear();
+ m_moves.clear();
if (fdir.cd("move"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newMove(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newMove(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- natures.clear();
+ m_natures.clear();
if (fdir.cd("nature"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newNature(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newNature(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- species.clear();
- if (fdir.cd("species"))
+ m_species.clear();
+ if (fdir.cd("m_species"))
{
- for (QStringListIterator i(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)); i.hasNext(); )
- newSpecies(QString("%1/data.pini").arg(i.next()));
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newSpecies(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- stores.clear();
+ m_stores.clear();
if (fdir.cd("store"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newStore(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newStore(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- tiles.clear();
+ m_tiles.clear();
if (fdir.cd("tile"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newTile(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newTile(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- trainers.clear();
+ m_trainers.clear();
if (fdir.cd("trainer"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newTrainer(i.next());
- fdir.cdUp();
- }
- trainers.clear();
- if (fdir.cd("time"))
- {
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newTime(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newTrainer(QString("%1/data.pini").arg(dir));
fdir.cdUp();
}
- types.clear();
+ m_types.clear();
if (fdir.cd("type"))
{
- for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); )
- newType(i.next());
+ QStringList dirs(fdir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name));
+ foreach (QString dir, dirs)
+ newType(QString("%1/data.pini").arg(dir));
}
- for (int i = 0; i < getTypeCount(); ++i)
+ for (int i = 0; i < typeCount(); ++i)
{
- for (int j = 0; j < getTypeCount(); ++j)
+ for (int j = 0; j < typeCount(); ++j)
{
int k;
int l;
@@ -999,68 +595,64 @@ void Pokemod::load(const QString& fname, const int) throw(Exception)
void Pokemod::save() const throw(Exception)
{
Ini ini;
- ini.addField("title", title);
- ini.addField("version", version);
- ini.addField("description", description);
- ini.addField("startMap", startMap);
- ini.addField("startWarp", startWarp);
- ini.addField("superPCUname", superPCUname);
- ini.addField("superPCPasswd", superPCPasswd);
- for (int i = 1; i < typeChart.getWidth(); ++i)
- {
- for (int j = 1; j < typeChart.getHeight(); ++j)
+ ini.addField("title", m_title);
+ ini.addField("version", m_version);
+ ini.addField("description", m_description);
+ ini.addField("startMap", m_startMap);
+ ini.addField("startWarp", m_startWarp);
+ ini.addField("superPCUname", m_superPCUname);
+ ini.addField("superPCPasswd", m_superPCPasswd);
+ for (int i = 1; i < m_typeChart.width(); ++i)
+ {
+ for (int j = 1; j < m_typeChart.height(); ++j)
{
- ini.addField(QString("typeChart-%1-%2-n").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getNum());
- ini.addField(QString("typeChart-%1-%2-d").arg(typeChart(i, 0).getNum()).arg(typeChart(0, j).getNum()), typeChart(i, j).getDenom());
+ ini.addField(QString("typeChart-%1-%2-n").arg(i).arg(j), m_typeChart(i, j).numerator());
+ ini.addField(QString("typeChart-%1-%2-d").arg(i).arg(j), m_typeChart(i, j).denominator());
}
}
- ini.save(QString("%1/data.pini").arg(getPath()));
- rules.save();
- for (QListIterator<Ability*> i(abilities); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Author*> i(authors); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Badge*> i(badges); i.hasNext(); )
- i.next()->save();
- for (QListIterator<CoinList*> i(coinLists); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Dialog*> i(dialogs); i.hasNext(); )
- i.next()->save();
- for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Item*> i(items); i.hasNext(); )
- i.next()->save();
- for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Map*> i(maps); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Move*> i(moves); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Nature*> i(natures); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Species*> i(species); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Store*> i(stores); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Tile*> i(tiles); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Time*> i(times); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Trainer*> i(trainers); i.hasNext(); )
- i.next()->save();
- for (QListIterator<Type*> i(types); i.hasNext(); )
- i.next()->save();
-}
-
-QString Pokemod::getPath() const
-{
- return path;
-}
-
-void Pokemod::setPath(const QString& p)
-{
- copyDir(path, p);
- path = p;
+ ini.save(QString("%1/data.pini").arg(path()));
+ m_rules.save();
+ foreach (Ability* ability, m_abilities)
+ ability->save();
+ foreach (Author* author, m_authors)
+ author->save();
+ foreach (Badge* badge, m_badges)
+ badge->save();
+ foreach (CoinList* coinList, m_coinLists)
+ coinList->save();
+ foreach (Dialog* dialog, m_dialogs)
+ dialog->save();
+ foreach (EggGroup* eggGroup, m_eggGroups)
+ eggGroup->save();
+ foreach (Item* item, m_items)
+ item->save();
+ foreach (ItemType* itemType, m_itemTypes)
+ itemType->save();
+ foreach (Map* map, m_maps)
+ map->save();
+ foreach (Species* m_species, m_species)
+ m_species->save();
+ foreach (Store* store, m_stores)
+ store->save();
+ foreach (Tile* tile, m_tiles)
+ tile->save();
+ foreach (Time* time, m_times)
+ time->save();
+ foreach (Trainer* trainer, m_trainers)
+ trainer->save();
+ foreach (Type* type, m_types)
+ type->save();
+}
+
+QString Pokemod::path() const
+{
+ return m_path;
+}
+
+void Pokemod::setPath(const QString& path)
+{
+ copyDir(m_path, path);
+ m_path = path;
}
void Pokemod::copyDir(const QString& src, const QString& dest) const
@@ -1073,7 +665,7 @@ void Pokemod::copyDir(const QString& src, const QString& dest) const
QFile::copy(QString("%1/%2").arg(src).arg(list[i]), QString("%1/%2").arg(dest).arg(list[i]));
}
-int Pokemod::maxCompatability(const Pokemod& p) const
+int Pokemod::maxCompatability(const Pokemod& pokemod) const
{
// TODO (Ben #1#): MaxCompatability between two versions
}
@@ -1081,9 +673,9 @@ int Pokemod::maxCompatability(const Pokemod& p) const
void Pokemod::validationMsg(const QString& msg, Validation val) const throw(Exception)
{
if (!valOutput)
- throw(Exception(className, "valOutput isn\'t set"));
+ throw(Exception(className(), "valOutput isn\'t set"));
if (V_End < val)
- throw(BoundsException(className, "val"));
+ throw(BoundsException(className(), "val"));
(*valOutput) << ValidationStr[val] << QDateTime::currentDateTime().toString(" (yyyyMMdd hh:mm:ss.zzz ddd): ") << msg;
}
@@ -1097,1395 +689,1599 @@ void Pokemod::unsetValOutput()
valOutput = NULL;
}
-void Pokemod::setTitle(const QString& t)
+void Pokemod::setTitle(const QString& title)
{
- title = t;
+ m_title = title;
}
-void Pokemod::setVersion(const QString& v)
+void Pokemod::setVersion(const QString& version)
{
- version = v;
+ m_version = version;
}
-void Pokemod::setDescription(const QString& d)
+void Pokemod::setDescription(const QString& description)
{
- description = d;
+ m_description = description;
}
-void Pokemod::setStartMap(const int s) throw(BoundsException)
+void Pokemod::setStartMap(const int startMap) throw(BoundsException)
{
- if (getMapIndex(s) == -1)
- throw(BoundsException(className, "startMap"));
- startMap = s;
+ if (mapIndex(startMap) == INT_MAX)
+ throw(BoundsException(className(), "startMap"));
+ m_startMap = startMap;
}
-void Pokemod::setStartWarp(const int s) throw(BoundsException)
+void Pokemod::setStartWarp(const int startWarp) throw(BoundsException)
{
- if (getMapIndex(startMap) == -1)
- throw(BoundsException(className, "startMap"));
- if (getMapByID(startMap)->getWarpIndex(s) == -1)
- throw(BoundsException(className, "startWarp"));
- startWarp = s;
+ if (mapIndex(m_startMap) == INT_MAX)
+ throw(BoundsException(className(), "startMap"));
+ if (mapById(m_startMap)->warpIndex(startWarp) == INT_MAX)
+ throw(BoundsException(className(), "startWarp"));
+ m_startWarp = startWarp;
}
-void Pokemod::setWalkSkin(const QString& fname) throw(Exception)
+void Pokemod::setWalkSkin(const QString& fileName) throw(Exception)
{
- QFile file(getWalkSkin());
+ QFile file(walkSkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getWalkSkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, walkSkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setBikeSkin(const QString& fname) throw(Exception)
+void Pokemod::setBikeSkin(const QString& fileName) throw(Exception)
{
- QFile file(getBikeSkin());
+ QFile file(bikeSkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getBikeSkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, bikeSkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setSurfSkin(const QString& fname) throw(Exception)
+void Pokemod::setSurfSkin(const QString& fileName) throw(Exception)
{
- QFile file(getSurfSkin());
+ QFile file(surfSkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getSurfSkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, surfSkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setFlySkin(const QString& fname) throw(Exception)
+void Pokemod::setFlySkin(const QString& fileName) throw(Exception)
{
- QFile file(getFlySkin());
+ QFile file(flySkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getFlySkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, flySkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setFishSkin(const QString& fname) throw(Exception)
+void Pokemod::setFishSkin(const QString& fileName) throw(Exception)
{
- QFile file(getFishSkin());
+ QFile file(fishSkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getFishSkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, fishSkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setSurfFishSkin(const QString& fname) throw(Exception)
+void Pokemod::setSurfFishSkin(const QString& fileName) throw(Exception)
{
- QFile file(getSurfFishSkin());
+ QFile file(surfFishSkin());
if (file.exists() && !file.remove())
- throw(RemoveException(className, file.fileName()));
- if (!QFile::copy(fname, getSurfFishSkin()))
- throw(SaveException(className, file.fileName()));
+ throw(RemoveException(className(), file.fileName()));
+ if (!QFile::copy(fileName, surfFishSkin()))
+ throw(SaveException(className(), file.fileName()));
}
-void Pokemod::setSuperPCUname(const QString& u)
+void Pokemod::setSuperPCUname(const QString& username)
{
- superPCUname = u;
+ m_superPCUname = username;
}
-void Pokemod::setSuperPCPasswd(const QString& p)
+void Pokemod::setSuperPCPasswd(const QString& password)
{
- superPCPasswd = p;
+ m_superPCPasswd = password;
}
-void Pokemod::setTypeChart(const int att, const int def, const int n, const int d) throw(Exception)
+void Pokemod::setTypeChart(const int attack, const int defense, const int numerator, const int denominator) throw(Exception)
{
- typeChart(att, def).set(n, d);
+ m_typeChart(attack, defense).set(numerator, denominator);
}
-void Pokemod::setTypeChartNum(const int att, const int def, const int n) throw(Exception)
+void Pokemod::setRules(const Rules& rules)
{
- typeChart(att, def).setNum(n);
+ m_rules = rules;
}
-void Pokemod::setTypeChartDenom(const int att, const int def, const int d) throw(Exception)
+void Pokemod::setRules(const QString& fileName)
{
- typeChart(att, def).setDenom(d);
+ m_rules.load(fileName);
}
-void Pokemod::setRules(const Rules& r)
+QString Pokemod::title() const
{
- rules = r;
+ return m_title;
}
-void Pokemod::setRules(const QString& fname)
+QString Pokemod::version() const
{
- rules.load(fname);
+ return m_version;
}
-QString Pokemod::getTitle() const
+QString Pokemod::description() const
{
- return title;
+ return m_description;
}
-QString Pokemod::getVersion() const
+int Pokemod::startMap() const
{
- return version;
+ return m_startMap;
}
-QString Pokemod::getDescription() const
+int Pokemod::startWarp() const
{
- return description;
+ return m_startWarp;
}
-int Pokemod::getStartMap() const
+QString Pokemod::walkSkin() const
{
- return startMap;
+ return QString("%1/image/skin/walk.png").arg(path());
}
-int Pokemod::getStartWarp() const
+QString Pokemod::bikeSkin() const
{
- return startWarp;
+ return QString("%1/image/skin/bike.png").arg(path());
}
-QString Pokemod::getWalkSkin() const
+QString Pokemod::surfSkin() const
{
- return QString("%1/image/skin/walk.png").arg(getPath());
+ return QString("%1/image/skin/surf.png").arg(path());
}
-QString Pokemod::getBikeSkin() const
+QString Pokemod::flySkin() const
{
- return QString("%1/image/skin/bike.png").arg(getPath());
+ return QString("%1/image/skin/fly.png").arg(path());
}
-QString Pokemod::getSurfSkin() const
+QString Pokemod::fishSkin() const
{
- return QString("%1/image/skin/surf.png").arg(getPath());
+ return QString("%1/image/skin/fish.png").arg(path());
}
-QString Pokemod::getFlySkin() const
+QString Pokemod::surfFishSkin() const
{
- return QString("%1/image/skin/fly.png").arg(getPath());
+ return QString("%1/image/skin/surfFish.png").arg(path());
}
-QString Pokemod::getFishSkin() const
+QString Pokemod::superPCUname() const
{
- return QString("%1/image/skin/fish.png").arg(getPath());
+ return m_superPCUname;
}
-QString Pokemod::getSurfFishSkin() const
+QString Pokemod::superPCPasswd() const
{
- return QString("%1/image/skin/surfFish.png").arg(getPath());
+ return m_superPCPasswd;
}
-QString Pokemod::getSuperPCUname() const
+const Matrix<Frac>* Pokemod::typeChart() const
{
- return superPCUname;
+ return &m_typeChart;
}
-QString Pokemod::getSuperPCPasswd() const
+Matrix<Frac>* Pokemod::typeChart()
{
- return superPCPasswd;
+ return &m_typeChart;
}
-const Matrix<Frac>* Pokemod::getTypeChart() const
+Frac Pokemod::typeChart(const int attack, const int defense) const
{
- return &typeChart;
+ return m_typeChart(attack, defense);
}
-Matrix<Frac>* Pokemod::getTypeChart()
+const Rules* Pokemod::rules() const
{
- return &typeChart;
+ return &m_rules;
}
-Frac Pokemod::getTypeChart(const int att, const int def) const
+Rules* Pokemod::rules()
{
- return typeChart(att, def);
+ return &m_rules;
}
-const Rules* Pokemod::getRules() const
+const Ability* Pokemod::ability(const int index) const throw(IndexException)
{
- return &rules;
+ if (abilityCount() <= index)
+ throw(IndexException(className()));
+ return m_abilities.at(index);
}
-Rules* Pokemod::getRules()
+Ability* Pokemod::ability(const int index) throw(IndexException)
{
- return &rules;
+ if (abilityCount() <= index)
+ throw(IndexException(className()));
+ return m_abilities[index];
}
-const Ability* Pokemod::getAbility(const int i) const throw(IndexException)
+const Ability* Pokemod::abilityById(const int id) const throw(IndexException)
{
- if (getAbilityCount() <= i)
- throw(IndexException(className));
- return abilities.at(i);
+ return ability(abilityIndex(id));
}
-Ability* Pokemod::getAbility(const int i) throw(IndexException)
+Ability* Pokemod::abilityById(const int id) throw(IndexException)
{
- if (getAbilityCount() <= i)
- throw(IndexException(className));
- return abilities[i];
+ return ability(abilityIndex(id));
}
-const Ability* Pokemod::getAbilityByID(const int i) const throw(IndexException)
+int Pokemod::abilityIndex(const int id) const
{
- return getAbility(getAbilityIndex(i));
+ for (int i = 0; i < abilityCount(); ++i)
+ {
+ if (m_abilities[i]->id() == id)
+ return i;
+ }
+ return INT_MAX;
}
-Ability* Pokemod::getAbilityByID(const int i) throw(IndexException)
+int Pokemod::abilityCount() const
{
- return getAbility(getAbilityIndex(i));
+ return m_abilities.size();
}
-int Pokemod::getAbilityIndex(const int _id) const
+Ability* Pokemod::newAbility()
{
- for (int i = 0; i < getAbilityCount(); ++i)
- {
- if (abilities[i]->getId() == _id)
- return i;
- }
- return -1;
+ m_abilities.append(new Ability(this, newAbilityId()));
+ return m_abilities[abilityCount() - 1];
}
-int Pokemod::getAbilityCount() const
+Ability* Pokemod::newAbility(const QString& fileName)
{
- return abilities.size();
+ m_abilities.append(new Ability(this, fileName, newAbilityId()));
+ return m_abilities[abilityCount() - 1];
}
-Ability* Pokemod::newAbility()
+Ability* Pokemod::newAbility(const Ability& ability)
{
- abilities.append(new Ability(this, getNewAbilityId()));
- return abilities[getAbilityCount() - 1];
+ m_abilities.append(new Ability(this, ability, newAbilityId()));
+ return m_abilities[abilityCount() - 1];
}
-Ability* Pokemod::newAbility(const QString& fname)
+void Pokemod::deleteAbility(const int index) throw(IndexException)
{
- abilities.append(new Ability(this, fname, getNewAbilityId()));
- return abilities[getAbilityCount() - 1];
+ if (abilityCount() <= index)
+ throw(IndexException(className()));
+ delete m_abilities[index];
+ m_abilities.removeAt(index);
}
-Ability* Pokemod::newAbility(const Ability& a)
+void Pokemod::deleteAbilityById(const int id) throw(IndexException)
{
- abilities.append(new Ability(this, a, getNewAbilityId()));
- return abilities[getAbilityCount() - 1];
+ deleteAbility(abilityIndex(id));
}
-void Pokemod::deleteAbility(const int i) throw(IndexException)
+int Pokemod::newAbilityId() const
{
- if (getAbilityCount() <= i)
- throw(IndexException(className));
- delete abilities[i];
- abilities.removeAt(i);
+ int i = 0;
+ while ((i < abilityCount()) && (abilityIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Author* Pokemod::getAuthor(const int i) const throw(IndexException)
+const Author* Pokemod::author(const int index) const throw(IndexException)
{
- if (getAuthorCount() <= i)
- throw(IndexException(className));
- return authors.at(i);
+ if (authorCount() <= index)
+ throw(IndexException(className()));
+ return m_authors.at(index);
}
-Author* Pokemod::getAuthor(const int i) throw(IndexException)
+Author* Pokemod::author(const int index) throw(IndexException)
{
- if (getAuthorCount() <= i)
- throw(IndexException(className));
- return authors[i];
+ if (authorCount() <= index)
+ throw(IndexException(className()));
+ return m_authors[index];
}
-const Author* Pokemod::getAuthorByID(const int i) const throw(IndexException)
+const Author* Pokemod::authorById(const int id) const throw(IndexException)
{
- return getAuthor(getAuthorIndex(i));
+ return author(authorIndex(id));
}
-Author* Pokemod::getAuthorByID(const int i) throw(IndexException)
+Author* Pokemod::authorById(const int id) throw(IndexException)
{
- return getAuthor(getAuthorIndex(i));
+ return author(authorIndex(id));
}
-int Pokemod::getAuthorIndex(const int _id) const
+int Pokemod::authorIndex(const int id) const
{
- for (int i = 0; i < getAuthorCount(); ++i)
+ for (int i = 0; i < authorCount(); ++i)
{
- if (authors[i]->getId() == _id)
+ if (m_authors[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getAuthorCount() const
+int Pokemod::authorCount() const
{
- return authors.size();
+ return m_authors.size();
}
Author* Pokemod::newAuthor()
{
- authors.append(new Author(this, getNewAuthorId()));
- return authors[getAuthorCount() - 1];
+ m_authors.append(new Author(this, newAuthorId()));
+ return m_authors[authorCount() - 1];
}
-Author* Pokemod::newAuthor(const QString& fname)
+Author* Pokemod::newAuthor(const QString& fileName)
{
- authors.append(new Author(this, fname, getNewAuthorId()));
- return authors[getAuthorCount() - 1];
+ m_authors.append(new Author(this, fileName, newAuthorId()));
+ return m_authors[authorCount() - 1];
}
-Author* Pokemod::newAuthor(const Author& a)
+Author* Pokemod::newAuthor(const Author& author)
{
- authors.append(new Author(this, a, getNewAuthorId()));
- return authors[getAuthorCount() - 1];
+ m_authors.append(new Author(this, author, newAuthorId()));
+ return m_authors[authorCount() - 1];
}
-void Pokemod::deleteAuthor(const int i) throw(IndexException)
+void Pokemod::deleteAuthor(const int index) throw(IndexException)
{
- if (getAuthorCount() <= i)
- throw(IndexException(className));
- delete authors[i];
- authors.removeAt(i);
+ if (authorCount() <= index)
+ throw(IndexException(className()));
+ delete m_authors[index];
+ m_authors.removeAt(index);
}
-const Badge* Pokemod::getBadge(const int i) const throw(IndexException)
+void Pokemod::deleteAuthorById(const int id) throw(IndexException)
{
- if (i < getBadgeCount())
- throw(IndexException(className));
- return badges.at(i);
+ deleteAuthor(authorIndex(id));
}
-Badge* Pokemod::getBadge(const int i) throw(IndexException)
+int Pokemod::newAuthorId() const
{
- if (i < getBadgeCount())
- throw(IndexException(className));
- return badges[i];
+ int i = 0;
+ while ((i < authorCount()) && (authorIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Badge* Pokemod::getBadgeByID(const int i) const throw(IndexException)
+const Badge* Pokemod::badge(const int index) const throw(IndexException)
{
- return getBadge(getBadgeIndex(i));
+ if (badgeCount() <= index)
+ throw(IndexException(className()));
+ return m_badges.at(index);
}
-Badge* Pokemod::getBadgeByID(const int i) throw(IndexException)
+Badge* Pokemod::badge(const int index) throw(IndexException)
{
- return getBadge(getBadgeIndex(i));
+ if (badgeCount() <= index)
+ throw(IndexException(className()));
+ return m_badges[index];
}
-int Pokemod::getBadgeIndex(const int _id) const
+const Badge* Pokemod::badgeById(const int id) const throw(IndexException)
{
- for (int i = 0; i < getBadgeCount(); ++i)
+ return badge(badgeIndex(id));
+}
+
+Badge* Pokemod::badgeById(const int id) throw(IndexException)
+{
+ return badge(badgeIndex(id));
+}
+
+int Pokemod::badgeIndex(const int id) const
+{
+ for (int i = 0; i < badgeCount(); ++i)
{
- if (badges[i]->getId() == _id)
+ if (m_badges[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getBadgeCount() const
+int Pokemod::badgeCount() const
{
- return badges.size();
+ return m_badges.size();
}
Badge* Pokemod::newBadge()
{
- badges.append(new Badge(this, getNewBadgeId()));
- return badges[getBadgeCount() - 1];
+ m_badges.append(new Badge(this, newBadgeId()));
+ return m_badges[badgeCount() - 1];
}
-Badge* Pokemod::newBadge(const QString& fname)
+Badge* Pokemod::newBadge(const QString& fileName)
{
- badges.append(new Badge(this, fname, getNewBadgeId()));
- return badges[getBadgeCount() - 1];
+ m_badges.append(new Badge(this, fileName, newBadgeId()));
+ return m_badges[badgeCount() - 1];
}
-Badge* Pokemod::newBadge(const Badge& b)
+Badge* Pokemod::newBadge(const Badge& badge)
{
- badges.append(new Badge(this, b, getNewBadgeId()));
- return badges[getBadgeCount() - 1];
+ m_badges.append(new Badge(this, badge, newBadgeId()));
+ return m_badges[badgeCount() - 1];
}
-void Pokemod::deleteBadge(const int i) throw(IndexException)
+void Pokemod::deleteBadge(const int index) throw(IndexException)
{
- if (getBadgeCount() <= i)
- throw(IndexException(className));
- delete badges[i];
- badges.removeAt(i);
+ if (badgeCount() <= index)
+ throw(IndexException(className()));
+ delete m_badges[index];
+ m_badges.removeAt(index);
+}
+
+void Pokemod::deleteBadgeById(const int id) throw(IndexException)
+{
+ deleteBadge(badgeIndex(id));
+}
+
+int Pokemod::newBadgeId() const
+{
+ int i = 0;
+ while ((i < badgeCount()) && (badgeIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const CoinList* Pokemod::getCoinList(const int i) const throw(IndexException)
+const CoinList* Pokemod::coinList(const int index) const throw(IndexException)
{
- if (getCoinListCount() <= i)
- throw(IndexException(className));
- return coinLists.at(i);
+ if (coinListCount() <= index)
+ throw(IndexException(className()));
+ return m_coinLists.at(index);
}
-CoinList* Pokemod::getCoinList(const int i) throw(IndexException)
+CoinList* Pokemod::coinList(const int index) throw(IndexException)
{
- if (getCoinListCount() <= i)
- throw(IndexException(className));
- return coinLists[i];
+ if (coinListCount() <= index)
+ throw(IndexException(className()));
+ return m_coinLists[index];
}
-const CoinList* Pokemod::getCoinListByID(const int i) const throw(IndexException)
+const CoinList* Pokemod::coinListById(const int id) const throw(IndexException)
{
- return getCoinList(getCoinListIndex(i));
+ return coinList(coinListIndex(id));
}
-CoinList* Pokemod::getCoinListByID(const int i) throw(IndexException)
+CoinList* Pokemod::coinListById(const int id) throw(IndexException)
{
- return getCoinList(getCoinListIndex(i));
+ return coinList(coinListIndex(id));
}
-int Pokemod::getCoinListIndex(const int _id) const
+int Pokemod::coinListIndex(const int id) const
{
- for (int i = 0; i < getCoinListCount(); ++i)
+ for (int i = 0; i < coinListCount(); ++i)
{
- if (coinLists[i]->getId() == _id)
+ if (m_coinLists[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getCoinListCount() const
+int Pokemod::coinListCount() const
{
- return coinLists.size();
+ return m_coinLists.size();
}
CoinList* Pokemod::newCoinList()
{
- coinLists.append(new CoinList(this, getNewCoinListId()));
- return coinLists[getCoinListCount() - 1];
+ m_coinLists.append(new CoinList(this, newCoinListId()));
+ return m_coinLists[coinListCount() - 1];
}
-CoinList* Pokemod::newCoinList(const QString& fname)
+CoinList* Pokemod::newCoinList(const QString& fileName)
{
- coinLists.append(new CoinList(this, fname, getNewCoinListId()));
- return coinLists[getCoinListCount() - 1];
+ m_coinLists.append(new CoinList(this, fileName, newCoinListId()));
+ return m_coinLists[coinListCount() - 1];
}
-CoinList* Pokemod::newCoinList(const CoinList& c)
+CoinList* Pokemod::newCoinList(const CoinList& coinList)
{
- coinLists.append(new CoinList(this, c, getNewCoinListId()));
- return coinLists[getCoinListCount() - 1];
+ m_coinLists.append(new CoinList(this, coinList, newCoinListId()));
+ return m_coinLists[coinListCount() - 1];
}
-void Pokemod::deleteCoinList(const int i) throw(IndexException)
+void Pokemod::deleteCoinList(const int index) throw(IndexException)
{
- if (getCoinListCount() <= i)
- throw(IndexException(className));
- delete coinLists[i];
- coinLists.removeAt(i);
+ if (coinListCount() <= index)
+ throw(IndexException(className()));
+ delete m_coinLists[index];
+ m_coinLists.removeAt(index);
}
-const Dialog* Pokemod::getDialog(const int i) const throw(IndexException)
+void Pokemod::deleteCoinListById(const int id) throw(IndexException)
{
- if (getDialogCount() <= i)
- throw(IndexException(className));
- return dialogs.at(i);
+ deleteCoinList(coinListIndex(id));
}
-Dialog* Pokemod::getDialog(const int i) throw(IndexException)
+int Pokemod::newCoinListId() const
{
- if (getDialogCount() <= i)
- throw(IndexException(className));
- return dialogs[i];
+ int i = 0;
+ while ((i < coinListCount()) && (coinListIndex(i) != INT_MAX))
+ ++i;
+ return i;
+}
+
+const Dialog* Pokemod::dialog(const int index) const throw(IndexException)
+{
+ if (dialogCount() <= index)
+ throw(IndexException(className()));
+ return m_dialogs.at(index);
+}
+
+Dialog* Pokemod::dialog(const int index) throw(IndexException)
+{
+ if (dialogCount() <= index)
+ throw(IndexException(className()));
+ return m_dialogs[index];
}
-const Dialog* Pokemod::getDialogByID(const int i) const throw(IndexException)
+const Dialog* Pokemod::dialogById(const int id) const throw(IndexException)
{
- return getDialog(getDialogIndex(i));
+ return dialog(dialogIndex(id));
}
-Dialog* Pokemod::getDialogByID(const int i) throw(IndexException)
+Dialog* Pokemod::dialogById(const int id) throw(IndexException)
{
- return getDialog(getDialogIndex(i));
+ return dialog(dialogIndex(id));
}
-int Pokemod::getDialogIndex(const int _id) const
+int Pokemod::dialogIndex(const int id) const
{
- for (int i = 0; i < getDialogCount(); ++i)
+ for (int i = 0; i < dialogCount(); ++i)
{
- if (dialogs[i]->getId() == _id)
+ if (m_dialogs[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getDialogCount() const
+int Pokemod::dialogCount() const
{
- return dialogs.size();
+ return m_dialogs.size();
}
Dialog* Pokemod::newDialog()
{
- dialogs.append(new Dialog(this, getNewDialogId()));
- return dialogs[getDialogCount() - 1];
+ m_dialogs.append(new Dialog(this, newDialogId()));
+ return m_dialogs[dialogCount() - 1];
+}
+
+Dialog* Pokemod::newDialog(const QString& fileName)
+{
+ m_dialogs.append(new Dialog(this, fileName, newDialogId()));
+ return m_dialogs[dialogCount() - 1];
+}
+
+Dialog* Pokemod::newDialog(const Dialog& dialog)
+{
+ m_dialogs.append(new Dialog(this, dialog, newDialogId()));
+ return m_dialogs[dialogCount() - 1];
}
-Dialog* Pokemod::newDialog(const QString& fname)
+void Pokemod::deleteDialog(const int index) throw(IndexException)
{
- dialogs.append(new Dialog(this, fname, getNewDialogId()));
- return dialogs[getDialogCount() - 1];
+ if (dialogCount() <= index)
+ throw(IndexException(className()));
+ delete m_dialogs[index];
+ m_dialogs.removeAt(index);
}
-Dialog* Pokemod::newDialog(const Dialog& d)
+void Pokemod::deleteDialogById(const int id) throw(IndexException)
{
- dialogs.append(new Dialog(this, d, getNewDialogId()));
- return dialogs[getDialogCount() - 1];
+ deleteDialog(dialogIndex(id));
}
-void Pokemod::deleteDialog(const int i) throw(IndexException)
+int Pokemod::newDialogId() const
{
- if (getDialogCount() <= i)
- throw(IndexException(className));
- delete dialogs[i];
- dialogs.removeAt(i);
+ int i = 0;
+ while ((i < dialogCount()) && (dialogIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const EggGroup* Pokemod::getEggGroup(const int i) const throw(IndexException)
+const EggGroup* Pokemod::eggGroup(const int index) const throw(IndexException)
{
- if (getEggGroupCount() <= i)
- throw(IndexException(className));
- return eggGroups.at(i);
+ if (eggGroupCount() <= index)
+ throw(IndexException(className()));
+ return m_eggGroups.at(index);
}
-EggGroup* Pokemod::getEggGroup(const int i) throw(IndexException)
+EggGroup* Pokemod::eggGroup(const int index) throw(IndexException)
{
- if (getEggGroupCount() <= i)
- throw(IndexException(className));
- return eggGroups[i];
+ if (eggGroupCount() <= index)
+ throw(IndexException(className()));
+ return m_eggGroups[index];
}
-const EggGroup* Pokemod::getEggGroupByID(const int i) const throw(IndexException)
+const EggGroup* Pokemod::eggGroupById(const int id) const throw(IndexException)
{
- return getEggGroup(getEggGroupIndex(i));
+ return eggGroup(eggGroupIndex(id));
}
-EggGroup* Pokemod::getEggGroupByID(const int i) throw(IndexException)
+EggGroup* Pokemod::eggGroupById(const int id) throw(IndexException)
{
- return getEggGroup(getEggGroupIndex(i));
+ return eggGroup(eggGroupIndex(id));
}
-int Pokemod::getEggGroupIndex(const int _id) const
+int Pokemod::eggGroupIndex(const int id) const
{
- for (int i = 0; i < getEggGroupCount(); ++i)
+ for (int i = 0; i < eggGroupCount(); ++i)
{
- if (eggGroups[i]->getId() == _id)
+ if (m_eggGroups[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getEggGroupCount() const
+int Pokemod::eggGroupCount() const
{
- return eggGroups.size();
+ return m_eggGroups.size();
}
EggGroup* Pokemod::newEggGroup()
{
- eggGroups.append(new EggGroup(this, getNewEggGroupId()));
- return eggGroups[getEggGroupCount() - 1];
+ m_eggGroups.append(new EggGroup(this, newEggGroupId()));
+ return m_eggGroups[eggGroupCount() - 1];
}
-EggGroup* Pokemod::newEggGroup(const QString& fname)
+EggGroup* Pokemod::newEggGroup(const QString& fileName)
{
- eggGroups.append(new EggGroup(this, fname, getNewEggGroupId()));
- return eggGroups[getEggGroupCount() - 1];
+ m_eggGroups.append(new EggGroup(this, fileName, newEggGroupId()));
+ return m_eggGroups[eggGroupCount() - 1];
}
-EggGroup* Pokemod::newEggGroup(const EggGroup& e)
+EggGroup* Pokemod::newEggGroup(const EggGroup& eggGroup)
{
- eggGroups.append(new EggGroup(this, e, getNewEggGroupId()));
- return eggGroups[getEggGroupCount() - 1];
+ m_eggGroups.append(new EggGroup(this, eggGroup, newEggGroupId()));
+ return m_eggGroups[eggGroupCount() - 1];
}
-void Pokemod::deleteEggGroup(const int i) throw(IndexException)
+void Pokemod::deleteEggGroup(const int index) throw(IndexException)
{
- if (getEggGroupCount() <= i)
- throw(IndexException(className));
- delete eggGroups[i];
- eggGroups.removeAt(i);
+ if (eggGroupCount() <= index)
+ throw(IndexException(className()));
+ delete m_eggGroups[index];
+ m_eggGroups.removeAt(index);
}
-const Item* Pokemod::getItem(const int i) const throw(IndexException)
+void Pokemod::deleteEggGroupById(const int id) throw(IndexException)
{
- if (getItemCount() <= i)
- throw(IndexException(className));
- return items.at(i);
+ deleteEggGroup(eggGroupIndex(id));
}
-Item* Pokemod::getItem(const int i) throw(IndexException)
+int Pokemod::newEggGroupId() const
{
- if (getItemCount() <= i)
- throw(IndexException(className));
- return items[i];
+ int i = 0;
+ while ((i < eggGroupCount()) && (eggGroupIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Item* Pokemod::getItemByID(const int i) const throw(IndexException)
+const Item* Pokemod::item(const int index) const throw(IndexException)
{
- return getItem(getItemIndex(i));
+ if (itemCount() <= index)
+ throw(IndexException(className()));
+ return m_items.at(index);
+}
+
+Item* Pokemod::item(const int index) throw(IndexException)
+{
+ if (itemCount() <= index)
+ throw(IndexException(className()));
+ return m_items[index];
+}
+
+const Item* Pokemod::itemById(const int id) const throw(IndexException)
+{
+ return item(itemIndex(id));
}
-Item* Pokemod::getItemByID(const int i) throw(IndexException)
+Item* Pokemod::itemById(const int id) throw(IndexException)
{
- return getItem(getItemIndex(i));
+ return item(itemIndex(id));
}
-int Pokemod::getItemIndex(const int _id) const
+int Pokemod::itemIndex(const int id) const
{
- for (int i = 0; i < getItemCount(); ++i)
+ for (int i = 0; i < itemCount(); ++i)
{
- if (items[i]->getId() == _id)
+ if (m_items[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getItemCount() const
+int Pokemod::itemCount() const
{
- return items.size();
+ return m_items.size();
}
Item* Pokemod::newItem()
{
- items.append(new Item(this, getNewItemId()));
- return items[getItemCount() - 1];
+ m_items.append(new Item(this, newItemId()));
+ return m_items[itemCount() - 1];
+}
+
+Item* Pokemod::newItem(const QString& fileName)
+{
+ m_items.append(new Item(this, fileName, newItemId()));
+ return m_items[itemCount() - 1];
}
-Item* Pokemod::newItem(const QString& fname)
+Item* Pokemod::newItem(const Item& item)
{
- items.append(new Item(this, fname, getNewItemId()));
- return items[getItemCount() - 1];
+ m_items.append(new Item(this, item, newItemId()));
+ return m_items[itemCount() - 1];
}
-Item* Pokemod::newItem(const Item& i)
+void Pokemod::deleteItem(const int index) throw(IndexException)
{
- items.append(new Item(this, i, getNewItemId()));
- return items[getItemCount() - 1];
+ if (itemCount() <= index)
+ throw(IndexException(className()));
+ delete m_items[index];
+ m_items.removeAt(index);
}
-void Pokemod::deleteItem(const int i) throw(IndexException)
+void Pokemod::deleteItemById(const int id) throw(IndexException)
{
- if (getItemCount() <= i)
- throw(IndexException(className));
- delete items[i];
- items.removeAt(i);
+ deleteItem(itemIndex(id));
}
-const ItemType* Pokemod::getItemType(const int i) const throw(IndexException)
+int Pokemod::newItemId() const
{
- if (getItemTypeCount() <= i)
- throw(IndexException(className));
- return itemTypes.at(i);
+ int i = 0;
+ for (; (i < itemCount()) && (itemIndex(i) != INT_MAX); ++i)
+ ;
+ return i;
}
-ItemType* Pokemod::getItemType(const int i) throw(IndexException)
+const ItemType* Pokemod::itemType(const int index) const throw(IndexException)
{
- if (getItemTypeCount() <= i)
- throw(IndexException(className));
- return itemTypes[i];
+ if (itemTypeCount() <= index)
+ throw(IndexException(className()));
+ return m_itemTypes.at(index);
}
-const ItemType* Pokemod::getItemTypeByID(const int i) const throw(IndexException)
+ItemType* Pokemod::itemType(const int index) throw(IndexException)
{
- return getItemType(getItemTypeIndex(i));
+ if (itemTypeCount() <= index)
+ throw(IndexException(className()));
+ return m_itemTypes[index];
}
-ItemType* Pokemod::getItemTypeByID(const int i) throw(IndexException)
+const ItemType* Pokemod::itemTypeById(const int id) const throw(IndexException)
{
- return getItemType(getItemTypeIndex(i));
+ return itemType(itemTypeIndex(id));
}
-int Pokemod::getItemTypeIndex(const int _id) const
+ItemType* Pokemod::itemTypeById(const int id) throw(IndexException)
{
- for (int i = 0; i < getItemTypeCount(); ++i)
+ return itemType(itemTypeIndex(id));
+}
+
+int Pokemod::itemTypeIndex(const int id) const
+{
+ for (int i = 0; i < itemTypeCount(); ++i)
{
- if (itemTypes[i]->getId() == _id)
+ if (m_itemTypes[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getItemTypeCount() const
+int Pokemod::itemTypeCount() const
{
- return itemTypes.size();
+ return m_itemTypes.size();
}
ItemType* Pokemod::newItemType()
{
- itemTypes.append(new ItemType(this, getNewItemTypeId()));
- return itemTypes[getItemTypeCount() - 1];
+ m_itemTypes.append(new ItemType(this, newItemTypeId()));
+ return m_itemTypes[itemTypeCount() - 1];
+}
+
+ItemType* Pokemod::newItemType(const QString& fileName)
+{
+ m_itemTypes.append(new ItemType(this, fileName, newItemTypeId()));
+ return m_itemTypes[itemTypeCount() - 1];
}
-ItemType* Pokemod::newItemType(const QString& fname)
+ItemType* Pokemod::newItemType(const ItemType& itemType)
{
- itemTypes.append(new ItemType(this, fname, getNewItemTypeId()));
- return itemTypes[getItemTypeCount() - 1];
+ m_itemTypes.append(new ItemType(this, itemType, newItemTypeId()));
+ return m_itemTypes[itemTypeCount() - 1];
}
-ItemType* Pokemod::newItemType(const ItemType& i)
+void Pokemod::deleteItemType(const int index) throw(IndexException)
{
- itemTypes.append(new ItemType(this, i, getNewItemTypeId()));
- return itemTypes[getItemTypeCount() - 1];
+ if (itemTypeCount() <= index)
+ throw(IndexException(className()));
+ delete m_itemTypes[index];
+ m_itemTypes.removeAt(index);
}
-void Pokemod::deleteItemType(const int i) throw(IndexException)
+void Pokemod::deleteItemTypeById(const int id) throw(IndexException)
{
- if (getItemTypeCount() <= i)
- throw(IndexException(className));
- delete itemTypes[i];
- itemTypes.removeAt(i);
+ deleteItemType(itemTypeIndex(id));
}
-const Map* Pokemod::getMap(const int i) const throw(IndexException)
+int Pokemod::newItemTypeId() const
{
- if (getMapCount() <= i)
- throw(IndexException(className));
- return maps.at(i);
+ int i = 0;
+ while ((i < itemTypeCount()) && (itemTypeIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-Map* Pokemod::getMap(const int i) throw(IndexException)
+const Map* Pokemod::map(const int index) const throw(IndexException)
{
- if (getMapCount() <= i)
- throw(IndexException(className));
- return maps[i];
+ if (mapCount() <= index)
+ throw(IndexException(className()));
+ return m_maps.at(index);
}
-const Map* Pokemod::getMapByID(const int i) const throw(IndexException)
+Map* Pokemod::map(const int index) throw(IndexException)
{
- return getMap(getMapIndex(i));
+ if (mapCount() <= index)
+ throw(IndexException(className()));
+ return m_maps[index];
}
-Map* Pokemod::getMapByID(const int i) throw(IndexException)
+const Map* Pokemod::mapById(const int id) const throw(IndexException)
{
- return getMap(getMapIndex(i));
+ return map(mapIndex(id));
}
-int Pokemod::getMapIndex(const int _id) const
+Map* Pokemod::mapById(const int id) throw(IndexException)
{
- for (int i = 0; i < getMapCount(); ++i)
+ return map(mapIndex(id));
+}
+
+int Pokemod::mapIndex(const int id) const
+{
+ for (int i = 0; i < mapCount(); ++i)
{
- if (maps[i]->getId() == _id)
+ if (m_maps[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getMapCount() const
+int Pokemod::mapCount() const
{
- return maps.size();
+ return m_maps.size();
}
Map* Pokemod::newMap()
{
- maps.append(new Map(this, getNewMapId()));
- return maps[getMapCount() - 1];
+ m_maps.append(new Map(this, newMapId()));
+ return m_maps[mapCount() - 1];
}
-Map* Pokemod::newMap(const QString& fname)
+Map* Pokemod::newMap(const QString& fileName)
{
- maps.append(new Map(this, fname, getNewMapId()));
- return maps[getMapCount() - 1];
+ m_maps.append(new Map(this, fileName, newMapId()));
+ return m_maps[mapCount() - 1];
}
-Map* Pokemod::newMap(const Map& m)
+Map* Pokemod::newMap(const Map& map)
{
- maps.append(new Map(this, m, getNewMapId()));
- return maps[getMapCount() - 1];
+ m_maps.append(new Map(this, map, newMapId()));
+ return m_maps[mapCount() - 1];
}
-void Pokemod::deleteMap(const int i) throw(IndexException)
+void Pokemod::deleteMap(const int index) throw(IndexException)
{
- if (getMapCount() <= i)
- throw(IndexException(className));
- delete maps[i];
- maps.removeAt(i);
+ if (mapCount() <= index)
+ throw(IndexException(className()));
+ delete m_maps[index];
+ m_maps.removeAt(index);
}
-const Move* Pokemod::getMove(const int i) const throw(IndexException)
+void Pokemod::deleteMapById(const int id) throw(IndexException)
{
- if (getMoveCount() <= i)
- throw(IndexException(className));
- return moves.at(i);
+ deleteMap(mapIndex(id));
}
-Move* Pokemod::getMove(const int i) throw(IndexException)
+int Pokemod::newMapId() const
{
- if (getMoveCount() <= i)
- throw(IndexException(className));
- return moves[i];
+ int i = 0;
+ while ((i < mapCount()) && (mapIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Move* Pokemod::getMoveByID(const int i) const throw(IndexException)
+const Move* Pokemod::move(const int index) const throw(IndexException)
{
- return getMove(getMoveIndex(i));
+ if (moveCount() <= index)
+ throw(IndexException(className()));
+ return m_moves.at(index);
}
-Move* Pokemod::getMoveByID(const int i) throw(IndexException)
+Move* Pokemod::move(const int index) throw(IndexException)
{
- return getMove(getMoveIndex(i));
+ if (moveCount() <= index)
+ throw(IndexException(className()));
+ return m_moves[index];
}
-int Pokemod::getMoveIndex(const int _id) const
+const Move* Pokemod::moveById(const int id) const throw(IndexException)
{
- for (int i = 0; i < getMoveCount(); ++i)
+ return move(moveIndex(id));
+}
+
+Move* Pokemod::moveById(const int id) throw(IndexException)
+{
+ return move(moveIndex(id));
+}
+
+int Pokemod::moveIndex(const int id) const
+{
+ for (int i = 0; i < moveCount(); ++i)
{
- if (moves[i]->getId() == _id)
+ if (m_moves[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getMoveCount() const
+int Pokemod::moveCount() const
{
- return moves.size();
+ return m_moves.size();
}
Move* Pokemod::newMove()
{
- moves.append(new Move(this, getNewMoveId()));
- return moves[getMoveCount() - 1];
+ m_moves.append(new Move(this, newMoveId()));
+ return m_moves[moveCount() - 1];
}
-Move* Pokemod::newMove(const QString& fname)
+Move* Pokemod::newMove(const QString& fileName)
{
- moves.append(new Move(this, fname, getNewMoveId()));
- return moves[getMoveCount() - 1];
+ m_moves.append(new Move(this, fileName, newMoveId()));
+ return m_moves[moveCount() - 1];
}
-Move* Pokemod::newMove(const Move& m)
+Move* Pokemod::newMove(const Move& move)
{
- moves.append(new Move(this, m, getNewMoveId()));
- return moves[getMoveCount() - 1];
+ m_moves.append(new Move(this, move, newMoveId()));
+ return m_moves[moveCount() - 1];
}
-void Pokemod::deleteMove(const int i) throw(IndexException)
+void Pokemod::deleteMove(const int index) throw(IndexException)
{
- if (getMoveCount() <= i)
- throw(IndexException(className));
- delete moves[i];
- moves.removeAt(i);
+ if (moveCount() <= index)
+ throw(IndexException(className()));
+ delete m_moves[index];
+ m_moves.removeAt(index);
}
-const Nature* Pokemod::getNature(const int i) const throw(IndexException)
+void Pokemod::deleteMoveById(const int id) throw(IndexException)
{
- if (getNatureCount() <= i)
- throw(IndexException(className));
- return natures.at(i);
+ deleteMove(moveIndex(id));
}
-Nature* Pokemod::getNature(const int i) throw(IndexException)
+int Pokemod::newMoveId() const
{
- if (getNatureCount() <= i)
- throw(IndexException(className));
- return natures[i];
+ int i = 0;
+ while ((i < moveCount()) && (moveIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Nature* Pokemod::getNatureByID(const int i) const throw(IndexException)
+const Nature* Pokemod::nature(const int index) const throw(IndexException)
{
- return getNature(getNatureIndex(i));
+ if (natureCount() <= index)
+ throw(IndexException(className()));
+ return m_natures.at(index);
}
-Nature* Pokemod::getNatureByID(const int i) throw(IndexException)
+Nature* Pokemod::nature(const int index) throw(IndexException)
{
- return getNature(getNatureIndex(i));
+ if (natureCount() <= index)
+ throw(IndexException(className()));
+ return m_natures[index];
}
-int Pokemod::getNatureIndex(const int _id) const
+const Nature* Pokemod::natureById(const int id) const throw(IndexException)
{
- for (int i = 0; i < getNatureCount(); ++i)
+ return nature(natureIndex(id));
+}
+
+Nature* Pokemod::natureById(const int id) throw(IndexException)
+{
+ return nature(natureIndex(id));
+}
+
+int Pokemod::natureIndex(const int id) const
+{
+ for (int i = 0; i < natureCount(); ++i)
{
- if (natures[i]->getId() == _id)
+ if (m_natures[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getNatureCount() const
+int Pokemod::natureCount() const
{
- return natures.size();
+ return m_natures.size();
}
Nature* Pokemod::newNature()
{
- natures.append(new Nature(this, getNewNatureId()));
- return natures[getNatureCount() - 1];
+ m_natures.append(new Nature(this, newNatureId()));
+ return m_natures[natureCount() - 1];
+}
+
+Nature* Pokemod::newNature(const QString& fileName)
+{
+ m_natures.append(new Nature(this, fileName, newNatureId()));
+ return m_natures[natureCount() - 1];
+}
+
+Nature* Pokemod::newNature(const Nature& nature)
+{
+ m_natures.append(new Nature(this, nature, newNatureId()));
+ return m_natures[natureCount() - 1];
}
-Nature* Pokemod::newNature(const QString& fname)
+void Pokemod::deleteNature(const int index) throw(IndexException)
{
- natures.append(new Nature(this, fname, getNewNatureId()));
- return natures[getNatureCount() - 1];
+ if (natureCount() <= index)
+ throw(IndexException(className()));
+ delete m_natures[index];
+ m_natures.removeAt(index);
}
-Nature* Pokemod::newNature(const Nature& n)
+void Pokemod::deleteNatureById(const int id) throw(IndexException)
{
- natures.append(new Nature(this, n, getNewNatureId()));
- return natures[getNatureCount() - 1];
+ deleteNature(natureIndex(id));
}
-void Pokemod::deleteNature(const int i) throw(IndexException)
+int Pokemod::newNatureId() const
{
- if (getNatureCount() <= i)
- throw(IndexException(className));
- delete natures[i];
- natures.removeAt(i);
+ int i = 0;
+ while ((i < natureCount()) && (natureIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Species* Pokemod::getSpecies(const int i) const throw(IndexException)
+const Species* Pokemod::species(const int index) const throw(IndexException)
{
- if (getSpeciesCount() <= i)
- throw(IndexException(className));
- return species.at(i);
+ if (speciesCount() <= index)
+ throw(IndexException(className()));
+ return m_species.at(index);
}
-Species* Pokemod::getSpecies(const int i) throw(IndexException)
+Species* Pokemod::species(const int index) throw(IndexException)
{
- if (getSpeciesCount() <= i)
- throw(IndexException(className));
- return species[i];
+ if (speciesCount() <= index)
+ throw(IndexException(className()));
+ return m_species[index];
}
-const Species* Pokemod::getSpeciesByID(const int i) const throw(IndexException)
+const Species* Pokemod::speciesById(const int id) const throw(IndexException)
{
- return getSpecies(getSpeciesIndex(i));
+ return species(speciesIndex(id));
}
-Species* Pokemod::getSpeciesByID(const int i) throw(IndexException)
+Species* Pokemod::speciesById(const int id) throw(IndexException)
{
- return getSpecies(getSpeciesIndex(i));
+ return species(speciesIndex(id));
}
-int Pokemod::getSpeciesIndex(const int _id) const
+int Pokemod::speciesIndex(const int id) const
{
- for (int i = 0; i < getSpeciesCount(); ++i)
+ for (int i = 0; i < speciesCount(); ++i)
{
- if (species[i]->getId() == _id)
+ if (m_species[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getSpeciesCount() const
+int Pokemod::speciesCount() const
{
- return species.size();
+ return m_species.size();
}
Species* Pokemod::newSpecies()
{
- species.append(new Species(this, getNewSpeciesId()));
- return species[getSpeciesCount() - 1];
+ m_species.append(new Species(this, newSpeciesId()));
+ return m_species[speciesCount() - 1];
}
-Species* Pokemod::newSpecies(const QString& fname)
+Species* Pokemod::newSpecies(const QString& fileName)
{
- species.append(new Species(this, fname, getNewSpeciesId()));
- return species[getSpeciesCount() - 1];
+ m_species.append(new Species(this, fileName, newSpeciesId()));
+ return m_species[speciesCount() - 1];
}
-Species* Pokemod::newSpecies(const Species& s)
+Species* Pokemod::newSpecies(const Species& species)
{
- species.append(new Species(this, s, getNewSpeciesId()));
- return species[getSpeciesCount() - 1];
+ m_species.append(new Species(this, species, newSpeciesId()));
+ return m_species[speciesCount() - 1];
}
-void Pokemod::deleteSpecies(const int i) throw(IndexException)
+void Pokemod::deleteSpecies(const int index) throw(IndexException)
{
- if (getSpeciesCount() <= i)
- throw(IndexException(className));
- delete species[i];
- species.removeAt(i);
+ if (speciesCount() <= index)
+ throw(IndexException(className()));
+ delete m_species[index];
+ m_species.removeAt(index);
}
-const Store* Pokemod::getStore(const int i) const throw(IndexException)
+void Pokemod::deleteSpeciesById(const int id) throw(IndexException)
{
- if (getStoreCount() <= i)
- throw(IndexException(className));
- return stores.at(i);
+ deleteSpecies(speciesIndex(id));
+}
+
+int Pokemod::newSpeciesId() const
+{
+ int i = 0;
+ while ((i < speciesCount()) && (speciesIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-Store* Pokemod::getStore(const int i) throw(IndexException)
+const Store* Pokemod::store(const int index) const throw(IndexException)
{
- if (getStoreCount() <= i)
- throw(IndexException(className));
- return stores[i];
+ if (storeCount() <= index)
+ throw(IndexException(className()));
+ return m_stores.at(index);
}
-const Store* Pokemod::getStoreByID(const int i) const throw(IndexException)
+Store* Pokemod::store(const int index) throw(IndexException)
{
- return getStore(getStoreIndex(i));
+ if (storeCount() <= index)
+ throw(IndexException(className()));
+ return m_stores[index];
}
-Store* Pokemod::getStoreByID(const int i) throw(IndexException)
+const Store* Pokemod::storeById(const int id) const throw(IndexException)
{
- return getStore(getStoreIndex(i));
+ return store(storeIndex(id));
}
-int Pokemod::getStoreIndex(const int _id) const
+Store* Pokemod::storeById(const int id) throw(IndexException)
{
- for (int i = 0; i < getStoreCount(); ++i)
+ return store(storeIndex(id));
+}
+
+int Pokemod::storeIndex(const int id) const
+{
+ for (int i = 0; i < storeCount(); ++i)
{
- if (stores[i]->getId() == _id)
+ if (m_stores[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getStoreCount() const
+int Pokemod::storeCount() const
{
- return stores.size();
+ return m_stores.size();
}
Store* Pokemod::newStore()
{
- stores.append(new Store(this, getNewStoreId()));
- return stores[getStoreCount() - 1];
+ m_stores.append(new Store(this, newStoreId()));
+ return m_stores[storeCount() - 1];
+}
+
+Store* Pokemod::newStore(const QString& fileName)
+{
+ m_stores.append(new Store(this, fileName, newStoreId()));
+ return m_stores[storeCount() - 1];
}
-Store* Pokemod::newStore(const QString& fname)
+Store* Pokemod::newStore(const Store& store)
{
- stores.append(new Store(this, fname, getNewStoreId()));
- return stores[getStoreCount() - 1];
+ m_stores.append(new Store(this, store, newStoreId()));
+ return m_stores[storeCount() - 1];
}
-Store* Pokemod::newStore(const Store& s)
+void Pokemod::deleteStore(const int index) throw(IndexException)
{
- stores.append(new Store(this, s, getNewStoreId()));
- return stores[getStoreCount() - 1];
+ if (storeCount() <= index)
+ throw(IndexException(className()));
+ delete m_stores[index];
+ m_stores.removeAt(index);
}
-void Pokemod::deleteStore(const int i) throw(IndexException)
+void Pokemod::deleteStoreById(const int id) throw(IndexException)
{
- if (getStoreCount() <= i)
- throw(IndexException(className));
- delete stores[i];
- stores.removeAt(i);
+ deleteStore(storeIndex(id));
}
-const Tile* Pokemod::getTile(const int i) const throw(IndexException)
+int Pokemod::newStoreId() const
{
- if (getTileCount() <= i)
- throw(IndexException(className));
- return tiles.at(i);
+ int i = 0;
+ while ((i < storeCount()) && (storeIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-Tile* Pokemod::getTile(const int i) throw(IndexException)
+const Tile* Pokemod::tile(const int index) const throw(IndexException)
{
- if (getTileCount() <= i)
- throw(IndexException(className));
- return tiles[i];
+ if (tileCount() <= index)
+ throw(IndexException(className()));
+ return m_tiles.at(index);
}
-const Tile* Pokemod::getTileByID(const int i) const throw(IndexException)
+Tile* Pokemod::tile(const int index) throw(IndexException)
{
- return getTile(getTileIndex(i));
+ if (tileCount() <= index)
+ throw(IndexException(className()));
+ return m_tiles[index];
}
-Tile* Pokemod::getTileByID(const int i) throw(IndexException)
+const Tile* Pokemod::tileById(const int id) const throw(IndexException)
{
- return getTile(getTileIndex(i));
+ return tile(tileIndex(id));
}
-int Pokemod::getTileIndex(const int _id) const
+Tile* Pokemod::tileById(const int id) throw(IndexException)
{
- for (int i = 0; i < getTileCount(); ++i)
+ return tile(tileIndex(id));
+}
+
+int Pokemod::tileIndex(const int id) const
+{
+ for (int i = 0; i < tileCount(); ++i)
{
- if (tiles[i]->getId() == _id)
+ if (m_tiles[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getTileCount() const
+int Pokemod::tileCount() const
{
- return tiles.size();
+ return m_tiles.size();
}
Tile* Pokemod::newTile()
{
- tiles.append(new Tile(this, getNewTileId()));
- return tiles[getTileCount() - 1];
+ m_tiles.append(new Tile(this, newTileId()));
+ return m_tiles[tileCount() - 1];
}
-Tile* Pokemod::newTile(const QString& fname)
+Tile* Pokemod::newTile(const QString& fileName)
{
- tiles.append(new Tile(this, fname, getNewTileId()));
- return tiles[getTileCount() - 1];
+ m_tiles.append(new Tile(this, fileName, newTileId()));
+ return m_tiles[tileCount() - 1];
}
-Tile* Pokemod::newTile(const Tile& t)
+Tile* Pokemod::newTile(const Tile& tile)
{
- tiles.append(new Tile(this, t, getNewTileId()));
- return tiles[getTileCount() - 1];
+ m_tiles.append(new Tile(this, tile, newTileId()));
+ return m_tiles[tileCount() - 1];
}
-void Pokemod::deleteTile(const int i) throw(IndexException)
+void Pokemod::deleteTile(const int index) throw(IndexException)
{
- if (getTileCount() <= i)
- throw(IndexException(className));
- delete tiles[i];
- tiles.removeAt(i);
+ if (tileCount() <= index)
+ throw(IndexException(className()));
+ delete m_tiles[index];
+ m_tiles.removeAt(index);
+}
+
+void Pokemod::deleteTileById(const int id) throw(IndexException)
+{
+ deleteTile(tileIndex(id));
+}
+
+int Pokemod::newTileId() const
+{
+ int i = 0;
+ while ((i < tileCount()) && (tileIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Time* Pokemod::getTime(const int i) const throw(IndexException)
+const Time* Pokemod::time(const int index) const throw(IndexException)
{
- if (getTimeCount() <= i)
- throw(IndexException(className));
- return times.at(i);
+ if (timeCount() <= index)
+ throw(IndexException(className()));
+ return m_times.at(index);
}
-Time* Pokemod::getTime(const int i) throw(IndexException)
+Time* Pokemod::time(const int i) throw(IndexException)
{
- if (getTimeCount() <= i)
- throw(IndexException(className));
- return times[i];
+ if (timeCount() <= i)
+ throw(IndexException(className()));
+ return m_times[i];
}
-const Time* Pokemod::getTimeByID(const int i) const throw(IndexException)
+const Time* Pokemod::timeById(const int id) const throw(IndexException)
{
- return getTime(getTimeIndex(i));
+ return time(timeIndex(id));
}
-Time* Pokemod::getTimeByID(const int i) throw(IndexException)
+Time* Pokemod::timeById(const int id) throw(IndexException)
{
- return getTime(getTimeIndex(i));
+ return time(timeIndex(id));
}
-int Pokemod::getTimeIndex(const int _id) const
+int Pokemod::timeIndex(const int id) const
{
- for (int i = 0; i < getTimeCount(); ++i)
+ for (int i = 0; i < timeCount(); ++i)
{
- if (times[i]->getId() == _id)
+ if (m_times[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getTimeCount() const
+int Pokemod::timeCount() const
{
- return times.size();
+ return m_times.size();
}
Time* Pokemod::newTime()
{
- times.append(new Time(this, getNewTimeId()));
- return times[getTimeCount() - 1];
+ m_times.append(new Time(this, newTimeId()));
+ return m_times[timeCount() - 1];
}
-Time* Pokemod::newTime(const QString& fname)
+Time* Pokemod::newTime(const QString& fileName)
{
- times.append(new Time(this, fname, getNewTimeId()));
- return times[getTimeCount() - 1];
+ m_times.append(new Time(this, fileName, newTimeId()));
+ return m_times[timeCount() - 1];
}
-Time* Pokemod::newTime(const Time& t)
+Time* Pokemod::newTime(const Time& time)
{
- times.append(new Time(this, t, getNewTimeId()));
- return times[getTimeCount() - 1];
+ m_times.append(new Time(this, time, newTimeId()));
+ return m_times[timeCount() - 1];
}
-void Pokemod::deleteTime(const int i) throw(IndexException)
+void Pokemod::deleteTime(const int index) throw(IndexException)
{
- if (getTimeCount() <= i)
- throw(IndexException(className));
- delete times[i];
- times.removeAt(i);
+ if (timeCount() <= index)
+ throw(IndexException(className()));
+ delete m_times[index];
+ m_times.removeAt(index);
}
-const Trainer* Pokemod::getTrainer(const int i) const throw(IndexException)
+void Pokemod::deleteTimeById(const int id) throw(IndexException)
{
- if (getTrainerCount() <= i)
- throw(IndexException(className));
- return trainers.at(i);
+ deleteTime(timeIndex(id));
}
-Trainer* Pokemod::getTrainer(const int i) throw(IndexException)
+int Pokemod::newTimeId() const
{
- if (getTrainerCount() <= i)
- throw(IndexException(className));
- return trainers[i];
+ int i = 0;
+ while ((i < timeCount()) && (timeIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-const Trainer* Pokemod::getTrainerByID(const int i) const throw(IndexException)
+const Trainer* Pokemod::trainer(const int index) const throw(IndexException)
{
- return getTrainer(getTrainerIndex(i));
+ if (trainerCount() <= index)
+ throw(IndexException(className()));
+ return m_trainers.at(index);
}
-Trainer* Pokemod::getTrainerByID(const int i) throw(IndexException)
+Trainer* Pokemod::trainer(const int index) throw(IndexException)
{
- return getTrainer(getTrainerIndex(i));
+ if (trainerCount() <= index)
+ throw(IndexException(className()));
+ return m_trainers[index];
}
-int Pokemod::getTrainerIndex(const int _id) const
+const Trainer* Pokemod::trainerById(const int id) const throw(IndexException)
{
- for (int i = 0; i < getTrainerCount(); ++i)
+ return trainer(trainerIndex(id));
+}
+
+Trainer* Pokemod::trainerById(const int id) throw(IndexException)
+{
+ return trainer(trainerIndex(id));
+}
+
+int Pokemod::trainerIndex(const int id) const
+{
+ for (int i = 0; i < trainerCount(); ++i)
{
- if (trainers[i]->getId() == _id)
+ if (m_trainers[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getTrainerCount() const
+int Pokemod::trainerCount() const
{
- return trainers.size();
+ return m_trainers.size();
}
Trainer* Pokemod::newTrainer()
{
- trainers.append(new Trainer(this, getNewTrainerId()));
- return trainers[getTrainerCount() - 1];
+ m_trainers.append(new Trainer(this, newTrainerId()));
+ return m_trainers[trainerCount() - 1];
+}
+
+Trainer* Pokemod::newTrainer(const QString& fileName)
+{
+ m_trainers.append(new Trainer(this, fileName, newTrainerId()));
+ return m_trainers[trainerCount() - 1];
}
-Trainer* Pokemod::newTrainer(const QString& fname)
+Trainer* Pokemod::newTrainer(const Trainer& trainer)
{
- trainers.append(new Trainer(this, fname, getNewTrainerId()));
- return trainers[getTrainerCount() - 1];
+ m_trainers.append(new Trainer(this, trainer, newTrainerId()));
+ return m_trainers[trainerCount() - 1];
}
-Trainer* Pokemod::newTrainer(const Trainer& t)
+void Pokemod::deleteTrainer(const int index) throw(IndexException)
{
- trainers.append(new Trainer(this, t, getNewTrainerId()));
- return trainers[getTrainerCount() - 1];
+ if (trainerCount() <= index)
+ throw(IndexException(className()));
+ delete m_trainers[index];
+ m_trainers.removeAt(index);
}
-void Pokemod::deleteTrainer(const int i) throw(IndexException)
+void Pokemod::deleteTrainerById(const int id) throw(IndexException)
{
- if (getTrainerCount() <= i)
- throw(IndexException(className));
- delete trainers[i];
- trainers.removeAt(i);
+ deleteTrainer(trainerIndex(id));
}
-const Type* Pokemod::getType(const int i) const throw(IndexException)
+int Pokemod::newTrainerId() const
{
- if (getTypeCount() <= i)
- throw(IndexException(className));
- return types.at(i);
+ int i = 0;
+ while ((i < trainerCount()) && (trainerIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
-Type* Pokemod::getType(const int i) throw(IndexException)
+const Type* Pokemod::type(const int index) const throw(IndexException)
{
- if (getTypeCount() <= i)
- throw(IndexException(className));
- return types[i];
+ if (typeCount() <= index)
+ throw(IndexException(className()));
+ return m_types.at(index);
}
-const Type* Pokemod::getTypeByID(const int i) const throw(IndexException)
+Type* Pokemod::type(const int index) throw(IndexException)
{
- return getType(getTypeIndex(i));
+ if (typeCount() <= index)
+ throw(IndexException(className()));
+ return m_types[index];
}
-Type* Pokemod::getTypeByID(const int i) throw(IndexException)
+const Type* Pokemod::typeById(const int id) const throw(IndexException)
{
- return getType(getTypeIndex(i));
+ return type(typeIndex(id));
}
-int Pokemod::getTypeIndex(const int _id) const
+Type* Pokemod::typeById(const int id) throw(IndexException)
{
- for (int i = 0; i < getTypeCount(); ++i)
+ return type(typeIndex(id));
+}
+
+int Pokemod::typeIndex(const int id) const
+{
+ for (int i = 0; i < typeCount(); ++i)
{
- if (types[i]->getId() == _id)
+ if (m_types[i]->id() == id)
return i;
}
- return -1;
+ return INT_MAX;
}
-int Pokemod::getTypeCount() const
+int Pokemod::typeCount() const
{
- return types.size();
+ return m_types.size();
}
Type* Pokemod::newType()
{
int i;
- types.append(new Type(this, i = getNewTypeId()));
- typeChart.addCol(Frac(1, 1));
- typeChart.addRow(Frac(1, 1));
- return types[getTypeCount() - 1];
+ m_types.append(new Type(this, i = newTypeId()));
+ m_typeChart.addColumn(Frac(1, 1));
+ m_typeChart.addRow(Frac(1, 1));
+ return m_types[typeCount() - 1];
}
-Type* Pokemod::newType(const QString& fname)
+Type* Pokemod::newType(const QString& fileName)
{
int i;
- types.append(new Type(this, fname, i = getNewTypeId()));
- typeChart.addCol(Frac(1, 1));
- typeChart.addRow(Frac(1, 1));
- return types[getTypeCount() - 1];
+ m_types.append(new Type(this, fileName, i = newTypeId()));
+ m_typeChart.addColumn(Frac(1, 1));
+ m_typeChart.addRow(Frac(1, 1));
+ return m_types[typeCount() - 1];
}
-Type* Pokemod::newType(const Type& t)
+Type* Pokemod::newType(const Type& type)
{
- int i;
- types.append(new Type(this, t, i = getNewTypeId()));
- typeChart.addCol(Frac(1, 1));
- typeChart.addRow(Frac(1, 1));
- return types[getTypeCount() - 1];
+ m_types.append(new Type(this, type, newTypeId()));
+ m_typeChart.addColumn(Frac(1, 1));
+ m_typeChart.addRow(Frac(1, 1));
+ return m_types[typeCount() - 1];
+}
+
+void Pokemod::deleteType(const int index) throw(IndexException)
+{
+ if (typeCount() <= index)
+ throw(IndexException(className()));
+ delete m_types[index];
+ m_typeChart.deleteColumn(index);
+ m_typeChart.deleteRow(index);
+ m_types.removeAt(index);
+}
+
+void Pokemod::deleteTypeById(const int id) throw(IndexException)
+{
+ deleteType(typeIndex(id));
}
-void Pokemod::deleteType(const int i) throw(IndexException)
+int Pokemod::newTypeId() const
{
- if (getTypeCount() <= i)
- throw(IndexException(className));
- delete types[i];
- typeChart.deleteCol(i);
- typeChart.deleteRow(i);
- types.removeAt(i);
+ int i = 0;
+ while ((i < typeCount()) && (typeIndex(i) != INT_MAX))
+ ++i;
+ return i;
}
Pokemod& Pokemod::operator=(const Pokemod& rhs)
{
if (this == &rhs)
return *this;
- title = rhs.title;
- version = rhs.version;
- description = rhs.description;
- startMap = rhs.startMap;
- startWarp = rhs.startWarp;
- superPCUname = rhs.superPCUname;
- superPCPasswd = rhs.superPCPasswd;
- typeChart = rhs.typeChart;
- rules = rhs.rules;
- abilities.clear();
- for (int i = 0; i < rhs.getAbilityCount(); ++i)
- abilities.append(new Ability(this, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
- authors.clear();
- for (int i = 0; i < rhs.getAuthorCount(); ++i)
- authors.append(new Author(this, *rhs.getAuthor(i), rhs.getAuthor(i)->getId()));
- badges.clear();
- for (int i = 0; i < rhs.getBadgeCount(); ++i)
- badges.append(new Badge(this, *rhs.getBadge(i), rhs.getBadge(i)->getId()));
- coinLists.clear();
- for (int i = 0; i < rhs.getCoinListCount(); ++i)
- coinLists.append(new CoinList(this, *rhs.getCoinList(i), rhs.getCoinList(i)->getId()));
- dialogs.clear();
- for (int i = 0; i < rhs.getDialogCount(); ++i)
- dialogs.append(new Dialog(this, *rhs.getDialog(i), rhs.getDialog(i)->getId()));
- eggGroups.clear();
- for (int i = 0; i < rhs.getEggGroupCount(); ++i)
- eggGroups.append(new EggGroup(this, *rhs.getEggGroup(i), rhs.getEggGroup(i)->getId()));
- items.clear();
- for (int i = 0; i < rhs.getItemCount(); ++i)
- items.append(new Item(this, *rhs.getItem(i), rhs.getItem(i)->getId()));
- itemTypes.clear();
- for (int i = 0; i < rhs.getItemTypeCount(); ++i)
- itemTypes.append(new ItemType(this, *rhs.getItemType(i), rhs.getItemType(i)->getId()));
- maps.clear();
- for (int i = 0; i < rhs.getMapCount(); ++i)
- maps.append(new Map(this, *rhs.getMap(i), rhs.getMap(i)->getId()));
- moves.clear();
- for (int i = 0; i < rhs.getMoveCount(); ++i)
- moves.append(new Move(this, *rhs.getMove(i), rhs.getMove(i)->getId()));
- natures.clear();
- for (int i = 0; i < rhs.getNatureCount(); ++i)
- natures.append(new Nature(this, *rhs.getNature(i), rhs.getNature(i)->getId()));
- species.clear();
- for (int i = 0; i < rhs.getSpeciesCount(); ++i)
- species.append(new Species(this, *rhs.getSpecies(i), rhs.getSpecies(i)->getId()));
- stores.clear();
- for (int i = 0; i < rhs.getStoreCount(); ++i)
- stores.append(new Store(this, *rhs.getStore(i), rhs.getStore(i)->getId()));
- tiles.clear();
- for (int i = 0; i < rhs.getTileCount(); ++i)
- tiles.append(new Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId()));
- trainers.clear();
- for (int i = 0; i < rhs.getTrainerCount(); ++i)
- trainers.append(new Trainer(this, *rhs.getTrainer(i), rhs.getTrainer(i)->getId()));
- types.clear();
- for (int i = 0; i < rhs.getTimeCount(); ++i)
- times.append(new Time(this, *rhs.getTime(i), rhs.getTime(i)->getId()));
- types.clear();
- for (int i = 0; i < rhs.getTypeCount(); ++i)
- types.append(new Type(this, *rhs.getType(i), rhs.getType(i)->getId()));
+ m_title = rhs.m_title;
+ m_version = rhs.m_version;
+ m_description = rhs.m_description;
+ m_startMap = rhs.m_startMap;
+ m_startWarp = rhs.m_startWarp;
+ m_superPCUname = rhs.m_superPCUname;
+ m_superPCPasswd = rhs.m_superPCPasswd;
+ m_typeChart = rhs.m_typeChart;
+ m_rules = rhs.m_rules;
+ m_abilities.clear();
+ foreach (Ability* ability, rhs.m_abilities)
+ m_abilities.append(new Ability(this, *ability, ability->id()));
+ m_authors.clear();
+ foreach (Author* author, rhs.m_authors)
+ m_authors.append(new Author(this, *author, author->id()));
+ m_badges.clear();
+ foreach (Badge* badge, rhs.m_badges)
+ m_badges.append(new Badge(this, *badge, badge->id()));
+ m_coinLists.clear();
+ foreach (CoinList* coinList, rhs.m_coinLists)
+ m_coinLists.append(new CoinList(this, *coinList, coinList->id()));
+ m_dialogs.clear();
+ foreach (Dialog* dialog, rhs.m_dialogs)
+ m_dialogs.append(new Dialog(this, *dialog, dialog->id()));
+ m_eggGroups.clear();
+ foreach (EggGroup* eggGroup, rhs.m_eggGroups)
+ m_eggGroups.append(new EggGroup(this, *eggGroup, eggGroup->id()));
+ m_items.clear();
+ foreach (Item* item, rhs.m_items)
+ m_items.append(new Item(this, *item, item->id()));
+ m_itemTypes.clear();
+ foreach (ItemType* itemType, rhs.m_itemTypes)
+ m_itemTypes.append(new ItemType(this, *itemType, itemType->id()));
+ m_maps.clear();
+ foreach (Map* map, rhs.m_maps)
+ m_maps.append(new Map(this, *map, map->id()));
+ m_species.clear();
+ foreach (Species* species, rhs.m_species)
+ m_species.append(new Species(this, *species, species->id()));
+ m_stores.clear();
+ foreach (Store* store, rhs.m_stores)
+ m_stores.append(new Store(this, *store, store->id()));
+ m_tiles.clear();
+ foreach (Tile* tile, rhs.m_tiles)
+ m_tiles.append(new Tile(this, *tile, tile->id()));
+ m_times.clear();
+ foreach (Time* time, rhs.m_times)
+ m_times.append(new Time(this, *time, time->id()));
+ m_trainers.clear();
+ foreach (Trainer* trainer, rhs.m_trainers)
+ m_trainers.append(new Trainer(this, *trainer, trainer->id()));
+ m_types.clear();
+ foreach (Type* type, rhs.m_types)
+ m_types.append(new Type(this, *type, type->id()));
return *this;
}