diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-02 08:42:08 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-02 08:42:08 +0000 |
| commit | 822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd (patch) | |
| tree | 40dc605213eff20f62b16e5f54e5e5e03d744d63 /pokemod/Pokemod.cpp | |
| parent | 696414f1dc8bc419427efb6c1abe1bbae0a68a56 (diff) | |
| download | sigen-822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd.tar.gz sigen-822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd.tar.xz sigen-822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd.zip | |
[FIX] Exceptions no longer used in pokemod
[DEL] Exception and BugCatcher are no longer needed
[ADD] Object.cpp added
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@119 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
| -rw-r--r-- | pokemod/Pokemod.cpp | 962 |
1 files changed, 486 insertions, 476 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index abb6f482..e70fcbe3 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -39,6 +39,7 @@ // Qt includes #include <QBuffer> +#include <QSet> const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error"; const QStringList Pokemod::StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "Special" << "Accuracy" << "Evasion"; @@ -52,7 +53,6 @@ const QStringList Pokemod::HMStr = QStringList() << "Cut" << "Fly" << "Surf" << Pokemod::Pokemod() : Object("Pokemod", NULL, 0), - valOutput(NULL), m_title(""), m_version(""), m_description(""), @@ -80,7 +80,6 @@ Pokemod::Pokemod(const Pokemod& pokemod) : Pokemod::Pokemod(const QDomElement& xml) : Object("Pokemod", NULL, 0), - valOutput(NULL), m_rules(this) { load(xml); @@ -91,290 +90,293 @@ Pokemod::~Pokemod() clear(); } -bool Pokemod::validate() const -{ - // TODO: validate -// bool valid = true; -// validationMsg(QString("Pokemod \"%1\"").arg(m_title), V_Msg); -// if (m_title == "") -// { -// validationMsg("Title is not defined"); -// valid = false; -// } -// if (m_version == "") -// { -// validationMsg("Version is not defined"); -// valid = false; -// } -// if (m_description == "") -// validationMsg("Description is not defined", V_Warn); -// if (mapIndex(m_startMap)) -// { -// if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX) -// { -// validationMsg("Invalid starting warp"); -// valid = false; -// } -// } -// else -// { -// validationMsg("Invalid starting map"); -// valid = false; -// } -// if (m_superPCUname == "") -// validationMsg("Super PC username not defined", V_Warn); -// if (m_superPCPasswd == "") -// validationMsg("Super PC password not defined", V_Warn); -// if ((m_typeChart.width() != typeCount()) || (m_typeChart.height() != typeCount())) -// { -// validationMsg("TypeChart is invalid"); -// valid = false; -// } -// if (!m_rules.isValid()) -// valid = false; -// QMap<int, bool> idChecker; -// QMap<int, bool> timeChecker; -// if (m_rules.abilityAllowed()) -// { -// if (!abilityCount()) -// { -// validationMsg("There are no abilities"); -// valid = false; -// } -// foreach (Ability* ability, m_abilities) -// { -// if (!ability->isValid()) -// valid = false; -// if (idChecker[ability->id()]) -// validationMsg(QString("Duplicate ability with id %1").arg(ability->id())); -// idChecker[ability->id()] = true; -// } -// idChecker.clear(); -// } -// if (!authorCount()) -// { -// validationMsg("There are no authors"); -// valid = false; -// } -// foreach (Author* author, m_authors) -// { -// 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(); -// if (!badgeCount()) -// validationMsg("There are no badges", V_Warn); -// foreach (Badge* badge, m_badges) -// { -// if (!badge->isValid()) -// valid = false; -// if (idChecker[badge->id()]) -// validationMsg(QString("Duplicate badge with id %1").arg(badge->id())); -// idChecker[badge->id()] = true; -// } -// idChecker.clear(); -// if (!coinListCount()) -// validationMsg("There are no coin lists", V_Warn); -// foreach (CoinList* coinList, m_coinLists) -// { -// if (!coinList->isValid()) -// valid = false; -// if (idChecker[coinList->id()]) -// validationMsg(QString("Duplicate coin list with id %1").arg(coinList->id())); -// idChecker[coinList->id()] = true; -// } -// idChecker.clear(); -// if (!dialogCount()) -// { -// validationMsg("There are no dialogs"); -// valid = false; -// } -// foreach (Dialog* dialog, m_dialogs) -// { -// if (!dialog->isValid()) -// valid = false; -// if (idChecker[dialog->id()]) -// validationMsg(QString("Duplicate dialog with id %1").arg(dialog->id())); -// idChecker[dialog->id()] = true; -// } -// idChecker.clear(); -// if (m_rules.breedingAllowed()) -// { -// if (!eggGroupCount()) -// { -// validationMsg("There are no egg grous"); -// valid = false; -// } -// foreach (EggGroup* eggGroup, m_eggGroups) -// { -// 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(); -// } -// if (!itemCount()) -// validationMsg("There are no m_items", V_Warn); -// foreach (Item* item, m_items) -// { -// if (!item->isValid()) -// valid = false; -// if (idChecker[item->id()]) -// validationMsg(QString("Duplicate item with id %1").arg(item->id())); -// idChecker[item->id()] = true; -// } -// idChecker.clear(); -// if (!itemTypeCount()) -// { -// validationMsg("There are no item types", itemCount() ? V_Error : V_Warn); -// if (itemCount()) -// valid = false; -// } -// foreach (ItemType* itemType, m_itemTypes) -// { -// 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(); -// if (!mapCount()) -// { -// validationMsg("There are no m_maps"); -// valid = false; -// } -// foreach (Map* map, m_maps) -// { -// if (!map->isValid()) -// valid = false; -// if (idChecker[map->id()]) -// validationMsg(QString("Duplicate map with id %1").arg(map->id())); -// idChecker[map->id()] = true; -// } -// idChecker.clear(); -// if (!moveCount()) -// { -// validationMsg("There are no m_moves"); -// valid = false; -// } -// foreach (Move* move, m_moves) -// { -// if (!move->isValid()) -// valid = false; -// if (idChecker[move->id()]) -// validationMsg(QString("Duplicate move with id %1").arg(move->id())); -// idChecker[move->id()] = true; -// } -// idChecker.clear(); -// if (m_rules.natureAllowed()) -// { -// if (!natureCount()) -// { -// validationMsg("There are no natures"); -// valid = false; -// } -// foreach (Nature* nature, m_natures) -// { -// if (!nature->isValid()) -// valid = false; -// if (idChecker[nature->id()]) -// validationMsg(QString("Duplicate ability with id %1").arg(nature->id())); -// idChecker[nature->id()] = true; -// } -// idChecker.clear(); -// } -// if (!speciesCount()) -// { -// validationMsg("There are no m_species"); -// valid = false; -// } -// foreach (Species* m_species, m_species) -// { -// 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(); -// if (!storeCount()) -// validationMsg("There are no m_stores", V_Warn); -// foreach (Store* store, m_stores) -// { -// if (!store->isValid()) -// valid = false; -// if (idChecker[store->id()]) -// validationMsg(QString("Duplicate store with id %1").arg(store->id())); -// idChecker[store->id()] = true; -// } -// idChecker.clear(); -// if (!tileCount()) -// { -// validationMsg("There are no m_tiles"); -// valid = false; -// } -// foreach (Tile* tile, m_tiles) -// { -// if (!tile->isValid()) -// valid = false; -// if (idChecker[tile->id()]) -// validationMsg(QString("Duplicate tile with id %1").arg(tile->id())); -// idChecker[tile->id()] = true; -// } -// idChecker.clear(); -// if (!trainerCount()) -// { -// validationMsg("There are no times", Pokemod::V_Warn); -// } -// foreach (Trainer* trainer, m_trainers) -// { -// 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(); -// if (!timeCount()) -// { -// validationMsg("There are no times"); -// valid = false; -// } -// foreach (Time* time, m_times) -// { -// if (!time->isValid()) -// 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(); -// if (!typeCount()) -// { -// validationMsg("There are no types"); -// valid = false; -// } -// foreach (Type* type, m_types) -// { -// if (!type->isValid()) -// valid = false; -// if (idChecker[type->id()]) -// validationMsg(QString("Duplicate type with id %1").arg(type->id())); -// idChecker[type->id()] = true; -// } -// return valid; -} - -void Pokemod::load(const QDomElement& xml, const int) throw(Exception) +void Pokemod::validate(QTextStream& stream) +{ + if (m_title.isEmpty()) + error(stream, "Title is empty"); + if (m_version.isEmpty()) + error(stream, "Version is empty"); + if (m_description.isEmpty()) + warning(stream, "Description is empty"); + if (mapIndex(m_startMap) == INT_MAX) + error(stream, "Invalid starting map"); + else + { + if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX) + error(stream, "Invalid starting warp"); + } + if (m_superPCUname.isEmpty()) + warning(stream, "Super PC username not defined"); + if (m_superPCPasswd.isEmpty()) + warning(stream, "Super PC password not defined"); + if ((m_typeChart.width() != typeCount()) || (m_typeChart.height() != typeCount())) + error(stream, "Type chart is invalid"); + if (!m_rules.isValid(stream)) + setValid(false); + QSet<int> idChecker; + QSet<QString> nameChecker; + QSet<int> timeChecker; + if (m_rules.abilityAllowed()) + { + if (!abilityCount()) + error(stream, "There are no abilities"); + foreach (Ability* ability, m_abilities) + { + if (!ability->isValid(stream)) + setValid(false); + if (idChecker.contains(ability->id())) + subclassError(stream, "ability", ability->id()); + idChecker.insert(ability->id()); + if (nameChecker.contains(ability->name())) + subclassError(stream, "ability", ability->name()); + nameChecker.insert(ability->name()); + } + idChecker.clear(); + nameChecker.clear(); + } + if (!authorCount()) + error(stream, "There are no authors"); + foreach (Author* author, m_authors) + { + if (!author->isValid(stream)) + setValid(false); + if (idChecker.contains(author->id())) + subclassError(stream, "author", author->id()); + idChecker.insert(author->id()); + if (nameChecker.contains(author->name())) + subclassError(stream, "author", author->name()); + nameChecker.insert(author->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!badgeCount()) + error(stream, "There are no badges"); + foreach (Badge* badge, m_badges) + { + if (!badge->isValid(stream)) + setValid(false); + if (idChecker.contains(badge->id())) + subclassError(stream, "badge", badge->id()); + idChecker.insert(badge->id()); + if (nameChecker.contains(badge->name())) + subclassError(stream, "badge", badge->name()); + nameChecker.insert(badge->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!coinListCount()) + warning(stream, "There are no coin lists"); + foreach (CoinList* coinList, m_coinLists) + { + if (!coinList->isValid(stream)) + setValid(false); + if (idChecker.contains(coinList->id())) + subclassError(stream, "coin list", coinList->id()); + idChecker.insert(coinList->id()); + if (nameChecker.contains(coinList->name())) + subclassError(stream, "coin list", coinList->name()); + nameChecker.insert(coinList->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!dialogCount()) + error(stream, "There are no dialogs"); + foreach (Dialog* dialog, m_dialogs) + { + if (!dialog->isValid(stream)) + setValid(false); + if (idChecker.contains(dialog->id())) + subclassError(stream, "dialog", dialog->id()); + idChecker.insert(dialog->id()); + } + idChecker.clear(); + if (m_rules.breedingAllowed()) + { + if (!eggGroupCount()) + error(stream, "There are no egg groups"); + foreach (EggGroup* eggGroup, m_eggGroups) + { + if (!eggGroup->isValid(stream)) + setValid(false); + if (idChecker.contains(eggGroup->id())) + subclassError(stream, "egg group", eggGroup->id()); + idChecker.insert(eggGroup->id()); + if (nameChecker.contains(eggGroup->name())) + subclassError(stream, "egg group", eggGroup->name()); + nameChecker.insert(eggGroup->name()); + } + idChecker.clear(); + nameChecker.clear(); + } + if (!itemCount()) + warning(stream, "There are no items"); + foreach (Item* item, m_items) + { + if (!item->isValid(stream)) + setValid(false); + if (idChecker.contains(item->id())) + subclassError(stream, "item", item->id()); + idChecker.insert(item->id()); + if (nameChecker.contains(item->name())) + subclassError(stream, "item", item->name()); + nameChecker.insert(item->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!itemTypeCount() && itemCount()) + error(stream, "There are no item types"); + foreach (ItemType* itemType, m_itemTypes) + { + if (!itemType->isValid(stream)) + setValid(false); + if (idChecker.contains(itemType->id())) + subclassError(stream, "item type", itemType->id()); + idChecker.insert(itemType->id()); + if (nameChecker.contains(itemType->name())) + subclassError(stream, "item type", itemType->name()); + nameChecker.insert(itemType->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!mapCount()) + error(stream, "There are no maps"); + foreach (Map* map, m_maps) + { + if (!map->isValid(stream)) + setValid(false); + if (idChecker.contains(map->id())) + subclassError(stream, "map", map->id()); + idChecker.insert(map->id()); + if (nameChecker.contains(map->name())) + subclassError(stream, "map", map->name()); + nameChecker.insert(map->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!moveCount()) + error(stream, "There are no moves"); + foreach (Move* move, m_moves) + { + if (!move->isValid(stream)) + setValid(false); + if (idChecker.contains(move->id())) + subclassError(stream, "move", move->id()); + idChecker.insert(move->id()); + if (nameChecker.contains(move->name())) + subclassError(stream, "move", move->name()); + nameChecker.insert(move->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (m_rules.natureAllowed()) + { + if (!natureCount()) + error(stream, "There are no natures"); + foreach (Nature* nature, m_natures) + { + if (!nature->isValid(stream)) + setValid(false); + if (idChecker.contains(nature->id())) + subclassError(stream, "ability", nature->id()); + idChecker.insert(nature->id()); + } + idChecker.clear(); + nameChecker.clear(); + } + if (!speciesCount()) + error(stream, "There are no species"); + foreach (Species* m_species, m_species) + { + if (!m_species->isValid(stream)) + setValid(false); + if (idChecker.contains(m_species->id())) + subclassError(stream, "species", m_species->id()); + idChecker.insert(m_species->id()); + if (nameChecker.contains(m_species->name())) + subclassError(stream, "species", m_species->name()); + nameChecker.insert(m_species->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!storeCount()) + warning(stream, "There are no stores"); + foreach (Store* store, m_stores) + { + if (!store->isValid(stream)) + setValid(false); + if (idChecker.contains(store->id())) + subclassError(stream, "store", store->id()); + idChecker.insert(store->id()); + if (nameChecker.contains(store->name())) + subclassError(stream, "store", store->name()); + nameChecker.insert(store->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!tileCount()) + error(stream, "There are no tiles"); + foreach (Tile* tile, m_tiles) + { + if (!tile->isValid(stream)) + setValid(false); + if (idChecker.contains(tile->id())) + subclassError(stream, "tile", tile->id()); + idChecker.insert(tile->id()); + if (nameChecker.contains(tile->name())) + subclassError(stream, "tile", tile->name()); + nameChecker.insert(tile->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!trainerCount()) + warning(stream, "There are no trainers"); + foreach (Trainer* trainer, m_trainers) + { + if (!trainer->isValid(stream)) + setValid(false); + if (idChecker.contains(trainer->id())) + subclassError(stream, "trainer", trainer->id()); + idChecker.insert(trainer->id()); + if (nameChecker.contains(trainer->name())) + subclassError(stream, "trainer", trainer->name()); + nameChecker.insert(trainer->name()); + } + idChecker.clear(); + nameChecker.clear(); + if (!timeCount()) + error(stream, "There are no times"); + foreach (Time* time, m_times) + { + if (!time->isValid(stream)) + setValid(false); + if (idChecker.contains(time->id())) + subclassError(stream, "time", time->id()); + idChecker.insert(time->id()); + if (nameChecker.contains(time->name())) + subclassError(stream, "time", time->name()); + nameChecker.insert(time->name()); + if (timeChecker.contains((60 * time->hour()) + time->minute())) + subclassError(stream, "time", QString("%1:%2").arg(time->hour()).arg(time->minute())); + timeChecker.insert((60 * time->hour()) + time->minute()); + } + idChecker.clear(); + nameChecker.clear(); + if (!typeCount()) + error(stream, "There are no types"); + foreach (Type* type, m_types) + { + if (!type->isValid(stream)) + setValid(false); + if (idChecker.contains(type->id())) + subclassError(stream, "type", type->id()); + idChecker.insert(type->id()); + if (nameChecker.contains(type->name())) + subclassError(stream, "type", type->name()); + nameChecker.insert(type->name()); + } +} + +void Pokemod::load(const QDomElement& xml, const int) { clear(); LOAD(QString, title); @@ -454,25 +456,6 @@ int Pokemod::maxCompatability(const Pokemod& pokemod) const // TODO: MaxCompatability between two versions } -void Pokemod::validationMsg(const QString& message, const Validation level) const throw(Exception) -{ - if (!valOutput) - throw(Exception(className(), "valOutput isn\'t set")); - if (V_End < level) - warning<BoundsException>("level"); - (*valOutput) << ValidationStr[level] << ": " << message; -} - -void Pokemod::setValOutput(QStringList& s) -{ - valOutput = &s; -} - -void Pokemod::unsetValOutput() -{ - valOutput = NULL; -} - void Pokemod::setTitle(const QString& title) { m_title = title; @@ -488,61 +471,88 @@ void Pokemod::setDescription(const QString& description) m_description = description; } -void Pokemod::setStartMap(const int startMap) throw(BoundsException) +void Pokemod::setStartMap(const int startMap) { if (mapIndex(startMap) == INT_MAX) - error<BoundsException>("startMap"); + { + boundsError("startMap"); + return; + } m_startMap = startMap; } -void Pokemod::setStartWarp(const int startWarp) throw(BoundsException) +void Pokemod::setStartWarp(const int startWarp) { if (mapIndex(m_startMap) == INT_MAX) - error<BoundsException>("startMap"); + { + boundsError("startMap"); + return; + } if (mapById(m_startMap)->warpIndex(startWarp) == INT_MAX) - error<BoundsException>("startWarp"); + { + boundsError("startWarp"); + return; + } m_startWarp = startWarp; } -void Pokemod::setWalkSkin(const QPixmap& walkSkin) throw(SizeException) +void Pokemod::setWalkSkin(const QPixmap& walkSkin) { if (walkSkin.size() != QSize(192, 128)) - error<SizeException>("walkSkin"); + { + sizeError("walkSkin"); + return; + } m_walkSkin = walkSkin; } -void Pokemod::setBikeSkin(const QPixmap& bikeSkin) throw(SizeException) +void Pokemod::setBikeSkin(const QPixmap& bikeSkin) { if (bikeSkin.size() != QSize(192, 128)) - error<SizeException>("bikeSkin"); + { + sizeError("bikeSkin"); + return; + } m_bikeSkin = bikeSkin; } -void Pokemod::setSurfSkin(const QPixmap& surfSkin) throw(SizeException) +void Pokemod::setSurfSkin(const QPixmap& surfSkin) { if (surfSkin.size() != QSize(192, 128)) - error<SizeException>("surfSkin"); + { + sizeError("surfSkin"); + return; + } m_surfSkin = surfSkin; } -void Pokemod::setFlySkin(const QPixmap& flySkin) throw(SizeException) +void Pokemod::setFlySkin(const QPixmap& flySkin) { if (flySkin.size() != QSize(192, 128)) - error<SizeException>("flySkin"); + { + sizeError("flySkin"); + return; + } m_flySkin = flySkin; } -void Pokemod::setFishSkin(const QPixmap& fishSkin) throw(SizeException) +void Pokemod::setFishSkin(const QPixmap& fishSkin) { if (fishSkin.size() != QSize(192, 128)) - error<SizeException>("fishSkin"); + { + sizeError("fishSkin"); + return; + } m_fishSkin = fishSkin; } -void Pokemod::setSurfFishSkin(const QPixmap& surfFishSkin) throw(SizeException) +void Pokemod::setSurfFishSkin(const QPixmap& surfFishSkin) { if (surfFishSkin.size() != QSize(192, 128)) - error<SizeException>("surfFishSkin"); + { + sizeError("surfFishSkin"); + return; + } m_surfFishSkin = surfFishSkin; } @@ -558,7 +568,7 @@ void Pokemod::setSuperPCPasswd(const QString& password) void Pokemod::setTypeChart(const int attack, const int defense, const Fraction& multiplier) { - m_typeChart(attack, defense) = multiplier; + m_typeChart.set(attack, defense, multiplier); } void Pokemod::setRules(const Rules& rules) @@ -661,26 +671,26 @@ Rules* Pokemod::rules() return &m_rules; } -const Ability* Pokemod::ability(const int index) const throw(IndexException) +const Ability* Pokemod::ability(const int index) const { if (abilityCount() <= index) - warning<IndexException>("ability"); + return NULL; return m_abilities.at(index); } -Ability* Pokemod::ability(const int index) throw(IndexException) +Ability* Pokemod::ability(const int index) { if (abilityCount() <= index) - error<IndexException>("ability"); + return NULL; return m_abilities[index]; } -const Ability* Pokemod::abilityById(const int id) const throw(IndexException) +const Ability* Pokemod::abilityById(const int id) const { return ability(abilityIndex(id)); } -Ability* Pokemod::abilityById(const int id) throw(IndexException) +Ability* Pokemod::abilityById(const int id) { return ability(abilityIndex(id)); } @@ -721,15 +731,15 @@ Ability* Pokemod::newAbility(Ability* ability) return ability; } -void Pokemod::deleteAbility(const int index) throw(IndexException) +void Pokemod::deleteAbility(const int index) { if (abilityCount() <= index) - error<IndexException>("ability"); + return; delete m_abilities[index]; m_abilities.removeAt(index); } -void Pokemod::deleteAbilityById(const int id) throw(IndexException) +void Pokemod::deleteAbilityById(const int id) { deleteAbility(abilityIndex(id)); } @@ -742,26 +752,26 @@ int Pokemod::newAbilityId() const return i; } -const Author* Pokemod::author(const int index) const throw(IndexException) +const Author* Pokemod::author(const int index) const { if (authorCount() <= index) - warning<IndexException>("author"); + return NULL; return m_authors.at(index); } -Author* Pokemod::author(const int index) throw(IndexException) +Author* Pokemod::author(const int index) { if (authorCount() <= index) - error<IndexException>("author"); + return NULL; return m_authors[index]; } -const Author* Pokemod::authorById(const int id) const throw(IndexException) +const Author* Pokemod::authorById(const int id) const { return author(authorIndex(id)); } -Author* Pokemod::authorById(const int id) throw(IndexException) +Author* Pokemod::authorById(const int id) { return author(authorIndex(id)); } @@ -802,15 +812,15 @@ Author* Pokemod::newAuthor(Author* author) return author; } -void Pokemod::deleteAuthor(const int index) throw(IndexException) +void Pokemod::deleteAuthor(const int index) { if (authorCount() <= index) - error<IndexException>("author"); + return; delete m_authors[index]; m_authors.removeAt(index); } -void Pokemod::deleteAuthorById(const int id) throw(IndexException) +void Pokemod::deleteAuthorById(const int id) { deleteAuthor(authorIndex(id)); } @@ -823,26 +833,26 @@ int Pokemod::newAuthorId() const return i; } -const Badge* Pokemod::badge(const int index) const throw(IndexException) +const Badge* Pokemod::badge(const int index) const { if (badgeCount() <= index) - warning<IndexException>("badge"); + return NULL; return m_badges.at(index); } -Badge* Pokemod::badge(const int index) throw(IndexException) +Badge* Pokemod::badge(const int index) { if (badgeCount() <= index) - error<IndexException>("badge"); + return NULL; return m_badges[index]; } -const Badge* Pokemod::badgeById(const int id) const throw(IndexException) +const Badge* Pokemod::badgeById(const int id) const { return badge(badgeIndex(id)); } -Badge* Pokemod::badgeById(const int id) throw(IndexException) +Badge* Pokemod::badgeById(const int id) { return badge(badgeIndex(id)); } @@ -883,15 +893,15 @@ Badge* Pokemod::newBadge(Badge* badge) return badge; } -void Pokemod::deleteBadge(const int index) throw(IndexException) +void Pokemod::deleteBadge(const int index) { if (badgeCount() <= index) - error<IndexException>("badge"); + return; delete m_badges[index]; m_badges.removeAt(index); } -void Pokemod::deleteBadgeById(const int id) throw(IndexException) +void Pokemod::deleteBadgeById(const int id) { deleteBadge(badgeIndex(id)); } @@ -904,26 +914,26 @@ int Pokemod::newBadgeId() const return i; } -const CoinList* Pokemod::coinList(const int index) const throw(IndexException) +const CoinList* Pokemod::coinList(const int index) const { if (coinListCount() <= index) - warning<IndexException>("coin list"); + return NULL; return m_coinLists.at(index); } -CoinList* Pokemod::coinList(const int index) throw(IndexException) +CoinList* Pokemod::coinList(const int index) { if (coinListCount() <= index) - error<IndexException>("coin list"); + return NULL; return m_coinLists[index]; } -const CoinList* Pokemod::coinListById(const int id) const throw(IndexException) +const CoinList* Pokemod::coinListById(const int id) const { return coinList(coinListIndex(id)); } -CoinList* Pokemod::coinListById(const int id) throw(IndexException) +CoinList* Pokemod::coinListById(const int id) { return coinList(coinListIndex(id)); } @@ -964,15 +974,15 @@ CoinList* Pokemod::newCoinList(CoinList* coinList) return coinList; } -void Pokemod::deleteCoinList(const int index) throw(IndexException) +void Pokemod::deleteCoinList(const int index) { if (coinListCount() <= index) - error<IndexException>("coin list"); + return; delete m_coinLists[index]; m_coinLists.removeAt(index); } -void Pokemod::deleteCoinListById(const int id) throw(IndexException) +void Pokemod::deleteCoinListById(const int id) { deleteCoinList(coinListIndex(id)); } @@ -985,26 +995,26 @@ int Pokemod::newCoinListId() const return i; } -const Dialog* Pokemod::dialog(const int index) const throw(IndexException) +const Dialog* Pokemod::dialog(const int index) const { if (dialogCount() <= index) - warning<IndexException>("dialog"); + return NULL; return m_dialogs.at(index); } -Dialog* Pokemod::dialog(const int index) throw(IndexException) +Dialog* Pokemod::dialog(const int index) { if (dialogCount() <= index) - error<IndexException>("dialog"); + return NULL; return m_dialogs[index]; } -const Dialog* Pokemod::dialogById(const int id) const throw(IndexException) +const Dialog* Pokemod::dialogById(const int id) const { return dialog(dialogIndex(id)); } -Dialog* Pokemod::dialogById(const int id) throw(IndexException) +Dialog* Pokemod::dialogById(const int id) { return dialog(dialogIndex(id)); } @@ -1045,15 +1055,15 @@ Dialog* Pokemod::newDialog(Dialog* dialog) return dialog; } -void Pokemod::deleteDialog(const int index) throw(IndexException) +void Pokemod::deleteDialog(const int index) { if (dialogCount() <= index) - error<IndexException>("dialog"); + return; delete m_dialogs[index]; m_dialogs.removeAt(index); } -void Pokemod::deleteDialogById(const int id) throw(IndexException) +void Pokemod::deleteDialogById(const int id) { deleteDialog(dialogIndex(id)); } @@ -1066,26 +1076,26 @@ int Pokemod::newDialogId() const return i; } -const EggGroup* Pokemod::eggGroup(const int index) const throw(IndexException) +const EggGroup* Pokemod::eggGroup(const int index) const { if (eggGroupCount() <= index) - warning<IndexException>("egg group"); + return NULL; return m_eggGroups.at(index); } -EggGroup* Pokemod::eggGroup(const int index) throw(IndexException) +EggGroup* Pokemod::eggGroup(const int index) { if (eggGroupCount() <= index) - error<IndexException>("egg group"); + return NULL; return m_eggGroups[index]; } -const EggGroup* Pokemod::eggGroupById(const int id) const throw(IndexException) +const EggGroup* Pokemod::eggGroupById(const int id) const { return eggGroup(eggGroupIndex(id)); } -EggGroup* Pokemod::eggGroupById(const int id) throw(IndexException) +EggGroup* Pokemod::eggGroupById(const int id) { return eggGroup(eggGroupIndex(id)); } @@ -1126,15 +1136,15 @@ EggGroup* Pokemod::newEggGroup(EggGroup* eggGroup) return eggGroup; } -void Pokemod::deleteEggGroup(const int index) throw(IndexException) +void Pokemod::deleteEggGroup(const int index) { if (eggGroupCount() <= index) - error<IndexException>("egg group"); + return; delete m_eggGroups[index]; m_eggGroups.removeAt(index); } -void Pokemod::deleteEggGroupById(const int id) throw(IndexException) +void Pokemod::deleteEggGroupById(const int id) { deleteEggGroup(eggGroupIndex(id)); } @@ -1147,26 +1157,26 @@ int Pokemod::newEggGroupId() const return i; } -const Item* Pokemod::item(const int index) const throw(IndexException) +const Item* Pokemod::item(const int index) const { if (itemCount() <= index) - warning<IndexException>("item"); + return NULL; return m_items.at(index); } -Item* Pokemod::item(const int index) throw(IndexException) +Item* Pokemod::item(const int index) { if (itemCount() <= index) - error<IndexException>("item"); + return NULL; return m_items[index]; } -const Item* Pokemod::itemById(const int id) const throw(IndexException) +const Item* Pokemod::itemById(const int id) const { return item(itemIndex(id)); } -Item* Pokemod::itemById(const int id) throw(IndexException) +Item* Pokemod::itemById(const int id) { return item(itemIndex(id)); } @@ -1207,15 +1217,15 @@ Item* Pokemod::newItem(Item* item) return item; } -void Pokemod::deleteItem(const int index) throw(IndexException) +void Pokemod::deleteItem(const int index) { if (itemCount() <= index) - error<IndexException>("item"); + return; delete m_items[index]; m_items.removeAt(index); } -void Pokemod::deleteItemById(const int id) throw(IndexException) +void Pokemod::deleteItemById(const int id) { deleteItem(itemIndex(id)); } @@ -1228,26 +1238,26 @@ int Pokemod::newItemId() const return i; } -const ItemType* Pokemod::itemType(const int index) const throw(IndexException) +const ItemType* Pokemod::itemType(const int index) const { if (itemTypeCount() <= index) - warning<IndexException>("item type"); + return NULL; return m_itemTypes.at(index); } -ItemType* Pokemod::itemType(const int index) throw(IndexException) +ItemType* Pokemod::itemType(const int index) { if (itemTypeCount() <= index) - error<IndexException>("item type"); + return NULL; return m_itemTypes[index]; } -const ItemType* Pokemod::itemTypeById(const int id) const throw(IndexException) +const ItemType* Pokemod::itemTypeById(const int id) const { return itemType(itemTypeIndex(id)); } -ItemType* Pokemod::itemTypeById(const int id) throw(IndexException) +ItemType* Pokemod::itemTypeById(const int id) { return itemType(itemTypeIndex(id)); } @@ -1288,15 +1298,15 @@ ItemType* Pokemod::newItemType(ItemType* itemType) return itemType; } -void Pokemod::deleteItemType(const int index) throw(IndexException) +void Pokemod::deleteItemType(const int index) { if (itemTypeCount() <= index) - error<IndexException>("item type"); + return; delete m_itemTypes[index]; m_itemTypes.removeAt(index); } -void Pokemod::deleteItemTypeById(const int id) throw(IndexException) +void Pokemod::deleteItemTypeById(const int id) { deleteItemType(itemTypeIndex(id)); } @@ -1309,26 +1319,26 @@ int Pokemod::newItemTypeId() const return i; } -const Map* Pokemod::map(const int index) const throw(IndexException) +const Map* Pokemod::map(const int index) const { if (mapCount() <= index) - warning<IndexException>("map"); + return NULL; return m_maps.at(index); } -Map* Pokemod::map(const int index) throw(IndexException) +Map* Pokemod::map(const int index) { if (mapCount() <= index) - error<IndexException>("map"); + return NULL; return m_maps[index]; } -const Map* Pokemod::mapById(const int id) const throw(IndexException) +const Map* Pokemod::mapById(const int id) const { return map(mapIndex(id)); } -Map* Pokemod::mapById(const int id) throw(IndexException) +Map* Pokemod::mapById(const int id) { return map(mapIndex(id)); } @@ -1369,15 +1379,15 @@ Map* Pokemod::newMap(Map* map) return map; } -void Pokemod::deleteMap(const int index) throw(IndexException) +void Pokemod::deleteMap(const int index) { if (mapCount() <= index) - error<IndexException>("map"); + return; delete m_maps[index]; m_maps.removeAt(index); } -void Pokemod::deleteMapById(const int id) throw(IndexException) +void Pokemod::deleteMapById(const int id) { deleteMap(mapIndex(id)); } @@ -1390,26 +1400,26 @@ int Pokemod::newMapId() const return i; } -const Move* Pokemod::move(const int index) const throw(IndexException) +const Move* Pokemod::move(const int index) const { if (moveCount() <= index) - warning<IndexException>("move"); + return NULL; return m_moves.at(index); } -Move* Pokemod::move(const int index) throw(IndexException) +Move* Pokemod::move(const int index) { if (moveCount() <= index) - error<IndexException>("move"); + return NULL; return m_moves[index]; } -const Move* Pokemod::moveById(const int id) const throw(IndexException) +const Move* Pokemod::moveById(const int id) const { return move(moveIndex(id)); } -Move* Pokemod::moveById(const int id) throw(IndexException) +Move* Pokemod::moveById(const int id) { return move(moveIndex(id)); } @@ -1450,15 +1460,15 @@ Move* Pokemod::newMove(Move* move) return move; } -void Pokemod::deleteMove(const int index) throw(IndexException) +void Pokemod::deleteMove(const int index) { if (moveCount() <= index) - error<IndexException>("move"); + return; delete m_moves[index]; m_moves.removeAt(index); } -void Pokemod::deleteMoveById(const int id) throw(IndexException) +void Pokemod::deleteMoveById(const int id) { deleteMove(moveIndex(id)); } @@ -1471,26 +1481,26 @@ int Pokemod::newMoveId() const return i; } -const Nature* Pokemod::nature(const int index) const throw(IndexException) +const Nature* Pokemod::nature(const int index) const { if (natureCount() <= index) - warning<IndexException>("nature"); + return NULL; return m_natures.at(index); } -Nature* Pokemod::nature(const int index) throw(IndexException) +Nature* Pokemod::nature(const int index) { if (natureCount() <= index) - error<IndexException>("nature"); + return NULL; return m_natures[index]; } -const Nature* Pokemod::natureById(const int id) const throw(IndexException) +const Nature* Pokemod::natureById(const int id) const { return nature(natureIndex(id)); } -Nature* Pokemod::natureById(const int id) throw(IndexException) +Nature* Pokemod::natureById(const int id) { return nature(natureIndex(id)); } @@ -1531,15 +1541,15 @@ Nature* Pokemod::newNature(Nature* nature) return nature; } -void Pokemod::deleteNature(const int index) throw(IndexException) +void Pokemod::deleteNature(const int index) { if (natureCount() <= index) - error<IndexException>("nature"); + return; delete m_natures[index]; m_natures.removeAt(index); } -void Pokemod::deleteNatureById(const int id) throw(IndexException) +void Pokemod::deleteNatureById(const int id) { deleteNature(natureIndex(id)); } @@ -1552,26 +1562,26 @@ int Pokemod::newNatureId() const return i; } -const Species* Pokemod::species(const int index) const throw(IndexException) +const Species* Pokemod::species(const int index) const { if (speciesCount() <= index) - warning<IndexException>("species"); + return NULL; return m_species.at(index); } -Species* Pokemod::species(const int index) throw(IndexException) +Species* Pokemod::species(const int index) { if (speciesCount() <= index) - error<IndexException>("species"); + return NULL; return m_species[index]; } -const Species* Pokemod::speciesById(const int id) const throw(IndexException) +const Species* Pokemod::speciesById(const int id) const { return species(speciesIndex(id)); } -Species* Pokemod::speciesById(const int id) throw(IndexException) +Species* Pokemod::speciesById(const int id) { return species(speciesIndex(id)); } @@ -1612,15 +1622,15 @@ Species* Pokemod::newSpecies(Species* species) return species; } -void Pokemod::deleteSpecies(const int index) throw(IndexException) +void Pokemod::deleteSpecies(const int index) { if (speciesCount() <= index) - error<IndexException>("species"); + return; delete m_species[index]; m_species.removeAt(index); } -void Pokemod::deleteSpeciesById(const int id) throw(IndexException) +void Pokemod::deleteSpeciesById(const int id) { deleteSpecies(speciesIndex(id)); } @@ -1633,26 +1643,26 @@ int Pokemod::newSpeciesId() const return i; } -const Store* Pokemod::store(const int index) const throw(IndexException) +const Store* Pokemod::store(const int index) const { if (storeCount() <= index) - warning<IndexException>("store"); + return NULL; return m_stores.at(index); } -Store* Pokemod::store(const int index) throw(IndexException) +Store* Pokemod::store(const int index) { if (storeCount() <= index) - error<IndexException>("store"); + return NULL; return m_stores[index]; } -const Store* Pokemod::storeById(const int id) const throw(IndexException) +const Store* Pokemod::storeById(const int id) const { return store(storeIndex(id)); } -Store* Pokemod::storeById(const int id) throw(IndexException) +Store* Pokemod::storeById(const int id) { return store(storeIndex(id)); } @@ -1693,15 +1703,15 @@ Store* Pokemod::newStore(Store* store) return store; } -void Pokemod::deleteStore(const int index) throw(IndexException) +void Pokemod::deleteStore(const int index) { if (storeCount() <= index) - error<IndexException>("store"); + return; delete m_stores[index]; m_stores.removeAt(index); } -void Pokemod::deleteStoreById(const int id) throw(IndexException) +void Pokemod::deleteStoreById(const int id) { deleteStore(storeIndex(id)); } @@ -1714,26 +1724,26 @@ int Pokemod::newStoreId() const return i; } -const Tile* Pokemod::tile(const int index) const throw(IndexException) +const Tile* Pokemod::tile(const int index) const { if (tileCount() <= index) - warning<IndexException>("tile"); + return NULL; return m_tiles.at(index); } -Tile* Pokemod::tile(const int index) throw(IndexException) +Tile* Pokemod::tile(const int index) { if (tileCount() <= index) - error<IndexException>("tile"); + return NULL; return m_tiles[index]; } -const Tile* Pokemod::tileById(const int id) const throw(IndexException) +const Tile* Pokemod::tileById(const int id) const { return tile(tileIndex(id)); } -Tile* Pokemod::tileById(const int id) throw(IndexException) +Tile* Pokemod::tileById(const int id) { return tile(tileIndex(id)); } @@ -1774,15 +1784,15 @@ Tile* Pokemod::newTile(Tile* tile) return tile; } -void Pokemod::deleteTile(const int index) throw(IndexException) +void Pokemod::deleteTile(const int index) { if (tileCount() <= index) - error<IndexException>("tile"); + return; delete m_tiles[index]; m_tiles.removeAt(index); } -void Pokemod::deleteTileById(const int id) throw(IndexException) +void Pokemod::deleteTileById(const int id) { deleteTile(tileIndex(id)); } @@ -1795,26 +1805,26 @@ int Pokemod::newTileId() const return i; } -const Time* Pokemod::time(const int index) const throw(IndexException) +const Time* Pokemod::time(const int index) const { if (timeCount() <= index) - warning<IndexException>("time"); + return NULL; return m_times.at(index); } -Time* Pokemod::time(const int i) throw(IndexException) +Time* Pokemod::time(const int i) { if (timeCount() <= i) - error<IndexException>("time"); + return NULL; return m_times[i]; } -const Time* Pokemod::timeById(const int id) const throw(IndexException) +const Time* Pokemod::timeById(const int id) const { return time(timeIndex(id)); } -Time* Pokemod::timeById(const int id) throw(IndexException) +Time* Pokemod::timeById(const int id) { return time(timeIndex(id)); } @@ -1855,15 +1865,15 @@ Time* Pokemod::newTime(Time* time) return time; } -void Pokemod::deleteTime(const int index) throw(IndexException) +void Pokemod::deleteTime(const int index) { if (timeCount() <= index) - error<IndexException>("time"); + return; delete m_times[index]; m_times.removeAt(index); } -void Pokemod::deleteTimeById(const int id) throw(IndexException) +void Pokemod::deleteTimeById(const int id) { deleteTime(timeIndex(id)); } @@ -1876,26 +1886,26 @@ int Pokemod::newTimeId() const return i; } -const Trainer* Pokemod::trainer(const int index) const throw(IndexException) +const Trainer* Pokemod::trainer(const int index) const { if (trainerCount() <= index) - warning<IndexException>("trainer"); + return NULL; return m_trainers.at(index); } -Trainer* Pokemod::trainer(const int index) throw(IndexException) +Trainer* Pokemod::trainer(const int index) { if (trainerCount() <= index) - error<IndexException>("trainer"); + return NULL; return m_trainers[index]; } -const Trainer* Pokemod::trainerById(const int id) const throw(IndexException) +const Trainer* Pokemod::trainerById(const int id) const { return trainer(trainerIndex(id)); } -Trainer* Pokemod::trainerById(const int id) throw(IndexException) +Trainer* Pokemod::trainerById(const int id) { return trainer(trainerIndex(id)); } @@ -1936,15 +1946,15 @@ Trainer* Pokemod::newTrainer(Trainer* trainer) return trainer; } -void Pokemod::deleteTrainer(const int index) throw(IndexException) +void Pokemod::deleteTrainer(const int index) { if (trainerCount() <= index) - error<IndexException>("trainer"); + return; delete m_trainers[index]; m_trainers.removeAt(index); } -void Pokemod::deleteTrainerById(const int id) throw(IndexException) +void Pokemod::deleteTrainerById(const int id) { deleteTrainer(trainerIndex(id)); } @@ -1957,26 +1967,26 @@ int Pokemod::newTrainerId() const return i; } -const Type* Pokemod::type(const int index) const throw(IndexException) +const Type* Pokemod::type(const int index) const { if (typeCount() <= index) - warning<IndexException>("type"); + return NULL; return m_types.at(index); } -Type* Pokemod::type(const int index) throw(IndexException) +Type* Pokemod::type(const int index) { if (typeCount() <= index) - error<IndexException>("type"); + return NULL; return m_types[index]; } -const Type* Pokemod::typeById(const int id) const throw(IndexException) +const Type* Pokemod::typeById(const int id) const { return type(typeIndex(id)); } -Type* Pokemod::typeById(const int id) throw(IndexException) +Type* Pokemod::typeById(const int id) { return type(typeIndex(id)); } @@ -2024,10 +2034,10 @@ Type* Pokemod::newType(Type* type) return type; } -void Pokemod::deleteType(const int index) throw(IndexException) +void Pokemod::deleteType(const int index) { if (typeCount() <= index) - error<IndexException>("type"); + return; delete m_types[index]; if (typeCount() == 1) m_typeChart.deleteColumn(index); @@ -2039,7 +2049,7 @@ void Pokemod::deleteType(const int index) throw(IndexException) m_types.removeAt(index); } -void Pokemod::deleteTypeById(const int id) throw(IndexException) +void Pokemod::deleteTypeById(const int id) { deleteType(typeIndex(id)); } |
