From 2b653821cc31f18adb5d50bb0bc19048939670dc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 21 Jan 2008 00:44:23 +0000 Subject: [ADD] More GUI classes (only MoveEffect left) [FIX] Polished up GUI classes [FIX] renamed methods get*ByID -> get*Index instead for more logical get*ByID [FIX] Renaming in pokemod to remove mention of Pokémon [FIX] minor .pro fixes (aesthetic mainly) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@35 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- Changelog | 11 + battle/battle.pro | 6 +- general/general.pro | 6 +- menus/menus.pro | 6 +- overworld/overworld.pro | 6 +- pokegen/pokegen.pro | 6 +- pokemod/Ability.cpp | 14 +- pokemod/Ability.h | 4 +- pokemod/AbilityEffect.cpp | 12 +- pokemod/CoinList.cpp | 20 +- pokemod/CoinList.h | 4 +- pokemod/CoinListObject.cpp | 6 +- pokemod/Dialog.cpp | 78 ++--- pokemod/Item.cpp | 20 +- pokemod/Item.h | 4 +- pokemod/ItemEffect.cpp | 20 +- pokemod/Map.cpp | 107 ++++++- pokemod/Map.h | 16 +- pokemod/MapEffect.cpp | 28 +- pokemod/MapEffect.h | 4 - pokemod/MapTrainer.cpp | 135 ++++---- pokemod/MapTrainer.h | 32 +- pokemod/MapTrainerPokemon.cpp | 208 ------------- pokemod/MapTrainerPokemon.h | 72 ----- pokemod/MapTrainerTeamMember.cpp | 201 ++++++++++++ pokemod/MapTrainerTeamMember.h | 68 ++++ pokemod/MapWarp.cpp | 34 +- pokemod/MapWarp.h | 4 - pokemod/MapWildList.cpp | 74 +++-- pokemod/MapWildList.h | 22 +- pokemod/MapWildListEncounter.cpp | 133 ++++++++ pokemod/MapWildListEncounter.h | 62 ++++ pokemod/MapWildListPokemon.cpp | 133 -------- pokemod/MapWildListPokemon.h | 62 ---- pokemod/Move.cpp | 20 +- pokemod/Move.h | 6 +- pokemod/Object.h | 2 +- pokemod/Pokemod.cpp | 309 +++++++++++------- pokemod/Pokemod.h | 81 +++-- pokemod/Rules.cpp | 48 +-- pokemod/Rules.h | 12 +- pokemod/Species.cpp | 92 ++++-- pokemod/Species.h | 19 +- pokemod/SpeciesAbility.cpp | 4 +- pokemod/SpeciesAbility.h | 2 +- pokemod/SpeciesEvolution.cpp | 16 +- pokemod/SpeciesItem.cpp | 4 +- pokemod/SpeciesItem.h | 2 +- pokemod/SpeciesMove.cpp | 4 +- pokemod/Store.cpp | 8 +- pokemod/TODO | 2 +- pokemod/Tile.cpp | 6 +- pokemod/Type.h | 2 +- pokemod/pokemod.pro | 6 +- pokemod/pokemod_inc.h | 4 +- pokemodr/gui/ability.ui | 52 +++- pokemodr/gui/abilityeffect.ui | 136 +++++++- pokemodr/gui/author.ui | 51 ++- pokemodr/gui/badge.ui | 167 ++++++++-- pokemodr/gui/coinlist.ui | 54 +++- pokemodr/gui/coinlistobject.ui | 84 ++++- pokemodr/gui/dialog.ui | 60 +++- pokemodr/gui/egggroup.ui | 45 ++- pokemodr/gui/item.ui | 67 +++- pokemodr/gui/itemeffect.ui | 151 ++++++--- pokemodr/gui/itemtype.ui | 49 ++- pokemodr/gui/map.ui | 82 ++++- pokemodr/gui/mapeffect.ui | 129 ++++++-- pokemodr/gui/maptrainer.ui | 383 +++++++++++++++++++++++ pokemodr/gui/maptrainerteammember.ui | 160 ++++++++++ pokemodr/gui/mapwarp.ui | 368 ++++++++++++++++++++++ pokemodr/gui/mapwildlist.ui | 157 ++++++++++ pokemodr/gui/mapwildlistencounter.ui | 139 +++++++++ pokemodr/gui/move.ui | 337 ++++++++++++++++++++ pokemodr/gui/nature.ui | 180 +++++++++++ pokemodr/gui/pokemod.ui | 151 ++++----- pokemodr/gui/rules.ui | 144 +++++++-- pokemodr/gui/skins.ui | 60 +++- pokemodr/gui/species.ui | 585 +++++++++++++++++++++++++++++++++++ pokemodr/gui/speciesability.ui | 120 +++++++ pokemodr/gui/speciesevolution.ui | 208 +++++++++++++ pokemodr/gui/speciesitem.ui | 86 +++++ pokemodr/gui/speciesmove.ui | 139 +++++++++ pokemodr/gui/tile.ui | 100 +++++- pokemodr/gui/time.ui | 49 ++- pokemodr/gui/type.ui | 60 +++- pokemodr/gui/typechart.ui | 96 +++--- pokemodr/pokemodr.pro | 8 +- 88 files changed, 5571 insertions(+), 1353 deletions(-) delete mode 100644 pokemod/MapTrainerPokemon.cpp delete mode 100644 pokemod/MapTrainerPokemon.h create mode 100644 pokemod/MapTrainerTeamMember.cpp create mode 100644 pokemod/MapTrainerTeamMember.h create mode 100644 pokemod/MapWildListEncounter.cpp create mode 100644 pokemod/MapWildListEncounter.h delete mode 100644 pokemod/MapWildListPokemon.cpp delete mode 100644 pokemod/MapWildListPokemon.h create mode 100644 pokemodr/gui/maptrainer.ui create mode 100644 pokemodr/gui/maptrainerteammember.ui create mode 100644 pokemodr/gui/mapwarp.ui create mode 100644 pokemodr/gui/mapwildlist.ui create mode 100644 pokemodr/gui/mapwildlistencounter.ui create mode 100644 pokemodr/gui/move.ui create mode 100644 pokemodr/gui/nature.ui create mode 100644 pokemodr/gui/species.ui create mode 100644 pokemodr/gui/speciesability.ui create mode 100644 pokemodr/gui/speciesevolution.ui create mode 100644 pokemodr/gui/speciesitem.ui create mode 100644 pokemodr/gui/speciesmove.ui diff --git a/Changelog b/Changelog index 23e3a1fd..a3117c43 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,14 @@ +----------------- +Rev: 35 +Date: 20 January 2008 +User: MathStuf +----------------- +[ADD] More GUI classes (only MoveEffect left) +[FIX] Polished up GUI classes +[FIX] renamed methods get*ByID -> get*Index instead for more logical get*ByID +[FIX] Renaming in pokemod to remove mention of Pokémon +[FIX] minor .pro fixes (aesthetic mainly) + ----------------- Rev: 34 Date: 19 January 2008 diff --git a/battle/battle.pro b/battle/battle.pro index daa0d9b6..f24900da 100644 --- a/battle/battle.pro +++ b/battle/battle.pro @@ -3,7 +3,7 @@ DESTDIR = ../../lib TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod -CONFIG += qt warn_on dll +CONFIG += qt warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/general/general.pro b/general/general.pro index c212fb2c..dc8166d3 100644 --- a/general/general.pro +++ b/general/general.pro @@ -2,7 +2,7 @@ OBJECTS_DIR = ../../obj/general DESTDIR = ../../lib TEMPLATE = lib -CONFIG += qt warn_on dll +CONFIG += qt warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/menus/menus.pro b/menus/menus.pro index cc232704..96d70111 100644 --- a/menus/menus.pro +++ b/menus/menus.pro @@ -3,7 +3,7 @@ DESTDIR = ../../lib TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod -CONFIG += qt warn_on dll +CONFIG += qt warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/overworld/overworld.pro b/overworld/overworld.pro index d9fa2fe5..1cbb6fa6 100644 --- a/overworld/overworld.pro +++ b/overworld/overworld.pro @@ -3,7 +3,7 @@ DESTDIR = ../../lib TEMPLATE = lib LIBS += -L../../lib -lgeneral -lpokemod -CONFIG += qt warn_on dll +CONFIG += qt warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/pokegen/pokegen.pro b/pokegen/pokegen.pro index 88406d08..f251f962 100644 --- a/pokegen/pokegen.pro +++ b/pokegen/pokegen.pro @@ -3,7 +3,7 @@ DESTDIR = ../../bin TEMPLATE = app LIBS += -L../../lib -lgeneral -lpokemod -loverworld -lbattle -laudio -lmenus -CONFIG += qt gui warn_on dll +CONFIG += qt gui warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp index 576161c0..d5ff41d0 100644 --- a/pokemod/Ability.cpp +++ b/pokemod/Ability.cpp @@ -79,7 +79,7 @@ bool PokeMod::Ability::validate() const unsigned PokeMod::Ability::getNewId() const { unsigned i = 0; - for (; (i < getEffectCount()) && (getEffectByID(i) != UINT_MAX); ++i) + for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) ; return i; } @@ -137,7 +137,17 @@ PokeMod::AbilityEffect& PokeMod::Ability::getEffect(const unsigned i) throw(Inde return effects[i]; } -unsigned PokeMod::Ability::getEffectByID(const unsigned _id) const +const PokeMod::AbilityEffect& PokeMod::Ability::getEffectByID(const unsigned i) const throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +PokeMod::AbilityEffect& PokeMod::Ability::getEffectByID(const unsigned i) throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +unsigned PokeMod::Ability::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { diff --git a/pokemod/Ability.h b/pokemod/Ability.h index 4e2ec210..61865ae8 100644 --- a/pokemod/Ability.h +++ b/pokemod/Ability.h @@ -54,7 +54,9 @@ namespace PokeMod const AbilityEffect& getEffect(const unsigned i) const throw(IndexException); AbilityEffect& getEffect(const unsigned i) throw(IndexException); - unsigned getEffectByID(const unsigned _id) const; + const AbilityEffect& getEffectByID(const unsigned i) const throw(IndexException); + AbilityEffect& getEffectByID(const unsigned i) throw(IndexException); + unsigned getEffectIndex(const unsigned _id) const; unsigned getEffectCount() const; AbilityEffect& newEffect(); AbilityEffect& newEffect(const QString& fname); diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp index e0e855a1..eb4f5b1e 100644 --- a/pokemod/AbilityEffect.cpp +++ b/pokemod/AbilityEffect.cpp @@ -75,7 +75,7 @@ bool PokeMod::AbilityEffect::validate() const ok = false; break; case E_Ability: - if (pokemod.getAbilityByID(val1) == UINT_MAX) + if (pokemod.getAbilityIndex(val1) == UINT_MAX) ok = false; break; case E_AccuracyPowerTrade: @@ -87,7 +87,7 @@ bool PokeMod::AbilityEffect::validate() const ok = false; break; case E_Type: - if (pokemod.getTypeByID(val1) == UINT_MAX) + if (pokemod.getTypeIndex(val1) == UINT_MAX) ok = false; break; case E_Weather: @@ -167,7 +167,7 @@ bool PokeMod::AbilityEffect::validate() const ok = false; break; case T_Type: - if (pokemod.getTypeByID(tval1) == UINT_MAX) + if (pokemod.getTypeIndex(tval1) == UINT_MAX) ok = false; break; case T_HPBoundary: @@ -275,7 +275,7 @@ void PokeMod::AbilityEffect::setVal1(const unsigned v1) throw(Exception) throw(BoundsException("AbilityEffect", "val1")); break; case E_Ability: - if (pokemod.getAbilityByID(v1) == UINT_MAX) + if (pokemod.getAbilityIndex(v1) == UINT_MAX) throw(BoundsException("AbilityEffect", "val1")); break; case E_AccuracyPowerTrade: @@ -287,7 +287,7 @@ void PokeMod::AbilityEffect::setVal1(const unsigned v1) throw(Exception) throw(BoundsException("AbilityEffect", "val1")); break; case E_Type: - if (pokemod.getTypeByID(v1) == UINT_MAX) + if (pokemod.getTypeIndex(v1) == UINT_MAX) throw(BoundsException("AbilityEffect", "val1")); break; case E_Weather: @@ -373,7 +373,7 @@ void PokeMod::AbilityEffect::setTval1(const unsigned tv1) throw(Exception) throw(BoundsException("AbilityEffect", "tval1")); break; case T_Type: - if (pokemod.getTypeByID(tv1) == UINT_MAX) + if (pokemod.getTypeIndex(tv1) == UINT_MAX) throw(BoundsException("AbilityEffect", "tval1")); break; case T_HPBoundary: diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index c4ca7f98..b7d1d55e 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -55,7 +55,7 @@ bool PokeMod::CoinList::validate() const { QMap idChecker; QMap itemChecker; - QMap pokemonChecker; + QMap speciesChecker; for (QListIterator i(items); i.hasNext(); i.next()) { if (!i.peekNext().isValid()) @@ -64,7 +64,7 @@ bool PokeMod::CoinList::validate() const if (i.peekNext().getType() == CoinListObject::Item) ++itemChecker[i.peekNext().getObject()]; else if (i.peekNext().getType() == CoinListObject::Pokemon) - ++pokemonChecker[i.peekNext().getObject()]; + ++speciesChecker[i.peekNext().getObject()]; } for (QMapIterator i(idChecker); i.hasNext(); i.next()) { @@ -82,7 +82,7 @@ bool PokeMod::CoinList::validate() const valid = false; } } - for (QMapIterator i(pokemonChecker); i.hasNext(); i.next()) + for (QMapIterator i(speciesChecker); i.hasNext(); i.next()) { if (1 < i.value()) { @@ -116,7 +116,7 @@ bool PokeMod::CoinList::validate() const unsigned PokeMod::CoinList::getNewId() const { unsigned i = 0; - for (; (i < getItemCount()) && (getItemByID(i) != UINT_MAX); ++i) + for (; (i < getItemCount()) && (getItemIndex(i) != UINT_MAX); ++i) ; return i; } @@ -197,7 +197,17 @@ PokeMod::CoinListObject& PokeMod::CoinList::getItem(const unsigned i) throw(Inde return items[i]; } -unsigned PokeMod::CoinList::getItemByID(const unsigned _id) const +const PokeMod::CoinListObject& PokeMod::CoinList::getItemByID(const unsigned i) const throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +PokeMod::CoinListObject& PokeMod::CoinList::getItemByID(const unsigned i) throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +unsigned PokeMod::CoinList::getItemIndex(const unsigned _id) const { for (unsigned i = 0; i < getItemCount(); ++i) { diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h index 1254f5f6..35bfa4ee 100644 --- a/pokemod/CoinList.h +++ b/pokemod/CoinList.h @@ -58,7 +58,9 @@ namespace PokeMod const CoinListObject& getItem(const unsigned i) const throw(IndexException); CoinListObject& getItem(const unsigned i) throw(IndexException); - unsigned getItemByID(const unsigned _id) const; + const CoinListObject& getItemByID(const unsigned i) const throw(IndexException); + CoinListObject& getItemByID(const unsigned i) throw(IndexException); + unsigned getItemIndex(const unsigned _id) const; unsigned getItemCount() const; CoinListObject& newItem(); CoinListObject& newItem(const QString& fname); diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp index 74f09878..d29a8061 100644 --- a/pokemod/CoinListObject.cpp +++ b/pokemod/CoinListObject.cpp @@ -51,7 +51,7 @@ bool PokeMod::CoinListObject::validate() const pokemod.validationMsg(QString("------Object with id %1---").arg(id), Pokemod::V_Msg); if (type == Item) { - if (pokemod.getItemByID(object) == UINT_MAX) + if (pokemod.getItemIndex(object) == UINT_MAX) { pokemod.validationMsg("Invalid item"); valid = false; @@ -59,7 +59,7 @@ bool PokeMod::CoinListObject::validate() const } else if (type == Pokemon) { - if (pokemod.getSpeciesByID(object) == UINT_MAX) + if (pokemod.getSpeciesIndex(object) == UINT_MAX) { pokemod.validationMsg("Invalid Species"); valid = false; @@ -112,7 +112,7 @@ void PokeMod::CoinListObject::setType(const unsigned t) throw(BoundsException) void PokeMod::CoinListObject::setObject(const unsigned o) throw(BoundsException) { - if (((type == Item) && (pokemod.getItemByID(object) == UINT_MAX)) || ((type == Pokemon) && (pokemod.getSpeciesByID(object) == UINT_MAX))) + if (((type == Item) && (pokemod.getItemIndex(object) == UINT_MAX)) || ((type == Pokemon) && (pokemod.getSpeciesIndex(object) == UINT_MAX))) throw(BoundsException("CoinListObject", "object")); object = o; } diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp index d934d4ae..ca91e14b 100644 --- a/pokemod/Dialog.cpp +++ b/pokemod/Dialog.cpp @@ -144,7 +144,7 @@ bool PokeMod::Dialog::validate() const break; case 3: case 4: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; } break; @@ -156,7 +156,7 @@ bool PokeMod::Dialog::validate() const } else if (numArgs == 2) { - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = 2; } break; @@ -170,14 +170,14 @@ bool PokeMod::Dialog::validate() const break; case 2: case 3: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; } break; case ItemShop: if (numArgs == 1) { - if (!okU || (pokemod.getStoreByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getStoreIndex(tempU) == UINT_MAX)) invError = 1; } break; @@ -191,12 +191,12 @@ bool PokeMod::Dialog::validate() const invError = 1; break; case 2: - if (!okU || (pokemod.getItemByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getItemIndex(tempU) == UINT_MAX)) invError = 2; break; case 3: case 4: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -204,7 +204,7 @@ bool PokeMod::Dialog::validate() const case CoinList: if (numArgs == 1) { - if (!okU || (pokemod.getCoinListByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getCoinListIndex(tempU) == UINT_MAX)) invError = 1; } break; @@ -216,13 +216,13 @@ bool PokeMod::Dialog::validate() const invError = 1; break; case 2: - if (!okU || (pokemod.getMoveByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMoveIndex(tempU) == UINT_MAX)) invError = 2; break; case 3: case 4: case 5: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -239,12 +239,12 @@ bool PokeMod::Dialog::validate() const invError = 2; break; case 3: - if (!okU || (pokemod.getMoveByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMoveIndex(tempU) == UINT_MAX)) invError = 3; break; case 4: case 5: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -257,7 +257,7 @@ bool PokeMod::Dialog::validate() const invError = 1; break; case 2: - if (!okU || (pokemod.getSpeciesByID(tempU) ==UINT_MAX)) + if (!okU || (pokemod.getSpeciesIndex(tempU) ==UINT_MAX)) invError = 2; break; case 3: @@ -282,7 +282,7 @@ bool PokeMod::Dialog::validate() const break; case 6: case 7: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -297,12 +297,12 @@ bool PokeMod::Dialog::validate() const invError = 1; break; case 2: - if (!okU || (pokemod.getSpeciesByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getSpeciesIndex(tempU) == UINT_MAX)) invError = 2; break; case 3: case 4: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -310,7 +310,7 @@ bool PokeMod::Dialog::validate() const case ShowPokemon: if (numArgs == 1) { - if (!okU || (pokemod.getSpeciesByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getSpeciesIndex(tempU) == UINT_MAX)) invError = 1; } break; @@ -350,7 +350,7 @@ bool PokeMod::Dialog::validate() const break; case 3: case 4: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -364,15 +364,15 @@ bool PokeMod::Dialog::validate() const invError = 1; break; case 2: - if (!okU || (pokemod.getMapByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMapIndex(tempU) == UINT_MAX)) invError = 2; else - map = &pokemod.getMap(pokemod.getMapByID(tempU)); + map = &pokemod.getMap(pokemod.getMapIndex(tempU)); break; case 3: if (map) { - if (!okU || (map->getEffectByID(tempU) == UINT_MAX)) + if (!okU || (map->getEffectIndex(tempU) == UINT_MAX)) invError = 3; } else if ((arg != "Player") && (arg != "-1")) @@ -384,7 +384,7 @@ bool PokeMod::Dialog::validate() const break; case 5: case 6: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -393,15 +393,15 @@ bool PokeMod::Dialog::validate() const switch (numArgs) { case 1: - if (!okU || (pokemod.getMapByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMapIndex(tempU) == UINT_MAX)) invError = 1; else - map = &pokemod.getMap(pokemod.getMapByID(tempU)); + map = &pokemod.getMap(pokemod.getMapIndex(tempU)); break; case 2: if (map) { - if (!okU || (map->getEffectByID(tempU) == UINT_MAX)) + if (!okU || (map->getEffectIndex(tempU) == UINT_MAX)) invError = 2; } else if ((arg != "Player") && (arg != "-1")) @@ -441,7 +441,7 @@ bool PokeMod::Dialog::validate() const break; case 4: case 5: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -456,7 +456,7 @@ bool PokeMod::Dialog::validate() const case 2: case 3: case 4: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; } break; @@ -469,7 +469,7 @@ bool PokeMod::Dialog::validate() const break; case 2: case 3: - if (!okU || (pokemod.getSpeciesByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getSpeciesIndex(tempU) == UINT_MAX)) invError = numArgs; case 4: if (!okUL) @@ -477,7 +477,7 @@ bool PokeMod::Dialog::validate() const break; case 5: case 6: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = numArgs; break; } @@ -492,16 +492,16 @@ bool PokeMod::Dialog::validate() const case Battle: if (numArgs == 1) { - if (!okU || (pokemod.getMapByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMapIndex(tempU) == UINT_MAX)) invError = 1; else - map = &pokemod.getMap(pokemod.getMapByID(tempU)); + map = &pokemod.getMap(pokemod.getMapIndex(tempU)); } else if (numArgs == 2) { if (map) { - if (!okU || (map->getTrainerByID(tempU) == UINT_MAX)) + if (!okU || (map->getTrainerIndex(tempU) == UINT_MAX)) invError = 2; } else @@ -512,23 +512,23 @@ bool PokeMod::Dialog::validate() const case Badge: if (numArgs == 1) { - if (!okU || (pokemod.getBadgeByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getBadgeIndex(tempU) == UINT_MAX)) invError = 1; } break; case Warp: if (numArgs == 1) { - if (!okU || (pokemod.getMapByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getMapIndex(tempU) == UINT_MAX)) invError = 1; else - map = &pokemod.getMap(pokemod.getMapByID(tempU)); + map = &pokemod.getMap(pokemod.getMapIndex(tempU)); } else if (numArgs == 2) { if (map) { - if (!okU || (map->getWarpByID(tempU) == UINT_MAX)) + if (!okU || (map->getWarpIndex(tempU) == UINT_MAX)) invError = 2; } else @@ -575,7 +575,7 @@ bool PokeMod::Dialog::validate() const invError = 2; break; case 3: - if (!okU || (pokemod.getDialogByID(tempU) == UINT_MAX)) + if (!okU || (pokemod.getDialogIndex(tempU) == UINT_MAX)) invError = 3; break; } @@ -591,9 +591,9 @@ bool PokeMod::Dialog::validate() const switch (numArgs) { case 1: - if (okU && (pokemod.getItemByID(tempU) != UINT_MAX)) + if (okU && (pokemod.getItemIndex(tempU) != UINT_MAX)) { - const Item& item = pokemod.getItem(pokemod.getItemByID(tempU)); + const Item& item = pokemod.getItem(pokemod.getItemIndex(tempU)); bool temp = false; for (unsigned i = 0; (i < item.getEffectCount()) || !temp; ++i) { @@ -629,7 +629,7 @@ bool PokeMod::Dialog::validate() const { if (okU) { - if (pokemod.getDialogByID(tempU) == UINT_MAX) + if (pokemod.getDialogIndex(tempU) == UINT_MAX) invError = numArgs; } else diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index 5ce51cf8..5af126a2 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -53,7 +53,7 @@ bool PokeMod::Item::validate() const pokemod.validationMsg("Name is not defined"); valid = false; } - if (pokemod.getItemTypeByID(type) == UINT_MAX) + if (pokemod.getItemTypeIndex(type) == UINT_MAX) { pokemod.validationMsg("Invalid item type"); valid = false; @@ -87,7 +87,7 @@ bool PokeMod::Item::validate() const unsigned PokeMod::Item::getNewId() const { unsigned i = 0; - for (; (i < getEffectCount()) && (getEffectByID(i) != UINT_MAX); ++i) + for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) ; return i; } @@ -141,7 +141,7 @@ void PokeMod::Item::setSellable(const bool s) void PokeMod::Item::setType(const unsigned t) throw(BoundsException) { - if (pokemod.getItemTypeByID(t) == UINT_MAX) + if (pokemod.getItemTypeIndex(t) == UINT_MAX) throw(BoundsException("Item", "type")); type = t; } @@ -188,14 +188,24 @@ const PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) const thro return effects.at(i); } -PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) throw(IndexException) +PokeMod::ItemEffect& PokeMod::Item::getEffectByID(const unsigned i) throw(IndexException) { if (getEffectCount() <= i) throw(IndexException("Item")); return effects[i]; } -unsigned PokeMod::Item::getEffectByID(const unsigned _id) const +const PokeMod::ItemEffect& PokeMod::Item::getEffectByID(const unsigned i) const throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +PokeMod::ItemEffect& PokeMod::Item::getEffect(const unsigned i) throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +unsigned PokeMod::Item::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { diff --git a/pokemod/Item.h b/pokemod/Item.h index a1547182..5d13068c 100644 --- a/pokemod/Item.h +++ b/pokemod/Item.h @@ -62,7 +62,9 @@ namespace PokeMod const ItemEffect& getEffect(const unsigned i) const throw(IndexException); ItemEffect& getEffect(const unsigned i) throw(IndexException); - unsigned getEffectByID(const unsigned _id) const; + const ItemEffect& getEffectByID(const unsigned i) const throw(IndexException); + ItemEffect& getEffectByID(const unsigned i) throw(IndexException); + unsigned getEffectIndex(const unsigned _id) const; unsigned getEffectCount() const; ItemEffect& newEffect(); ItemEffect& newEffect(const QString& fname); diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp index 6a92a781..b3542460 100644 --- a/pokemod/ItemEffect.cpp +++ b/pokemod/ItemEffect.cpp @@ -185,7 +185,7 @@ bool PokeMod::ItemEffect::validate() const ok = false; break; case E_TypeBoost: - if (pokemod.getTypeByID(val2) == UINT_MAX) + if (pokemod.getTypeIndex(val2) == UINT_MAX) ok = false; break; case E_PPRestore: @@ -202,7 +202,7 @@ bool PokeMod::ItemEffect::validate() const break; case E_TM: case E_HM: - if (pokemod.getMoveByID(val2) == UINT_MAX) + if (pokemod.getMoveIndex(val2) == UINT_MAX) ok = false; break; case E_Ball: @@ -219,7 +219,7 @@ bool PokeMod::ItemEffect::validate() const ok = false; break; case E_Acorn: - if (pokemod.getItemByID(val2) == UINT_MAX) + if (pokemod.getItemIndex(val2) == UINT_MAX) ok = false; break; } @@ -251,7 +251,7 @@ bool PokeMod::ItemEffect::validate() const ok = false; break; case B_Time: - if (pokemod.getTimeByID(val3) == UINT_MAX) + if (pokemod.getTimeIndex(val3) == UINT_MAX) ok = false; break; case B_Stat: @@ -259,7 +259,7 @@ bool PokeMod::ItemEffect::validate() const ok = false; break; case B_Type: - if (pokemod.getTypeByID(val3) == UINT_MAX) + if (pokemod.getTypeIndex(val3) == UINT_MAX) ok = false; break; } @@ -517,7 +517,7 @@ void PokeMod::ItemEffect::setVal2(const unsigned v2) throw(Exception) throw(BoundsException("ItemEffect", "val2")); break; case E_TypeBoost: - if (pokemod.getTypeByID(val2) == UINT_MAX) + if (pokemod.getTypeIndex(val2) == UINT_MAX) throw(BoundsException("ItemEffect", "val2")); break; case E_PPRestore: @@ -534,7 +534,7 @@ void PokeMod::ItemEffect::setVal2(const unsigned v2) throw(Exception) break; case E_TM: case E_HM: - if (pokemod.getMoveByID(val2) == UINT_MAX) + if (pokemod.getMoveIndex(val2) == UINT_MAX) throw(BoundsException("ItemEffect", "val2")); break; case E_Ball: @@ -553,7 +553,7 @@ void PokeMod::ItemEffect::setVal2(const unsigned v2) throw(Exception) throw(BoundsException("ItemEffect", "val2")); break; case E_Acorn: - if (pokemod.getItemByID(val2) == UINT_MAX) + if (pokemod.getItemIndex(val2) == UINT_MAX) throw(BoundsException("ItemEffect", "val2")); break; default: @@ -583,7 +583,7 @@ void PokeMod::ItemEffect::setVal3(const unsigned v3) throw(Exception) throw(BoundsException("ItemEffect", "val3")); break; case B_Time: - if (pokemod.getTimeByID(val3) == UINT_MAX) + if (pokemod.getTimeIndex(val3) == UINT_MAX) throw(BoundsException("ItemEffect", "val3")); break; case B_Stat: @@ -591,7 +591,7 @@ void PokeMod::ItemEffect::setVal3(const unsigned v3) throw(Exception) throw(BoundsException("ItemEffect", "val3")); break; case B_Type: - if (pokemod.getTypeByID(val3) == UINT_MAX) + if (pokemod.getTypeIndex(val3) == UINT_MAX) throw(BoundsException("ItemEffect", "val3")); break; case B_Regular: diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index ea8ed60e..e6c0d162 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -53,7 +53,7 @@ bool PokeMod::Map::validate() const pokemod.validationMsg("name is not defined"); valid = false; } - if ((flyWarp != UINT_MAX) && (getWarpByID(flyWarp) == UINT_MAX)) + if ((flyWarp != UINT_MAX) && (getWarpIndex(flyWarp) == UINT_MAX)) { pokemod.validationMsg("Invalid fly destination warp"); valid = false; @@ -71,12 +71,12 @@ bool PokeMod::Map::validate() const { if (!i.peekNext().isValid()) valid = false; - if (getWidth() <= i.peekNext().getCoordinateX()) + if (getWidth() <= i.peekNext().getCoordinate().getX()) { pokemod.validationMsg("Invalid x coordinate"); valid = false; } - if (getHeight() <= i.peekNext().getCoordinateY()) + if (getHeight() <= i.peekNext().getCoordinate().getY()) { pokemod.validationMsg("Invalid y coordinate"); valid = false; @@ -111,12 +111,12 @@ bool PokeMod::Map::validate() const { if (!i.peekNext().isValid()) valid = false; - if (getWidth() <= i.peekNext().getCoordinateX()) + if (getWidth() <= i.peekNext().getCoordinate().getX()) { pokemod.validationMsg("Invalid x coordinate"); valid = false; } - if (getHeight() <= i.peekNext().getCoordinateY()) + if (getHeight() <= i.peekNext().getCoordinate().getY()) { pokemod.validationMsg("Invalid y coordinate"); valid = false; @@ -151,12 +151,12 @@ bool PokeMod::Map::validate() const { if (!i.peekNext().isValid()) valid = false; - if (getWidth() <= i.peekNext().getCoordinateX()) + if (getWidth() <= i.peekNext().getCoordinate().getX()) { pokemod.validationMsg("Invalid x coordinate"); valid = false; } - if (getHeight() <= i.peekNext().getCoordinateY()) + if (getHeight() <= i.peekNext().getCoordinate().getY()) { pokemod.validationMsg("Invalid y coordinate"); valid = false; @@ -212,7 +212,7 @@ bool PokeMod::Map::validate() const { for (unsigned j = 0; j < getHeight(); ++j) { - if (pokemod.getTileByID(tiles(i, j)) == UINT_MAX) + if (pokemod.getTileIndex(tiles(i, j)) == UINT_MAX) { pokemod.validationMsg(QString("Invalid tile at (%1, %2)").arg(i).arg(j)); valid = false; @@ -222,6 +222,38 @@ bool PokeMod::Map::validate() const return valid; } +unsigned PokeMod::Map::getNewEffectId() const +{ + unsigned i = 0; + for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) + ; + return i; +} + +unsigned PokeMod::Map::getNewTrainerId() const +{ + unsigned i = 0; + for (; (i < getTrainerCount()) && (getTrainerIndex(i) != UINT_MAX); ++i) + ; + return i; +} + +unsigned PokeMod::Map::getNewWarpId() const +{ + unsigned i = 0; + for (; (i < getWarpCount()) && (getWarpIndex(i) != UINT_MAX); ++i) + ; + return i; +} + +unsigned PokeMod::Map::getNewWildListId() const +{ + unsigned i = 0; + for (; (i < getWarpCount()) && (getWarpIndex(i) != UINT_MAX); ++i) + ; + return i; +} + void PokeMod::Map::load(const QString& fname, const unsigned _id) throw(Exception) { Ini ini(fname); @@ -306,7 +338,7 @@ void PokeMod::Map::setName(const QString& n) void PokeMod::Map::setFlyWarp(const unsigned f) throw(BoundsException) { - if (getWarpByID(f) == UINT_MAX) + if (getWarpIndex(f) == UINT_MAX) throw(BoundsException("Map", "warp")); flyWarp = f; } @@ -335,7 +367,7 @@ unsigned PokeMod::Map::getType() const void PokeMod::Map::setTile(unsigned x, unsigned y, unsigned _id) throw(BoundsException) { - if (pokemod.getTileByID(_id) == UINT_MAX) + if (pokemod.getTileIndex(_id) == UINT_MAX) throw(BoundsException("Map", "tile")); tiles(x, y) = _id; } @@ -399,7 +431,17 @@ PokeMod::MapEffect& PokeMod::Map::getEffect(const unsigned i) throw(IndexExcepti return effects[i]; } -unsigned PokeMod::Map::getEffectByID(const unsigned _id) const +const PokeMod::MapEffect& PokeMod::Map::getEffectByID(const unsigned i) const throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +PokeMod::MapEffect& PokeMod::Map::getEffectByID(const unsigned i) throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +unsigned PokeMod::Map::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { @@ -453,7 +495,17 @@ PokeMod::MapTrainer& PokeMod::Map::getTrainer(const unsigned i) throw(IndexExcep return trainers[i]; } -unsigned PokeMod::Map::getTrainerByID(const unsigned _id) const +const PokeMod::MapTrainer& PokeMod::Map::getTrainerByID(const unsigned i) const throw(IndexException) +{ + return getTrainer(getTrainerIndex(i)); +} + +PokeMod::MapTrainer& PokeMod::Map::getTrainerByID(const unsigned i) throw(IndexException) +{ + return getTrainer(getTrainerIndex(i)); +} + +unsigned PokeMod::Map::getTrainerIndex(const unsigned _id) const { for (unsigned i = 0; i < getTrainerCount(); ++i) { @@ -507,7 +559,17 @@ PokeMod::MapWarp& PokeMod::Map::getWarp(const unsigned i) throw(IndexException) return warps[i]; } -unsigned PokeMod::Map::getWarpByID(const unsigned _id) const +const PokeMod::MapWarp& PokeMod::Map::getWarpByID(const unsigned i) const throw(IndexException) +{ + return getWarp(getWarpIndex(i)); +} + +PokeMod::MapWarp& PokeMod::Map::getWarpByID(const unsigned i) throw(IndexException) +{ + return getWarp(getWarpIndex(i)); +} + +unsigned PokeMod::Map::getWarpIndex(const unsigned _id) const { for (unsigned i = 0; i < getWarpCount(); ++i) { @@ -548,13 +610,30 @@ void PokeMod::Map::deleteWarp(const unsigned i) throw(IndexException) } const PokeMod::MapWildList& PokeMod::Map::getWildList(const unsigned i) const throw(IndexException) +{ + if (getWildListCount() <= i) + throw(IndexException("Map")); + return wildLists.at(i); +} + +PokeMod::MapWildList& PokeMod::Map::getWildList(const unsigned i) throw(IndexException) { if (getWildListCount() <= i) throw(IndexException("Map")); return wildLists[i]; } -unsigned PokeMod::Map::getWildListByID(const unsigned _id) const +const PokeMod::MapWildList& PokeMod::Map::getWildListByID(const unsigned i) const throw(IndexException) +{ + return getWildList(getWildListIndex(i)); +} + +PokeMod::MapWildList& PokeMod::Map::getWildListByID(const unsigned i) throw(IndexException) +{ + return getWildList(getWildListIndex(i)); +} + +unsigned PokeMod::Map::getWildListIndex(const unsigned _id) const { for (unsigned i = 0; i < getWildListCount(); ++i) { diff --git a/pokemod/Map.h b/pokemod/Map.h index d808c793..60dba551 100644 --- a/pokemod/Map.h +++ b/pokemod/Map.h @@ -81,7 +81,9 @@ namespace PokeMod const MapEffect& getEffect(const unsigned i) const throw(IndexException); MapEffect& getEffect(const unsigned i) throw(IndexException); - unsigned getEffectByID(const unsigned _id) const; + const MapEffect& getEffectByID(const unsigned i) const throw(IndexException); + MapEffect& getEffectByID(const unsigned i) throw(IndexException); + unsigned getEffectIndex(const unsigned _id) const; unsigned getEffectCount() const; MapEffect& newEffect(); MapEffect& newEffect(const QString& fname); @@ -90,7 +92,9 @@ namespace PokeMod const MapTrainer& getTrainer(const unsigned i) const throw(IndexException); MapTrainer& getTrainer(const unsigned i) throw(IndexException); - unsigned getTrainerByID(const unsigned _id) const; + const MapTrainer& getTrainerByID(const unsigned i) const throw(IndexException); + MapTrainer& getTrainerByID(const unsigned i) throw(IndexException); + unsigned getTrainerIndex(const unsigned _id) const; unsigned getTrainerCount() const; MapTrainer& newTrainer(); MapTrainer& newTrainer(const QString& fname); @@ -99,7 +103,9 @@ namespace PokeMod const MapWarp& getWarp(const unsigned i) const throw(IndexException); MapWarp& getWarp(const unsigned i) throw(IndexException); - unsigned getWarpByID(const unsigned _id) const; + const MapWarp& getWarpByID(const unsigned i) const throw(IndexException); + MapWarp& getWarpByID(const unsigned i) throw(IndexException); + unsigned getWarpIndex(const unsigned _id) const; unsigned getWarpCount() const; MapWarp& newWarp(); MapWarp& newWarp(const QString& fname); @@ -108,7 +114,9 @@ namespace PokeMod const MapWildList& getWildList(const unsigned i) const throw(IndexException); MapWildList& getWildList(const unsigned i) throw(IndexException); - unsigned getWildListByID(const unsigned _id) const; + const MapWildList& getWildListByID(const unsigned i) const throw(IndexException); + MapWildList& getWildListByID(const unsigned i) throw(IndexException); + unsigned getWildListIndex(const unsigned _id) const; unsigned getWildListCount() const; MapWildList& newWildList(); MapWildList& newWildList(const QString& fname); diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp index 252c456a..d6290436 100644 --- a/pokemod/MapEffect.cpp +++ b/pokemod/MapEffect.cpp @@ -78,7 +78,7 @@ bool PokeMod::MapEffect::validate() const switch (effect) { case E_Item: - if (pokemod.getItemByID(val2) == UINT_MAX) + if (pokemod.getItemIndex(val2) == UINT_MAX) ok = false; break; case E_PC: @@ -107,7 +107,7 @@ bool PokeMod::MapEffect::validate() const pokemod.validationMsg("Invalid driection"); valid = false; } - if (pokemod.getDialogByID(dialog) == UINT_MAX) + if (pokemod.getDialogIndex(dialog) == UINT_MAX) { pokemod.validationMsg("Invalid dialog"); valid = false; @@ -224,7 +224,7 @@ void PokeMod::MapEffect::setVal2(const unsigned v2) throw(Exception) switch (effect) { case E_Item: - if (pokemod.getItemByID(val2) == UINT_MAX) + if (pokemod.getItemIndex(val2) == UINT_MAX) throw(BoundsException("MapEffect", "val2")); break; case E_PC: @@ -262,7 +262,7 @@ void PokeMod::MapEffect::setCanMove(const bool c) void PokeMod::MapEffect::setDialog(const unsigned d) throw(BoundsException) { - if (pokemod.getDialogByID(d) == UINT_MAX) + if (pokemod.getDialogIndex(d) == UINT_MAX) throw(BoundsException("MapEffect", "dialog")); dialog = d; } @@ -277,31 +277,11 @@ Point PokeMod::MapEffect::getCoordinate() const return coordinate; } -unsigned PokeMod::MapEffect::getCoordinateX() const -{ - return coordinate.getX(); -} - -unsigned PokeMod::MapEffect::getCoordinateY() const -{ - return coordinate.getY(); -} - Flag PokeMod::MapEffect::getExistFlag() const { return existFlag; } -unsigned PokeMod::MapEffect::getExistFlagFlag() const -{ - return existFlag.getFlag(); -} - -unsigned PokeMod::MapEffect::getExistFlagStatus() const -{ - return existFlag.getStatus(); -} - QString PokeMod::MapEffect::getSkin() const { return skin; diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h index 700b257d..5517a212 100644 --- a/pokemod/MapEffect.h +++ b/pokemod/MapEffect.h @@ -83,11 +83,7 @@ namespace PokeMod QString getName() const; Point getCoordinate() const; - unsigned getCoordinateX() const; - unsigned getCoordinateY() const; Flag getExistFlag() const; - unsigned getExistFlagFlag() const; - unsigned getExistFlagStatus() const; QString getSkin() const; unsigned getEffect() const; unsigned getVal1() const; diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index 6ce711eb..ad287393 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -35,7 +35,7 @@ PokeMod::MapTrainer::MapTrainer(const Pokemod& par, const unsigned _id) : overworldDialog(UINT_MAX), winDialog(UINT_MAX), loseDialog(UINT_MAX), - leadPokemon(UINT_MAX) + leadTeamMember(UINT_MAX) { } @@ -80,30 +80,30 @@ bool PokeMod::MapTrainer::validate() const pokemod.validationMsg("AI file couldn\'t be found"); valid = false; } - if (pokemod.getDialogByID(overworldDialog) == UINT_MAX) + if (pokemod.getDialogIndex(overworldDialog) == UINT_MAX) { pokemod.validationMsg("Invalid overworld dialog"); valid = false; } - if (pokemod.getDialogByID(winDialog) == UINT_MAX) + if (pokemod.getDialogIndex(winDialog) == UINT_MAX) { pokemod.validationMsg("Invalid win dialog"); valid = false; } - if (pokemod.getDialogByID(loseDialog) == UINT_MAX) + if (pokemod.getDialogIndex(loseDialog) == UINT_MAX) { pokemod.validationMsg("Invalid lose dialog"); valid = false; } - if (getPokemonCount() <= leadPokemon) + if (getTeamMemberCount() <= leadTeamMember) { - pokemod.validationMsg("Invalid lead Pokémon"); + pokemod.validationMsg("Invalid lead member"); valid = false; } - if (getPokemonCount()) + if (getTeamMemberCount()) { QMap idChecker; - for (QListIterator i(team); i.hasNext(); i.next()) + for (QListIterator i(teamMembers); i.hasNext(); i.next()) { if (!i.peekNext().isValid()) valid = false; @@ -113,14 +113,14 @@ bool PokeMod::MapTrainer::validate() const { if (1 < i.value()) { - pokemod.validationMsg(QString("There are %1 Pokémon with id %2").arg(i.value()).arg(i.key())); + pokemod.validationMsg(QString("There are %1 team members with id %2").arg(i.value()).arg(i.key())); valid = false; } } } else { - pokemod.validationMsg("There are no Pokémon"); + pokemod.validationMsg("There are no team members"); valid = false; } return valid; @@ -129,9 +129,9 @@ bool PokeMod::MapTrainer::validate() const unsigned PokeMod::MapTrainer::getNewId() const { unsigned i = 0; - for (; i < getPokemonCount(); ++i) + for (; i < getTeamMemberCount(); ++i) { - if (getPokemonByID(i) == UINT_MAX) + if (getTeamMemberIndex(i) == UINT_MAX) return i; } return UINT_MAX; @@ -161,15 +161,15 @@ void PokeMod::MapTrainer::load(const QString& fname, const unsigned _id) throw(E ini.getValue("overworldDialog", overworldDialog); ini.getValue("winDialog", winDialog); ini.getValue("loseDialog", loseDialog); - ini.getValue("leadPokemon", leadPokemon); + ini.getValue("leadTeamMember", leadTeamMember); QStringList path = pokemod.getPath().split('/'); path.removeLast(); QDir fdir(path.join("/")); - team.clear(); + teamMembers.clear(); if (fdir.cd("team")) { for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); ) - newPokemon(i.next()); + newTeamMember(i.next()); } } @@ -191,9 +191,9 @@ void PokeMod::MapTrainer::save(const QString& map) const throw(Exception) ini.addField("overworldDialog", overworldDialog); ini.addField("winDialog", winDialog); ini.addField("loseDialog", loseDialog); - ini.addField("leadPokemon", leadPokemon); + ini.addField("leadTeamMember", leadTeamMember); ini.save(QString("%1/map/%2/trainer/%3/data.pini").arg(pokemod.getPath()).arg(map).arg(name)); - for (QListIterator i(team); i.hasNext(); ) + for (QListIterator i(teamMembers); i.hasNext(); ) i.next().save(map, name); } @@ -267,30 +267,30 @@ void PokeMod::MapTrainer::setAppearFlagStatus(const unsigned s) void PokeMod::MapTrainer::setOverworldDialog(const unsigned o) throw(BoundsException) { - if (pokemod.getDialogByID(o) == UINT_MAX) + if (pokemod.getDialogIndex(o) == UINT_MAX) throw(BoundsException("MapTrainer", "overworldDialog")); overworldDialog = o; } void PokeMod::MapTrainer::setWinDialog(const unsigned w) throw(BoundsException) { - if (pokemod.getDialogByID(w) == UINT_MAX) + if (pokemod.getDialogIndex(w) == UINT_MAX) throw(BoundsException("MapTrainer", "winDialog")); winDialog = w; } void PokeMod::MapTrainer::setLoseDialog(const unsigned l) throw(BoundsException) { - if (pokemod.getDialogByID(l) == UINT_MAX) + if (pokemod.getDialogIndex(l) == UINT_MAX) throw(BoundsException("MapTrainer", "loseDialog")); loseDialog = l; } -void PokeMod::MapTrainer::setLeadPokemon(const unsigned l) throw(BoundsException) +void PokeMod::MapTrainer::setLeadTeamMember(const unsigned l) throw(BoundsException) { - if (getPokemonCount() <= l) - throw(BoundsException("MapTrainer", "leadPokemon")); - leadPokemon = l; + if (getTeamMemberCount() <= l) + throw(BoundsException("MapTrainer", "leadTeamMember")); + leadTeamMember = l; } QString PokeMod::MapTrainer::getName() const @@ -303,16 +303,6 @@ Point PokeMod::MapTrainer::getCoordinate() const return coordinate; } -unsigned PokeMod::MapTrainer::getCoordinateX() const -{ - return coordinate.getX(); -} - -unsigned PokeMod::MapTrainer::getCoordinateY() const -{ - return coordinate.getY(); -} - QString PokeMod::MapTrainer::getSkin() const { return skin; @@ -343,16 +333,6 @@ Flag PokeMod::MapTrainer::getAppearFlag() const return appearFlag; } -unsigned PokeMod::MapTrainer::getAppearFlagFlag() const -{ - return appearFlag.getFlag(); -} - -unsigned PokeMod::MapTrainer::getAppearFlagStatus() const -{ - return appearFlag.getStatus(); -} - unsigned PokeMod::MapTrainer::getOverworldDialog() const { return overworldDialog; @@ -368,63 +348,73 @@ unsigned PokeMod::MapTrainer::getLoseDialog() const return loseDialog; } -unsigned PokeMod::MapTrainer::getLeadPokemon() const +unsigned PokeMod::MapTrainer::getLeadTeamMember() const { - return leadPokemon; + return leadTeamMember; } -const PokeMod::MapTrainerPokemon& PokeMod::MapTrainer::getPokemon(const unsigned i) const throw(IndexException) +const PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::getTeamMember(const unsigned i) const throw(IndexException) { - if (getPokemonCount() <= i) + if (getTeamMemberCount() <= i) throw(IndexException("MapTrainer")); - return team.at(i); + return teamMembers.at(i); } -PokeMod::MapTrainerPokemon& PokeMod::MapTrainer::getPokemon(const unsigned i) throw(IndexException) +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::getTeamMember(const unsigned i) throw(IndexException) { - if (getPokemonCount() <= i) + if (getTeamMemberCount() <= i) throw(IndexException("MapTrainer")); - return team[i]; + return teamMembers[i]; +} + +const PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::getTeamMemberByID(const unsigned i) const throw(IndexException) +{ + return getTeamMember(getTeamMemberIndex(i)); +} + +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::getTeamMemberByID(const unsigned i) throw(IndexException) +{ + return getTeamMember(getTeamMemberIndex(i)); } -unsigned PokeMod::MapTrainer::getPokemonByID(const unsigned _id) const +unsigned PokeMod::MapTrainer::getTeamMemberIndex(const unsigned _id) const { - for (unsigned i = 0; i < getPokemonCount(); ++i) + for (unsigned i = 0; i < getTeamMemberCount(); ++i) { - if (team[i].getId() == _id) + if (teamMembers[i].getId() == _id) return i; } return UINT_MAX; } -unsigned PokeMod::MapTrainer::getPokemonCount() const +unsigned PokeMod::MapTrainer::getTeamMemberCount() const { - return team.size(); + return teamMembers.size(); } -PokeMod::MapTrainerPokemon& PokeMod::MapTrainer::newPokemon() +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::newTeamMember() { - team.append(MapTrainerPokemon(pokemod, getNewId())); - return team[getPokemonCount() - 1]; + teamMembers.append(MapTrainerTeamMember(pokemod, getNewId())); + return teamMembers[getTeamMemberCount() - 1]; } -PokeMod::MapTrainerPokemon& PokeMod::MapTrainer::newPokemon(const QString& fname) +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::newTeamMember(const QString& fname) { - team.append(MapTrainerPokemon(pokemod, fname, getNewId())); - return team[getPokemonCount() - 1]; + teamMembers.append(MapTrainerTeamMember(pokemod, fname, getNewId())); + return teamMembers[getTeamMemberCount() - 1]; } -PokeMod::MapTrainerPokemon& PokeMod::MapTrainer::newPokemon(const MapTrainerPokemon& p) +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainer::newTeamMember(const MapTrainerTeamMember& p) { - team.append(MapTrainerPokemon(pokemod, p, getNewId())); - return team[getPokemonCount() - 1]; + teamMembers.append(MapTrainerTeamMember(pokemod, p, getNewId())); + return teamMembers[getTeamMemberCount() - 1]; } -void PokeMod::MapTrainer::deletePokemon(const unsigned i) throw(IndexException) +void PokeMod::MapTrainer::deleteTeamMember(const unsigned i) throw(IndexException) { - if (getPokemonCount() <= i) + if (getTeamMemberCount() <= i) throw(IndexException("MapTrainer")); - team.removeAt(i); + teamMembers.removeAt(i); } PokeMod::MapTrainer& PokeMod::MapTrainer::operator=(const MapTrainer& rhs) @@ -442,8 +432,9 @@ PokeMod::MapTrainer& PokeMod::MapTrainer::operator=(const MapTrainer& rhs) overworldDialog = rhs.overworldDialog; winDialog = rhs.winDialog; loseDialog = rhs.loseDialog; - team.clear(); - for (unsigned i = 0; i < rhs.getPokemonCount(); ++i) - newPokemon(rhs.getPokemon(i)); + leadTeamMember = rhs.leadTeamMember; + teamMembers.clear(); + for (unsigned i = 0; i < rhs.getTeamMemberCount(); ++i) + newTeamMember(rhs.getTeamMember(i)); return *this; } diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h index e80fa782..784facf7 100644 --- a/pokemod/MapTrainer.h +++ b/pokemod/MapTrainer.h @@ -36,7 +36,7 @@ #include "../general/Point.h" #include "Object.h" #include "Dialog.h" -#include "MapTrainerPokemon.h" +#include "MapTrainerTeamMember.h" namespace PokeMod { @@ -65,12 +65,10 @@ namespace PokeMod void setOverworldDialog(const unsigned o) throw(BoundsException); void setWinDialog(const unsigned w) throw(BoundsException); void setLoseDialog(const unsigned l) throw(BoundsException); - void setLeadPokemon(const unsigned l) throw(BoundsException); + void setLeadTeamMember(const unsigned l) throw(BoundsException); QString getName() const; Point getCoordinate() const; - unsigned getCoordinateX() const; - unsigned getCoordinateY() const; QString getSkin() const; bool getSkinExists() const; unsigned getSight() const; @@ -79,21 +77,21 @@ namespace PokeMod bool getAIExists() const; QString getAI() const; Flag getAppearFlag() const; - unsigned getAppearFlagFlag() const; - unsigned getAppearFlagStatus() const; unsigned getOverworldDialog() const; unsigned getWinDialog() const; unsigned getLoseDialog() const; - unsigned getLeadPokemon() const; + unsigned getLeadTeamMember() const; - const MapTrainerPokemon& getPokemon(const unsigned i) const throw(IndexException); - MapTrainerPokemon& getPokemon(const unsigned i) throw(IndexException); - unsigned getPokemonByID(const unsigned _id) const; - unsigned getPokemonCount() const; - MapTrainerPokemon& newPokemon(); - MapTrainerPokemon& newPokemon(const QString& fname); - MapTrainerPokemon& newPokemon(const MapTrainerPokemon& t); - void deletePokemon(const unsigned i) throw(IndexException); + const MapTrainerTeamMember& getTeamMember(const unsigned i) const throw(IndexException); + MapTrainerTeamMember& getTeamMember(const unsigned i) throw(IndexException); + const MapTrainerTeamMember& getTeamMemberByID(const unsigned i) const throw(IndexException); + MapTrainerTeamMember& getTeamMemberByID(const unsigned i) throw(IndexException); + unsigned getTeamMemberIndex(const unsigned _id) const; + unsigned getTeamMemberCount() const; + MapTrainerTeamMember& newTeamMember(); + MapTrainerTeamMember& newTeamMember(const QString& fname); + MapTrainerTeamMember& newTeamMember(const MapTrainerTeamMember& t); + void deleteTeamMember(const unsigned i) throw(IndexException); MapTrainer& operator=(const MapTrainer& rhs); private: @@ -111,9 +109,9 @@ namespace PokeMod unsigned overworldDialog; unsigned winDialog; unsigned loseDialog; - unsigned leadPokemon; + unsigned leadTeamMember; - QList team; + QList teamMembers; }; } diff --git a/pokemod/MapTrainerPokemon.cpp b/pokemod/MapTrainerPokemon.cpp deleted file mode 100644 index 531e4052..00000000 --- a/pokemod/MapTrainerPokemon.cpp +++ /dev/null @@ -1,208 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/MapTrainerPokemon.cpp -// Purpose: Define a Pokémon on a trainer's team -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 19:20:21 2007 -// Copyright: ©2007-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 . -///////////////////////////////////////////////////////////////////////////// - -#include "MapTrainerPokemon.h" - -PokeMod::MapTrainerPokemon::MapTrainerPokemon(const Pokemod& par, const unsigned _id) : - Object(par, _id), - species(UINT_MAX), - level(UINT_MAX), - nature(UINT_MAX) -{ -} - -PokeMod::MapTrainerPokemon::MapTrainerPokemon(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) -{ - load(fname, _id); -} - -bool PokeMod::MapTrainerPokemon::validate() const -{ - bool valid = true; - pokemod.validationMsg(QString("---------Pokémon with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getSpeciesByID(species) == UINT_MAX) - { - pokemod.validationMsg("Invalid species"); - valid = false; - } - if (pokemod.getRules().getMaxLevel() <= level) - { - pokemod.validationMsg("Invalid level"); - valid = false; - } - if (getItemCount() <= pokemod.getRules().getHoldItems()) - { - QMap idChecker; - for (QListIterator i(items); i.hasNext(); i.next()) - { - if (pokemod.getItemByID(i.peekNext()) == UINT_MAX) - { - pokemod.validationMsg("Invalid item"); - valid = false; - } - ++idChecker[i.peekNext()]; - } - for (QMapIterator i(idChecker); i.hasNext(); i.next()) - { - if (1 < i.value()) - { - pokemod.validationMsg(QString("There are %1 items with id %2").arg(i.value()).arg(i.key())); - valid = false; - } - } - } - else - { - pokemod.validationMsg("Too many held items"); - valid = false; - } - if (pokemod.getRules().getNatureAllowed()) - { - if (pokemod.getNatureByID(nature) == UINT_MAX) - { - pokemod.validationMsg("Invalid nature"); - valid = false; - } - } - return valid; -} - -void PokeMod::MapTrainerPokemon::load(const QString& fname, const unsigned _id) throw(Exception) -{ - Ini ini(fname); - if (_id == UINT_MAX) - ini.getValue("id", id); - else - id = _id; - unsigned i; - unsigned j; - items.clear(); - ini.getValue("species", species); - ini.getValue("level", level); - ini.getValue("nature", nature); - ini.getValue("numItems", i, 0); - for (unsigned k = 0; k < i; ++k) - { - ini.getValue(QString("item-%1").arg(k), j); - if (k != UINT_MAX) - items.append(j); - } -} - -void PokeMod::MapTrainerPokemon::save(const QString& map, const QString& trainer) const throw(Exception) -{ - Ini ini; - ini.addField("id", id); - ini.addField("species", species); - ini.addField("level", level); - ini.addField("nature", nature); - ini.addField("numItems", getItemCount()); - for (unsigned i = 0; i < getItemCount(); ++i) - ini.addField(QString("item-%1").arg(i), items[i]); - ini.save(QString("%1/map/%2/trainer/%3/team/%4.pini").arg(pokemod.getPath()).arg(map).arg(trainer).arg(id)); -} - -void PokeMod::MapTrainerPokemon::setSpecies(const unsigned s) throw(BoundsException) -{ - if (pokemod.getSpeciesByID(s) == UINT_MAX) - throw(BoundsException("MapTrainerPokemon", "species")); - species = s; -} - -void PokeMod::MapTrainerPokemon::setLevel(const unsigned l) throw(BoundsException) -{ - if (pokemod.getRules().getMaxLevel() < l) - throw(BoundsException("MapTrainerPokemon", "level")); - level = l; -} - -void PokeMod::MapTrainerPokemon::setNature(const unsigned n) throw(BoundsException) -{ - if (!pokemod.getRules().getNatureAllowed() || (pokemod.getNatureByID(n) == UINT_MAX)) - throw(BoundsException("MapTrainerPokemon", "nature")); - nature = n; -} - -unsigned PokeMod::MapTrainerPokemon::getSpecies() const -{ - return species; -} - -unsigned PokeMod::MapTrainerPokemon::getLevel() const -{ - return level; -} - -unsigned PokeMod::MapTrainerPokemon::getNature() const -{ - return nature; -} - -unsigned PokeMod::MapTrainerPokemon::getItem(const unsigned i) const throw(IndexException) -{ - if (getItemCount() <= i) - throw(IndexException("MapTrainerPokemon")); - return items.at(i); -} - -unsigned PokeMod::MapTrainerPokemon::getItemByID(const unsigned _id) const -{ - for (unsigned i = 0; i < getItemCount(); ++i) - { - if (items[i] == _id) - return i; - } - return UINT_MAX; -} - -unsigned PokeMod::MapTrainerPokemon::getItemCount() const -{ - return items.size(); -} - -void PokeMod::MapTrainerPokemon::newItem(const unsigned i) throw(Exception) -{ - if (pokemod.getRules().getHoldItems() <= getItemCount()) - throw(Exception("MapTrainerPokemon", "too many items")); - if (pokemod.getItemByID(i) == UINT_MAX) - throw(BoundsException("MapTrainerPokemon", "item")); - items.append(i); -} - -void PokeMod::MapTrainerPokemon::deleteItem(const unsigned i) throw(IndexException) -{ - if (getItemCount() <= i) - throw(IndexException("MapTrainerPokemon")); - items.erase(items.begin() + i); -} - -PokeMod::MapTrainerPokemon& PokeMod::MapTrainerPokemon::operator=(const MapTrainerPokemon& rhs) -{ - if (this == &rhs) - return *this; - species = rhs.species; - level = rhs.level; - nature = rhs.nature; - items = rhs.items; - return *this; -} diff --git a/pokemod/MapTrainerPokemon.h b/pokemod/MapTrainerPokemon.h deleted file mode 100644 index de7b4c69..00000000 --- a/pokemod/MapTrainerPokemon.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/MapTrainerPokemon.h -// Purpose: Define a Pokémon on a trainer's team -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 19:20:21 2007 -// Copyright: ©2007-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 . -///////////////////////////////////////////////////////////////////////////// - -#ifndef __POKEMOD_MAPTRAINERPOKEMON__ -#define __POKEMOD_MAPTRAINERPOKEMON__ - -#include -#include -#include -#include "../general/Exception.h" -#include "Object.h" -#include "Pokemod.h" -#include "Item.h" -#include "Species.h" - -namespace PokeMod -{ - class MapTrainerPokemon : public Object - { - public: - MapTrainerPokemon(const Pokemod& par, const unsigned _id); - MapTrainerPokemon(const Pokemod& par, const MapTrainerPokemon& p, const unsigned _id); - MapTrainerPokemon(const Pokemod& par, const QString& fname, const unsigned _id = UINT_MAX); - - void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception); - void save(const QString& map, const QString& trainer) const throw(Exception); - - void setSpecies(const unsigned s) throw(BoundsException); - void setLevel(const unsigned l) throw(BoundsException); - void setNature(const unsigned n) throw(BoundsException); - - unsigned getSpecies() const; - unsigned getLevel() const; - unsigned getNature() const; - - unsigned getItem(const unsigned i) const throw(IndexException); - unsigned getItemByID(const unsigned _id) const; - unsigned getItemCount() const; - void newItem(const unsigned i) throw(Exception); - void deleteItem(const unsigned i) throw(IndexException); - - MapTrainerPokemon& operator=(const MapTrainerPokemon& p); - private: - bool validate() const; - - unsigned species; - unsigned level; - unsigned nature; - QList items; - }; -} - -#endif diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp new file mode 100644 index 00000000..eb7fa0d1 --- /dev/null +++ b/pokemod/MapTrainerTeamMember.cpp @@ -0,0 +1,201 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/MapTrainerTeamMember.cpp +// Purpose: Define a Pokémon on a trainer's team +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Mar 20 19:20:21 2007 +// Copyright: ©2007-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 . +///////////////////////////////////////////////////////////////////////////// + +#include "MapTrainerTeamMember.h" + +PokeMod::MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const unsigned _id) : + Object(par, _id), + species(UINT_MAX), + level(UINT_MAX), + nature(UINT_MAX) +{ +} + +PokeMod::MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const QString& fname, const unsigned _id) : + Object(par, _id) +{ + load(fname, _id); +} + +bool PokeMod::MapTrainerTeamMember::validate() const +{ + bool valid = true; + pokemod.validationMsg(QString("---------Team Member with id %1---").arg(id), Pokemod::V_Msg); + if (pokemod.getSpeciesIndex(species) == UINT_MAX) + { + pokemod.validationMsg("Invalid species"); + valid = false; + } + if (pokemod.getRules().getMaxLevel() <= level) + { + pokemod.validationMsg("Invalid level"); + valid = false; + } + if (unsigned(items.size()) <= pokemod.getRules().getHoldItems()) + { + QMap idChecker; + for (QListIterator i(items); i.hasNext(); i.next()) + { + if (pokemod.getItemIndex(i.peekNext()) == UINT_MAX) + { + pokemod.validationMsg("Invalid item"); + valid = false; + } + ++idChecker[i.peekNext()]; + } + for (QMapIterator i(idChecker); i.hasNext(); i.next()) + { + if (1 < i.value()) + { + pokemod.validationMsg(QString("There are %1 items with id %2").arg(i.value()).arg(i.key())); + valid = false; + } + } + } + else + { + pokemod.validationMsg("Too many held items"); + valid = false; + } + if (pokemod.getRules().getNatureAllowed()) + { + if (pokemod.getNatureIndex(nature) == UINT_MAX) + { + pokemod.validationMsg("Invalid nature"); + valid = false; + } + } + return valid; +} + +void PokeMod::MapTrainerTeamMember::load(const QString& fname, const unsigned _id) throw(Exception) +{ + Ini ini(fname); + if (_id == UINT_MAX) + ini.getValue("id", id); + else + id = _id; + unsigned i; + unsigned j; + items.clear(); + ini.getValue("species", species); + ini.getValue("level", level); + ini.getValue("nature", nature); + ini.getValue("numItems", i, 0); + for (unsigned k = 0; k < i; ++k) + { + ini.getValue(QString("item-%1").arg(k), j); + if (k != UINT_MAX) + items.append(j); + } +} + +void PokeMod::MapTrainerTeamMember::save(const QString& map, const QString& trainer) const throw(Exception) +{ + Ini ini; + ini.addField("id", id); + ini.addField("species", species); + ini.addField("level", level); + ini.addField("nature", nature); + ini.addField("numItems", unsigned(items.size())); + for (unsigned i = 0; i < unsigned(items.size()); ++i) + ini.addField(QString("item-%1").arg(i), items[i]); + ini.save(QString("%1/map/%2/trainer/%3/team/%4.pini").arg(pokemod.getPath()).arg(map).arg(trainer).arg(id)); +} + +void PokeMod::MapTrainerTeamMember::setSpecies(const unsigned s) throw(BoundsException) +{ + if (pokemod.getSpeciesIndex(s) == UINT_MAX) + throw(BoundsException("MapTrainerTeamMember", "species")); + species = s; +} + +void PokeMod::MapTrainerTeamMember::setLevel(const unsigned l) throw(BoundsException) +{ + if (pokemod.getRules().getMaxLevel() < l) + throw(BoundsException("MapTrainerTeamMember", "level")); + level = l; +} + +void PokeMod::MapTrainerTeamMember::setItem(const unsigned itm, const bool it) throw(Exception) +{ + if (pokemod.getItemIndex(itm) == UINT_MAX) + throw(BoundsException("MpTrainerPokemon", "item")); + for (QMutableListIterator i(items); i.hasNext(); ) + { + if (i.next() == itm) + { + if (it) + throw(Exception("MapTrainerTeamMember", "item already used")); + else + i.remove(); + } + } + if (!it) + throw(Exception("MapTrainerTeamMember", "item wasn\'t being used anyway")); + if (pokemod.getRules().getHoldItems() <= unsigned(items.size())) + throw(Exception("MapTrainerTeamMember", "too many items")); + items.append(itm); +} + +void PokeMod::MapTrainerTeamMember::setNature(const unsigned n) throw(BoundsException) +{ + if (!pokemod.getRules().getNatureAllowed() || (pokemod.getNatureIndex(n) == UINT_MAX)) + throw(BoundsException("MapTrainerTeamMember", "nature")); + nature = n; +} + +unsigned PokeMod::MapTrainerTeamMember::getSpecies() const +{ + return species; +} + +unsigned PokeMod::MapTrainerTeamMember::getLevel() const +{ + return level; +} + +unsigned PokeMod::MapTrainerTeamMember::getNature() const +{ + return nature; +} + +bool PokeMod::MapTrainerTeamMember::getItem(const unsigned itm) const +{ + for (QListIterator i(items); i.hasNext(); ) + { + if (i.next() == itm) + return true; + } + return false; +} + +PokeMod::MapTrainerTeamMember& PokeMod::MapTrainerTeamMember::operator=(const MapTrainerTeamMember& rhs) +{ + if (this == &rhs) + return *this; + species = rhs.species; + level = rhs.level; + nature = rhs.nature; + items = rhs.items; + return *this; +} diff --git a/pokemod/MapTrainerTeamMember.h b/pokemod/MapTrainerTeamMember.h new file mode 100644 index 00000000..37dc7c5d --- /dev/null +++ b/pokemod/MapTrainerTeamMember.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/MapTrainerTeamMember.h +// Purpose: Define a Pokémon on a trainer's team +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Mar 20 19:20:21 2007 +// Copyright: ©2007-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 . +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMOD_MAPTRAINERTEAMMEMBER__ +#define __POKEMOD_MAPTRAINERTEAMMEMBER__ + +#include +#include +#include +#include "../general/Exception.h" +#include "Object.h" +#include "Pokemod.h" +#include "Item.h" +#include "Species.h" + +namespace PokeMod +{ + class MapTrainerTeamMember : public Object + { + public: + MapTrainerTeamMember(const Pokemod& par, const unsigned _id); + MapTrainerTeamMember(const Pokemod& par, const MapTrainerTeamMember& p, const unsigned _id); + MapTrainerTeamMember(const Pokemod& par, const QString& fname, const unsigned _id = UINT_MAX); + + void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception); + void save(const QString& map, const QString& trainer) const throw(Exception); + + void setSpecies(const unsigned s) throw(BoundsException); + void setLevel(const unsigned l) throw(BoundsException); + void setNature(const unsigned n) throw(BoundsException); + void setItem(const unsigned itm, const bool it) throw(Exception); + + unsigned getSpecies() const; + unsigned getLevel() const; + unsigned getNature() const; + bool getItem(const unsigned itm) const; + + MapTrainerTeamMember& operator=(const MapTrainerTeamMember& p); + private: + bool validate() const; + + unsigned species; + unsigned level; + unsigned nature; + QList items; + }; +} + +#endif diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp index 33a85a2b..0a29d16f 100644 --- a/pokemod/MapWarp.cpp +++ b/pokemod/MapWarp.cpp @@ -78,20 +78,20 @@ bool PokeMod::MapWarp::validate() const pokemod.validationMsg("Invalid type"); valid = false; } - if (pokemod.getMapByID(toMap) == UINT_MAX) + if (pokemod.getMapIndex(toMap) == UINT_MAX) { pokemod.validationMsg("Invalid destination map"); valid = false; } else { - if (pokemod.getMap(pokemod.getMapByID(toMap)).getWarpByID(toWarp) == UINT_MAX) + if (pokemod.getMapByID(toMap).getWarpIndex(toWarp) == UINT_MAX) { pokemod.validationMsg("Invalid destnation warp"); valid = false; } } - if (pokemod.getDialogByID(dialog) == UINT_MAX) + if (pokemod.getDialogIndex(dialog) == UINT_MAX) { pokemod.validationMsg("Invalid dialog"); valid = false; @@ -210,7 +210,7 @@ void PokeMod::MapWarp::setIsFoggy(const bool i) void PokeMod::MapWarp::setToMap(const unsigned t) throw(BoundsException) { - if (pokemod.getMapByID(t) == UINT_MAX) + if (pokemod.getMapIndex(t) == UINT_MAX) throw(BoundsException("MapWarp", "toMap")); toMap = t; toWarp = UINT_MAX; @@ -218,9 +218,9 @@ void PokeMod::MapWarp::setToMap(const unsigned t) throw(BoundsException) void PokeMod::MapWarp::setToWarp(const unsigned t) throw(BoundsException) { - if (pokemod.getMapByID(toMap) == UINT_MAX) + if (pokemod.getMapIndex(toMap) == UINT_MAX) throw(BoundsException("MapWarp", "toMap")); - if (pokemod.getMap(pokemod.getMapByID(toMap)).getWarpByID(t) == UINT_MAX) + if (pokemod.getMapByID(toMap).getWarpIndex(t) == UINT_MAX) throw(BoundsException("MapWarp", "toWarp")); } @@ -241,7 +241,7 @@ void PokeMod::MapWarp::setWorkingFlagStatus(const unsigned s) void PokeMod::MapWarp::setDialog(const unsigned d) throw(BoundsException) { - if (pokemod.getDialogByID(d) == UINT_MAX) + if (pokemod.getDialogIndex(d) == UINT_MAX) throw(BoundsException("MapWarp", "dialog")); dialog = d; } @@ -256,16 +256,6 @@ Point PokeMod::MapWarp::getCoordinate() const return coordinate; } -unsigned PokeMod::MapWarp::getCoordinateX() const -{ - return coordinate.getX(); -} - -unsigned PokeMod::MapWarp::getCoordinateY() const -{ - return coordinate.getY(); -} - bool PokeMod::MapWarp::getFrom(const unsigned d) const throw(BoundsException) { if (D_End <= d) @@ -313,16 +303,6 @@ Flag PokeMod::MapWarp::getWorkingFlag() const return workingFlag; } -unsigned PokeMod::MapWarp::getWorkingFlagFlag() const -{ - return workingFlag.getFlag(); -} - -unsigned PokeMod::MapWarp::getWorkingFlagStatus() const -{ - return workingFlag.getStatus(); -} - unsigned PokeMod::MapWarp::getDialog() const { return dialog; diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h index 1eff57f0..7430ed97 100644 --- a/pokemod/MapWarp.h +++ b/pokemod/MapWarp.h @@ -72,8 +72,6 @@ namespace PokeMod QString getName() const; Point getCoordinate() const; - unsigned getCoordinateX() const; - unsigned getCoordinateY() const; bool getFrom(const unsigned d) const throw(BoundsException); unsigned getDirectionOut() const; unsigned getWarpType() const; @@ -83,8 +81,6 @@ namespace PokeMod unsigned getToMap() const; unsigned getToWarp() const; Flag getWorkingFlag() const; - unsigned getWorkingFlagFlag() const; - unsigned getWorkingFlagStatus() const; unsigned getDialog() const; MapWarp& operator=(const MapWarp& rhs); diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp index 44f7f42b..79fd2fbc 100644 --- a/pokemod/MapWildList.cpp +++ b/pokemod/MapWildList.cpp @@ -73,7 +73,7 @@ bool PokeMod::MapWildList::validate() const QMap idChecker; for (QListIterator i(times); i.hasNext(); i.next()) { - if (pokemod.getTimeByID(i.peekNext()) == UINT_MAX) + if (pokemod.getTimeIndex(i.peekNext()) == UINT_MAX) { pokemod.validationMsg("Invalid time"); valid = false; @@ -111,7 +111,7 @@ bool PokeMod::MapWildList::validate() const unsigned PokeMod::MapWildList::getNewId() const { unsigned i = 0; - for (; (i < getPokemonCount()) && (getPokemonByID(i) != UINT_MAX); ++i) + for (; (i < getEncounterCount()) && (getEncounterIndex(i) != UINT_MAX); ++i) ; return i; } @@ -139,11 +139,11 @@ void PokeMod::MapWildList::load(const QString& fname, const unsigned _id) throw( QStringList path = pokemod.getPath().split('/'); path.removeLast(); QDir fdir(path.join("/")); - pokemon.clear(); - if (fdir.cd("pokemon")) + encounters.clear(); + if (fdir.cd("encounter")) { for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); ) - newPokemon(i.next()); + newEncounter(i.next()); } } @@ -158,7 +158,7 @@ void PokeMod::MapWildList::save(const QString& map) const throw(Exception) ini.addField(QString("time-%1").arg(i), times[i]); ini.addField("scope", scope); ini.save(QString("%1/map/%2/wildlist/%3/data.pini").arg(pokemod.getPath()).arg(map).arg(id)); - for (QListIterator i(pokemon); i.hasNext(); ) + for (QListIterator i(encounters); i.hasNext(); ) i.next().save(map, id); } @@ -221,58 +221,68 @@ int PokeMod::MapWildList::getScope() const return scope; } -const PokeMod::MapWildListPokemon& PokeMod::MapWildList::getPokemon(const unsigned i) const throw(IndexException) +const PokeMod::MapWildListEncounter& PokeMod::MapWildList::getEncounter(const unsigned i) const throw(IndexException) { - if (getPokemonCount() <= i) + if (getEncounterCount() <= i) throw(IndexException("MapWildList")); - return pokemon.at(i); + return encounters.at(i); } -PokeMod::MapWildListPokemon& PokeMod::MapWildList::getPokemon(const unsigned i) throw(IndexException) +PokeMod::MapWildListEncounter& PokeMod::MapWildList::getEncounter(const unsigned i) throw(IndexException) { - if (getPokemonCount() <= i) + if (getEncounterCount() <= i) throw(IndexException("MapWildList")); - return pokemon[i]; + return encounters[i]; } -unsigned PokeMod::MapWildList::getPokemonByID(const unsigned _id) const +const PokeMod::MapWildListEncounter& PokeMod::MapWildList::getEncounterByID(const unsigned i) const throw(IndexException) { - for (unsigned i = 0; i < getPokemonCount(); ++i) + return getEncounter(getEncounterIndex(i)); +} + +PokeMod::MapWildListEncounter& PokeMod::MapWildList::getEncounterByID(const unsigned i) throw(IndexException) +{ + return getEncounter(getEncounterIndex(i)); +} + +unsigned PokeMod::MapWildList::getEncounterIndex(const unsigned _id) const +{ + for (unsigned i = 0; i < getEncounterCount(); ++i) { - if (pokemon[i].getId() == _id) + if (encounters[i].getId() == _id) return i; } return UINT_MAX; } -unsigned PokeMod::MapWildList::getPokemonCount() const +unsigned PokeMod::MapWildList::getEncounterCount() const { - return pokemon.size(); + return encounters.size(); } -PokeMod::MapWildListPokemon& PokeMod::MapWildList::newPokemon() +PokeMod::MapWildListEncounter& PokeMod::MapWildList::newEncounter() { - pokemon.append(MapWildListPokemon(pokemod, getNewId())); - return pokemon[getPokemonCount() - 1]; + encounters.append(MapWildListEncounter(pokemod, getNewId())); + return encounters[getEncounterCount() - 1]; } -PokeMod::MapWildListPokemon& PokeMod::MapWildList::newPokemon(const QString& fname) +PokeMod::MapWildListEncounter& PokeMod::MapWildList::newEncounter(const QString& fname) { - pokemon.append(MapWildListPokemon(pokemod, fname, getNewId())); - return pokemon[getPokemonCount() - 1]; + encounters.append(MapWildListEncounter(pokemod, fname, getNewId())); + return encounters[getEncounterCount() - 1]; } -PokeMod::MapWildListPokemon& PokeMod::MapWildList::newPokemon(const MapWildListPokemon& p) +PokeMod::MapWildListEncounter& PokeMod::MapWildList::newEncounter(const MapWildListEncounter& p) { - pokemon.append(MapWildListPokemon(pokemod, p, getNewId())); - return pokemon[getPokemonCount() - 1]; + encounters.append(MapWildListEncounter(pokemod, p, getNewId())); + return encounters[getEncounterCount() - 1]; } -void PokeMod::MapWildList::deletePokemon(const unsigned i) throw(IndexException) +void PokeMod::MapWildList::deleteEncounter(const unsigned i) throw(IndexException) { - if (getPokemonCount() <= i) + if (getEncounterCount() <= i) throw(IndexException("MapWildList")); - pokemon.removeAt(i); + encounters.removeAt(i); } PokeMod::MapWildList& PokeMod::MapWildList::operator=(const MapWildList& rhs) @@ -283,8 +293,8 @@ PokeMod::MapWildList& PokeMod::MapWildList::operator=(const MapWildList& rhs) value = rhs.value; times = rhs.times; scope = rhs.scope; - pokemon.clear(); - for (unsigned i = 0; i < rhs.getPokemonCount(); ++i) - newPokemon(rhs.getPokemon(i)); + encounters.clear(); + for (unsigned i = 0; i < rhs.getEncounterCount(); ++i) + newEncounter(rhs.getEncounter(i)); return *this; } diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h index d8c8f35a..5c722726 100644 --- a/pokemod/MapWildList.h +++ b/pokemod/MapWildList.h @@ -37,7 +37,7 @@ #include "Pokemod.h" #include "Item.h" #include "ItemEffect.h" -#include "MapWildListPokemon.h" +#include "MapWildListEncounter.h" namespace PokeMod { @@ -73,14 +73,16 @@ namespace PokeMod bool getTime(const unsigned ts) const; int getScope() const; - const MapWildListPokemon& getPokemon(const unsigned i) const throw(IndexException); - MapWildListPokemon& getPokemon(const unsigned i) throw(IndexException); - unsigned getPokemonByID(const unsigned _id) const; - unsigned getPokemonCount() const; - MapWildListPokemon& newPokemon(); - MapWildListPokemon& newPokemon(const QString& fname); - MapWildListPokemon& newPokemon(const MapWildListPokemon& w); - void deletePokemon(const unsigned i) throw(IndexException); + const MapWildListEncounter& getEncounter(const unsigned i) const throw(IndexException); + MapWildListEncounter& getEncounter(const unsigned i) throw(IndexException); + const MapWildListEncounter& getEncounterByID(const unsigned i) const throw(IndexException); + MapWildListEncounter& getEncounterByID(const unsigned i) throw(IndexException); + unsigned getEncounterIndex(const unsigned _id) const; + unsigned getEncounterCount() const; + MapWildListEncounter& newEncounter(); + MapWildListEncounter& newEncounter(const QString& fname); + MapWildListEncounter& newEncounter(const MapWildListEncounter& w); + void deleteEncounter(const unsigned i) throw(IndexException); MapWildList& operator=(const MapWildList& rhs); private: @@ -92,7 +94,7 @@ namespace PokeMod QList times; unsigned scope; - QList pokemon; + QList encounters; }; } diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp new file mode 100644 index 00000000..329a2768 --- /dev/null +++ b/pokemod/MapWildListEncounter.cpp @@ -0,0 +1,133 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/MapWildListEncounter.cpp +// Purpose: Define a species that can be found in the wild +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Mar 20 18:50:59 2007 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see . +///////////////////////////////////////////////////////////////////////////// + +#include "MapWildListEncounter.h" + +PokeMod::MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const unsigned _id) : + Object(par, _id), + species(UINT_MAX), + level(1), + weight(1) +{ +} + +PokeMod::MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const MapWildListEncounter& p, const unsigned _id) : + Object(par, _id) +{ + *this = p; +} + +PokeMod::MapWildListEncounter::MapWildListEncounter(const Pokemod& par, const QString& fname, const unsigned _id) : + Object(par, _id) +{ + load(fname, _id); +} + +bool PokeMod::MapWildListEncounter::validate() const +{ + bool valid = true; + pokemod.validationMsg(QString("---------Encounter with id %1---").arg(id), Pokemod::V_Msg); + if (pokemod.getSpeciesIndex(species) == UINT_MAX) + { + pokemod.validationMsg("Invalid species"); + valid = false; + } + if (!level || (pokemod.getRules().getMaxLevel() <= level)) + { + pokemod.validationMsg("Invalid level"); + valid = false; + } + if (!weight) + { + pokemod.validationMsg("Invalid weighting"); + valid = false; + } + return valid; +} + +void PokeMod::MapWildListEncounter::load(const QString& fname, const unsigned _id) throw(Exception) +{ + Ini ini(fname); + if (_id == UINT_MAX) + ini.getValue("id", id); + else + id = _id; + ini.getValue("species", species); + ini.getValue("level", level, 1); + ini.getValue("weight", weight, 1); +} + +void PokeMod::MapWildListEncounter::save(const QString& map, const unsigned listId) const throw(Exception) +{ + Ini ini; + ini.addField("id", id); + ini.addField("species", species); + ini.addField("level", level); + ini.addField("weight", weight); + ini.save(QString("%1/map/%2/wildlist/%3/encounter/%4.pini").arg(pokemod.getPath()).arg(map).arg(listId).arg(id)); +} + +void PokeMod::MapWildListEncounter::setSpecies(const unsigned s) throw(BoundsException) +{ + if (pokemod.getSpeciesIndex(s) == UINT_MAX) + throw(BoundsException("MapWildListEncounter", "species")); + species = s; +} + +void PokeMod::MapWildListEncounter::setLevel(const unsigned l) throw(BoundsException) +{ + if (!level || (pokemod.getRules().getMaxLevel() <= level)) + throw(BoundsException("MapWildListEncounter", "level")); + level = l; +} + +void PokeMod::MapWildListEncounter::setWeight(const unsigned w) throw(BoundsException) +{ + if (!w) + throw(BoundsException("MapWildListEncounter", "weight")); + weight = w; +} + +unsigned PokeMod::MapWildListEncounter::getSpecies() const +{ + return species; +} + +unsigned PokeMod::MapWildListEncounter::getLevel() const +{ + return level; +} + +unsigned PokeMod::MapWildListEncounter::getWeight() const +{ + return weight; +} + +PokeMod::MapWildListEncounter& PokeMod::MapWildListEncounter::operator=(const MapWildListEncounter& rhs) +{ + if (this == &rhs) + return *this; + species = rhs.species; + level = rhs.level; + weight = rhs.weight; + return *this; +} diff --git a/pokemod/MapWildListEncounter.h b/pokemod/MapWildListEncounter.h new file mode 100644 index 00000000..04ec43d0 --- /dev/null +++ b/pokemod/MapWildListEncounter.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/MapWildListEncounter.h +// Purpose: Define a species that can be found in the wild +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Mar 20 18:50:59 2007 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see . +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMOD_MAPWILDLISTENCOUNTER__ +#define __POKEMOD_MAPWILDLISTENCOUNTER__ + +#include +#include "../general/Exception.h" +#include "Object.h" +#include "Pokemod.h" +#include "Species.h" + +namespace PokeMod +{ + class MapWildListEncounter: public Object + { + public: + MapWildListEncounter(const Pokemod& par, const unsigned _id); + MapWildListEncounter(const Pokemod& par, const MapWildListEncounter& p, const unsigned _id); + MapWildListEncounter(const Pokemod& par, const QString& fname, const unsigned _id = UINT_MAX); + + void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception); + void save(const QString& map, const unsigned listId) const throw(Exception); + + void setSpecies(const unsigned s) throw(BoundsException); + void setLevel(const unsigned l) throw(BoundsException); + void setWeight(const unsigned w) throw(BoundsException); + + unsigned getSpecies() const; + unsigned getLevel() const; + unsigned getWeight() const; + + MapWildListEncounter& operator=(const MapWildListEncounter& rhs); + private: + bool validate() const; + + unsigned species; + unsigned level; + unsigned weight; + }; +} + +#endif diff --git a/pokemod/MapWildListPokemon.cpp b/pokemod/MapWildListPokemon.cpp deleted file mode 100644 index 046c18c3..00000000 --- a/pokemod/MapWildListPokemon.cpp +++ /dev/null @@ -1,133 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/MapWildListPokemon.cpp -// Purpose: Define a species that can be found in the wild -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 18:50:59 2007 -// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions -// Licence: -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program. If not, see . -///////////////////////////////////////////////////////////////////////////// - -#include "MapWildListPokemon.h" - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const unsigned _id) : - Object(par, _id), - species(UINT_MAX), - level(1), - weight(1) -{ -} - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const MapWildListPokemon& p, const unsigned _id) : - Object(par, _id) -{ - *this = p; -} - -PokeMod::MapWildListPokemon::MapWildListPokemon(const Pokemod& par, const QString& fname, const unsigned _id) : - Object(par, _id) -{ - load(fname, _id); -} - -bool PokeMod::MapWildListPokemon::validate() const -{ - bool valid = true; - pokemod.validationMsg(QString("---------Pokémon with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getSpeciesByID(species) == UINT_MAX) - { - pokemod.validationMsg("Invalid species"); - valid = false; - } - if (!level || (pokemod.getRules().getMaxLevel() <= level)) - { - pokemod.validationMsg("Invalid level"); - valid = false; - } - if (!weight) - { - pokemod.validationMsg("Invalid weighting"); - valid = false; - } - return valid; -} - -void PokeMod::MapWildListPokemon::load(const QString& fname, const unsigned _id) throw(Exception) -{ - Ini ini(fname); - if (_id == UINT_MAX) - ini.getValue("id", id); - else - id = _id; - ini.getValue("species", species); - ini.getValue("level", level, 1); - ini.getValue("weight", weight, 1); -} - -void PokeMod::MapWildListPokemon::save(const QString& map, const unsigned listId) const throw(Exception) -{ - Ini ini; - ini.addField("id", id); - ini.addField("species", species); - ini.addField("level", level); - ini.addField("weight", weight); - ini.save(QString("%1/map/%2/wildlist/%3/pokemon/%4.pini").arg(pokemod.getPath()).arg(map).arg(listId).arg(id)); -} - -void PokeMod::MapWildListPokemon::setSpecies(const unsigned s) throw(BoundsException) -{ - if (pokemod.getSpeciesByID(s) == UINT_MAX) - throw(BoundsException("MapWildListPokemon", "species")); - species = s; -} - -void PokeMod::MapWildListPokemon::setLevel(const unsigned l) throw(BoundsException) -{ - if (!level || (pokemod.getRules().getMaxLevel() <= level)) - throw(BoundsException("MapWildListPokemon", "level")); - level = l; -} - -void PokeMod::MapWildListPokemon::setWeight(const unsigned w) throw(BoundsException) -{ - if (!w) - throw(BoundsException("MapWildListPokemon", "weight")); - weight = w; -} - -unsigned PokeMod::MapWildListPokemon::getSpecies() const -{ - return species; -} - -unsigned PokeMod::MapWildListPokemon::getLevel() const -{ - return level; -} - -unsigned PokeMod::MapWildListPokemon::getWeight() const -{ - return weight; -} - -PokeMod::MapWildListPokemon& PokeMod::MapWildListPokemon::operator=(const MapWildListPokemon& rhs) -{ - if (this == &rhs) - return *this; - species = rhs.species; - level = rhs.level; - weight = rhs.weight; - return *this; -} diff --git a/pokemod/MapWildListPokemon.h b/pokemod/MapWildListPokemon.h deleted file mode 100644 index cb367b83..00000000 --- a/pokemod/MapWildListPokemon.h +++ /dev/null @@ -1,62 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokemod/MapWildListPokemon.h -// Purpose: Define a species that can be found in the wild -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Tue Mar 20 18:50:59 2007 -// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions -// Licence: -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program. If not, see . -///////////////////////////////////////////////////////////////////////////// - -#ifndef __POKEMOD_MAPWILDLISTPOKEMON__ -#define __POKEMOD_MAPWILDLISTPOKEMON__ - -#include -#include "../general/Exception.h" -#include "Object.h" -#include "Pokemod.h" -#include "Species.h" - -namespace PokeMod -{ - class MapWildListPokemon: public Object - { - public: - MapWildListPokemon(const Pokemod& par, const unsigned _id); - MapWildListPokemon(const Pokemod& par, const MapWildListPokemon& p, const unsigned _id); - MapWildListPokemon(const Pokemod& par, const QString& fname, const unsigned _id = UINT_MAX); - - void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception); - void save(const QString& map, const unsigned listId) const throw(Exception); - - void setSpecies(const unsigned s) throw(BoundsException); - void setLevel(const unsigned l) throw(BoundsException); - void setWeight(const unsigned w) throw(BoundsException); - - unsigned getSpecies() const; - unsigned getLevel() const; - unsigned getWeight() const; - - MapWildListPokemon& operator=(const MapWildListPokemon& rhs); - private: - bool validate() const; - - unsigned species; - unsigned level; - unsigned weight; - }; -} - -#endif diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 5933d34f..b29ca946 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pokemod/Move.cpp -// Purpose: Define a move that species can learn +// Purpose: Define a move that can be learned // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Sat May 26 2007 22:51:21 @@ -65,7 +65,7 @@ bool PokeMod::Move::validate() const pokemod.validationMsg("Name is not defined"); valid = ""; } - if (pokemod.getTypeByID(type) == UINT_MAX) + if (pokemod.getTypeIndex(type) == UINT_MAX) { pokemod.validationMsg("Invalid type"); valid = false; @@ -119,7 +119,7 @@ bool PokeMod::Move::validate() const unsigned PokeMod::Move::getNewId() const { unsigned i = 0; - for (; (i < getEffectCount()) && (getEffectByID(i) != UINT_MAX); ++i) + for (; (i < getEffectCount()) && (getEffectIndex(i) != UINT_MAX); ++i) ; return i; } @@ -208,7 +208,7 @@ void PokeMod::Move::setAccuracyDenom(const unsigned d) throw(Exception) void PokeMod::Move::setType(const unsigned t) throw(BoundsException) { - if (pokemod.getTypeByID(t) == UINT_MAX) + if (pokemod.getTypeIndex(t) == UINT_MAX) throw(BoundsException("Move", "type")); type = t; } @@ -355,7 +355,17 @@ PokeMod::MoveEffect& PokeMod::Move::getEffect(const unsigned i) throw(IndexExcep return effects[i]; } -unsigned PokeMod::Move::getEffectByID(const unsigned _id) const +const PokeMod::MoveEffect& PokeMod::Move::getEffectByID(const unsigned i) const throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +PokeMod::MoveEffect& PokeMod::Move::getEffectByID(const unsigned i) throw(IndexException) +{ + return getEffect(getEffectIndex(i)); +} + +unsigned PokeMod::Move::getEffectIndex(const unsigned _id) const { for (unsigned i = 0; i < getEffectCount(); ++i) { diff --git a/pokemod/Move.h b/pokemod/Move.h index a47975ce..5f643401 100644 --- a/pokemod/Move.h +++ b/pokemod/Move.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pokemod/Move.h -// Purpose: Define a move that Pokémon can learn +// Purpose: Define a move that can be learned // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Sat May 26 2007 08:57:13 @@ -100,7 +100,9 @@ namespace PokeMod const MoveEffect& getEffect(const unsigned i) const throw(IndexException); MoveEffect& getEffect(const unsigned i) throw(IndexException); - unsigned getEffectByID(const unsigned _id) const; + const MoveEffect& getEffectByID(const unsigned i) const throw(IndexException); + MoveEffect& getEffectByID(const unsigned i) throw(IndexException); + unsigned getEffectIndex(const unsigned _id) const; unsigned getEffectCount() const; MoveEffect& newEffect(); MoveEffect& newEffect(const QString& fname); diff --git a/pokemod/Object.h b/pokemod/Object.h index 9ac559ad..b936179a 100644 --- a/pokemod/Object.h +++ b/pokemod/Object.h @@ -13,7 +13,7 @@ // // 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 +// MERCHANTCLASS 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 diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index da034a59..74b8b7c4 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -29,10 +29,7 @@ PokeMod::Pokemod::Pokemod(const QString& fname) : version(""), description(""), startMap(UINT_MAX), - startMoney(0), - startCoordinate(0, 0), - startDirection(UINT_MAX), - startDialog(UINT_MAX), + startWarp(UINT_MAX), superPCUname(""), superPCPasswd(""), typeChart(1, 1, Frac(1, 1, Frac::Improper)), @@ -57,16 +54,11 @@ bool PokeMod::Pokemod::validate() const } if (description == "") validationMsg("Description is not defined", V_Warn); - if (getMapByID(startMap)) + if (getMapIndex(startMap)) { - if (getMap(getMapByID(startMap)).getWidth() <= startCoordinate.getX()) + if (getMapByID(startMap).getWarpIndex(startWarp) == UINT_MAX) { - validationMsg("Invalid starting x coordinate"); - valid = false; - } - if (getMap(getMapByID(startMap)).getHeight() <= startCoordinate.getY()) - { - validationMsg("Invalid starting y coordinate"); + validationMsg("Invalid starting warp"); valid = false; } } @@ -75,16 +67,6 @@ bool PokeMod::Pokemod::validate() const validationMsg("Invalid starting map"); valid = false; } - if (D_End <= startDirection) - { - validationMsg("Invalid starting direction"); - valid = false; - } - if (getDialogByID(startDialog) == UINT_MAX) - { - validationMsg("Invalid starting dialog"); - valid = false; - } if (!QFile::exists(QString("%1/image/skin/walk.png").arg(getPath()))) { validationMsg("Cannot find walking skin"); @@ -452,7 +434,7 @@ bool PokeMod::Pokemod::validate() const } if (!getSpeciesCount()) { - validationMsg("There are no Pokémon"); + validationMsg("There are no species"); valid = false; } for (QListIterator i(species); i.hasNext(); i.next()) @@ -466,7 +448,7 @@ bool PokeMod::Pokemod::validate() const { if (1 < i.value()) { - validationMsg(QString("There are %1 Pokémon with id %2").arg(i.value()).arg(i.key())); + validationMsg(QString("There are %1 species with id %2").arg(i.value()).arg(i.key())); valid = false; } } @@ -474,7 +456,7 @@ bool PokeMod::Pokemod::validate() const { if (1 < i.value()) { - validationMsg(QString("There are %1 Pokémon with the name \"%2\"").arg(i.value()).arg(i.key())); + validationMsg(QString("There are %1 species with the name \"%2\"").arg(i.value()).arg(i.key())); valid = false; } } @@ -621,18 +603,11 @@ void PokeMod::Pokemod::load(const QString& fname) throw(Exception) QStringList fpath = fname.split('\\', QString::SkipEmptyParts).join("/").split('\\', QString::SkipEmptyParts); fpath.removeLast(); path = fpath.join("/"); - unsigned i; - unsigned j; ini.getValue("title", title); ini.getValue("version", version); ini.getValue("description", description); ini.getValue("startMap", startMap); - ini.getValue("startMoney", startMoney, 0); - ini.getValue("startCoordinate-x", i, 0); - ini.getValue("startCoordinate-y", j, 0); - startCoordinate.set(i, j); - ini.getValue("startDirection", startDirection); - ini.getValue("startDialog", startDialog); + ini.getValue("startWarp", startWarp); ini.getValue("superPCUname", superPCUname); ini.getValue("superPCPasswd", superPCPasswd); for (unsigned i = 0; i < pokemod.getTypeCount(); ++i) @@ -769,11 +744,7 @@ void PokeMod::Pokemod::save() const throw(Exception) ini.addField("version", version); ini.addField("description", description); ini.addField("startMap", startMap); - ini.addField("startMoney", startMoney); - ini.addField("startCoordinate-x", startCoordinate.getX()); - ini.addField("startCoordinate-y", startCoordinate.getY()); - ini.addField("startDirection", startDirection); - ini.addField("startDialog", startDialog); + ini.addField("startWarp", startWarp); ini.addField("superPCUname", superPCUname); ini.addField("superPCPasswd", superPCPasswd); for (unsigned i = 1; i < typeChart.getWidth(); ++i) @@ -842,57 +813,18 @@ void PokeMod::Pokemod::setDescription(const QString& d) void PokeMod::Pokemod::setStartMap(const unsigned s) throw(BoundsException) { - if (getMapByID(s) == UINT_MAX) + if (getMapIndex(s) == UINT_MAX) throw(BoundsException("Pokemod", "startMap")); startMap = s; } -void PokeMod::Pokemod::setStartMoney(const unsigned s) -{ - startMoney = s; -} - -void PokeMod::Pokemod::setStartCoordinate(const unsigned x, const unsigned y) throw(BoundsException) -{ - if (getMapByID(startMap) == UINT_MAX) - throw(BoundsException("Pokemod", "startMap")); - if (getMap(getMapByID(startMap)).getWidth() <= x) - throw(BoundsException("Pokemod", "startX")); - if (getMap(getMapByID(startMap)).getHeight() <= y) - throw(BoundsException("Pokemod", "startY")); - startCoordinate.set(x, y); -} - -void PokeMod::Pokemod::setStartCoordinateX(const unsigned x) throw(BoundsException) +void PokeMod::Pokemod::setStartWarp(const unsigned s) throw(BoundsException) { - if (getMapByID(startMap) == UINT_MAX) + if (getMapIndex(startMap) == UINT_MAX) throw(BoundsException("Pokemod", "startMap")); - if (getMap(getMapByID(startMap)).getWidth() <= x) - throw(BoundsException("Pokemod", "startX")); - startCoordinate.setX(x); -} - -void PokeMod::Pokemod::setStartCoordinateY(const unsigned y) throw(BoundsException) -{ - if (getMapByID(startMap) == UINT_MAX) - throw(BoundsException("Pokemod", "startMap")); - if (getMap(getMapByID(startMap)).getHeight() <= y) - throw(BoundsException("Pokemod", "startY")); - startCoordinate.setY(y); -} - -void PokeMod::Pokemod::setStartDirection(const unsigned s) throw(BoundsException) -{ - if (D_End <= s) - throw(BoundsException("Pokemod", "startDirection")); - startDirection = s; -} - -void PokeMod::Pokemod::setStartDialog(const unsigned s) throw(BoundsException) -{ - if (getDialogByID(s) == UINT_MAX) - throw(BoundsException("Pokemod", "startDialog")); - startDialog = s; + if (getMapByID(startMap).getWarpIndex(s) == UINT_MAX) + throw(BoundsException("Pokemod", "startWarp")); + startWarp = s; } void PokeMod::Pokemod::setWalkSkin(const QString& fname) throw(Exception) @@ -1004,24 +936,9 @@ unsigned PokeMod::Pokemod::getStartMap() const return startMap; } -unsigned PokeMod::Pokemod::getStartMoney() const -{ - return startMoney; -} - -Point PokeMod::Pokemod::getStartCoordinate() const -{ - return startCoordinate; -} - -unsigned PokeMod::Pokemod::getStartDirection() const +unsigned PokeMod::Pokemod::getStartWarp() const { - return startDirection; -} - -unsigned PokeMod::Pokemod::getStartDialog() const -{ - return startDialog; + return startWarp; } QString PokeMod::Pokemod::getSuperPCUname() const @@ -1073,7 +990,17 @@ PokeMod::Ability& PokeMod::Pokemod::getAbility(const unsigned i) throw(IndexExce return abilities[i]; } -unsigned PokeMod::Pokemod::getAbilityByID(const unsigned _id) const +const PokeMod::Ability& PokeMod::Pokemod::getAbilityByID(const unsigned i) const throw(IndexException) +{ + return getAbility(getAbilityIndex(i)); +} + +PokeMod::Ability& PokeMod::Pokemod::getAbilityByID(const unsigned i) throw(IndexException) +{ + return getAbility(getAbilityIndex(i)); +} + +unsigned PokeMod::Pokemod::getAbilityIndex(const unsigned _id) const { for (unsigned i = 0; i < getAbilityCount(); ++i) { @@ -1127,7 +1054,17 @@ PokeMod::Author& PokeMod::Pokemod::getAuthor(const unsigned i) throw(IndexExcept return authors[i]; } -unsigned PokeMod::Pokemod::getAuthorByID(const unsigned _id) const +const PokeMod::Author& PokeMod::Pokemod::getAuthorByID(const unsigned i) const throw(IndexException) +{ + return getAuthor(getAuthorIndex(i)); +} + +PokeMod::Author& PokeMod::Pokemod::getAuthorByID(const unsigned i) throw(IndexException) +{ + return getAuthor(getAuthorIndex(i)); +} + +unsigned PokeMod::Pokemod::getAuthorIndex(const unsigned _id) const { for (unsigned i = 0; i < getAuthorCount(); ++i) { @@ -1169,7 +1106,17 @@ PokeMod::Badge& PokeMod::Pokemod::getBadge(const unsigned i) throw(IndexExceptio return badges[i]; } -unsigned PokeMod::Pokemod::getBadgeByID(const unsigned _id) const +const PokeMod::Badge& PokeMod::Pokemod::getBadgeByID(const unsigned i) const throw(IndexException) +{ + return getBadge(getBadgeIndex(i)); +} + +PokeMod::Badge& PokeMod::Pokemod::getBadgeByID(const unsigned i) throw(IndexException) +{ + return getBadge(getBadgeIndex(i)); +} + +unsigned PokeMod::Pokemod::getBadgeIndex(const unsigned _id) const { for (unsigned i = 0; i < getBadgeCount(); ++i) { @@ -1223,7 +1170,17 @@ PokeMod::CoinList& PokeMod::Pokemod::getCoinList(const unsigned i) throw(IndexEx return coinLists[i]; } -unsigned PokeMod::Pokemod::getCoinListByID(const unsigned _id) const +const PokeMod::CoinList& PokeMod::Pokemod::getCoinListByID(const unsigned i) const throw(IndexException) +{ + return getCoinList(getCoinListIndex(i)); +} + +PokeMod::CoinList& PokeMod::Pokemod::getCoinListByID(const unsigned i) throw(IndexException) +{ + return getCoinList(getCoinListIndex(i)); +} + +unsigned PokeMod::Pokemod::getCoinListIndex(const unsigned _id) const { for (unsigned i = 0; i < getCoinListCount(); ++i) { @@ -1277,7 +1234,17 @@ PokeMod::Dialog& PokeMod::Pokemod::getDialog(const unsigned i) throw(IndexExcept return dialogs[i]; } -unsigned PokeMod::Pokemod::getDialogByID(const unsigned _id) const +const PokeMod::Dialog& PokeMod::Pokemod::getDialogByID(const unsigned i) const throw(IndexException) +{ + return getDialog(getDialogIndex(i)); +} + +PokeMod::Dialog& PokeMod::Pokemod::getDialogByID(const unsigned i) throw(IndexException) +{ + return getDialog(getDialogIndex(i)); +} + +unsigned PokeMod::Pokemod::getDialogIndex(const unsigned _id) const { for (unsigned i = 0; i < getDialogCount(); ++i) { @@ -1331,7 +1298,17 @@ PokeMod::EggGroup& PokeMod::Pokemod::getEggGroup(const unsigned i) throw(IndexEx return eggGroups[i]; } -unsigned PokeMod::Pokemod::getEggGroupByID(const unsigned _id) const +const PokeMod::EggGroup& PokeMod::Pokemod::getEggGroupByID(const unsigned i) const throw(IndexException) +{ + return getEggGroup(getEggGroupIndex(i)); +} + +PokeMod::EggGroup& PokeMod::Pokemod::getEggGroupByID(const unsigned i) throw(IndexException) +{ + return getEggGroup(getEggGroupIndex(i)); +} + +unsigned PokeMod::Pokemod::getEggGroupIndex(const unsigned _id) const { for (unsigned i = 0; i < getEggGroupCount(); ++i) { @@ -1385,7 +1362,17 @@ PokeMod::Item& PokeMod::Pokemod::getItem(const unsigned i) throw(IndexException) return items[i]; } -unsigned PokeMod::Pokemod::getItemByID(const unsigned _id) const +const PokeMod::Item& PokeMod::Pokemod::getItemByID(const unsigned i) const throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +PokeMod::Item& PokeMod::Pokemod::getItemByID(const unsigned i) throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +unsigned PokeMod::Pokemod::getItemIndex(const unsigned _id) const { for (unsigned i = 0; i < getItemCount(); ++i) { @@ -1439,7 +1426,17 @@ PokeMod::ItemType& PokeMod::Pokemod::getItemType(const unsigned i) throw(IndexEx return itemTypes[i]; } -unsigned PokeMod::Pokemod::getItemTypeByID(const unsigned _id) const +const PokeMod::ItemType& PokeMod::Pokemod::getItemTypeByID(const unsigned i) const throw(IndexException) +{ + return getItemType(getItemTypeIndex(i)); +} + +PokeMod::ItemType& PokeMod::Pokemod::getItemTypeByID(const unsigned i) throw(IndexException) +{ + return getItemType(getItemTypeIndex(i)); +} + +unsigned PokeMod::Pokemod::getItemTypeIndex(const unsigned _id) const { for (unsigned i = 0; i < getItemTypeCount(); ++i) { @@ -1493,7 +1490,17 @@ PokeMod::Map& PokeMod::Pokemod::getMap(const unsigned i) throw(IndexException) return maps[i]; } -unsigned PokeMod::Pokemod::getMapByID(const unsigned _id) const +const PokeMod::Map& PokeMod::Pokemod::getMapByID(const unsigned i) const throw(IndexException) +{ + return getMap(getMapIndex(i)); +} + +PokeMod::Map& PokeMod::Pokemod::getMapByID(const unsigned i) throw(IndexException) +{ + return getMap(getMapIndex(i)); +} + +unsigned PokeMod::Pokemod::getMapIndex(const unsigned _id) const { for (unsigned i = 0; i < getMapCount(); ++i) { @@ -1547,7 +1554,17 @@ PokeMod::Move& PokeMod::Pokemod::getMove(const unsigned i) throw(IndexException) return moves[i]; } -unsigned PokeMod::Pokemod::getMoveByID(const unsigned _id) const +const PokeMod::Move& PokeMod::Pokemod::getMoveByID(const unsigned i) const throw(IndexException) +{ + return getMove(getMoveIndex(i)); +} + +PokeMod::Move& PokeMod::Pokemod::getMoveByID(const unsigned i) throw(IndexException) +{ + return getMove(getMoveIndex(i)); +} + +unsigned PokeMod::Pokemod::getMoveIndex(const unsigned _id) const { for (unsigned i = 0; i < getMoveCount(); ++i) { @@ -1601,7 +1618,17 @@ PokeMod::Nature& PokeMod::Pokemod::getNature(const unsigned i) throw(IndexExcept return natures[i]; } -unsigned PokeMod::Pokemod::getNatureByID(const unsigned _id) const +const PokeMod::Nature& PokeMod::Pokemod::getNatureByID(const unsigned i) const throw(IndexException) +{ + return getNature(getNatureIndex(i)); +} + +PokeMod::Nature& PokeMod::Pokemod::getNatureByID(const unsigned i) throw(IndexException) +{ + return getNature(getNatureIndex(i)); +} + +unsigned PokeMod::Pokemod::getNatureIndex(const unsigned _id) const { for (unsigned i = 0; i < getNatureCount(); ++i) { @@ -1655,7 +1682,17 @@ PokeMod::Species& PokeMod::Pokemod::getSpecies(const unsigned i) throw(IndexExce return species[i]; } -unsigned PokeMod::Pokemod::getSpeciesByID(const unsigned _id) const +const PokeMod::Species& PokeMod::Pokemod::getSpeciesByID(const unsigned i) const throw(IndexException) +{ + return getSpecies(getSpeciesIndex(i)); +} + +PokeMod::Species& PokeMod::Pokemod::getSpeciesByID(const unsigned i) throw(IndexException) +{ + return getSpecies(getSpeciesIndex(i)); +} + +unsigned PokeMod::Pokemod::getSpeciesIndex(const unsigned _id) const { for (unsigned i = 0; i < getSpeciesCount(); ++i) { @@ -1709,7 +1746,17 @@ PokeMod::Store& PokeMod::Pokemod::getStore(const unsigned i) throw(IndexExceptio return stores[i]; } -unsigned PokeMod::Pokemod::getStoreByID(const unsigned _id) const +const PokeMod::Store& PokeMod::Pokemod::getStoreByID(const unsigned i) const throw(IndexException) +{ + return getStore(getStoreIndex(i)); +} + +PokeMod::Store& PokeMod::Pokemod::getStoreByID(const unsigned i) throw(IndexException) +{ + return getStore(getStoreIndex(i)); +} + +unsigned PokeMod::Pokemod::getStoreIndex(const unsigned _id) const { for (unsigned i = 0; i < getStoreCount(); ++i) { @@ -1763,7 +1810,17 @@ PokeMod::Tile& PokeMod::Pokemod::getTile(const unsigned i) throw(IndexException) return tiles[i]; } -unsigned PokeMod::Pokemod::getTileByID(const unsigned _id) const +const PokeMod::Tile& PokeMod::Pokemod::getTileByID(const unsigned i) const throw(IndexException) +{ + return getTile(getTileIndex(i)); +} + +PokeMod::Tile& PokeMod::Pokemod::getTileByID(const unsigned i) throw(IndexException) +{ + return getTile(getTileIndex(i)); +} + +unsigned PokeMod::Pokemod::getTileIndex(const unsigned _id) const { for (unsigned i = 0; i < getTileCount(); ++i) { @@ -1817,7 +1874,17 @@ PokeMod::Time& PokeMod::Pokemod::getTime(const unsigned i) throw(IndexException) return times[i]; } -unsigned PokeMod::Pokemod::getTimeByID(const unsigned _id) const +const PokeMod::Time& PokeMod::Pokemod::getTimeByID(const unsigned i) const throw(IndexException) +{ + return getTime(getTimeIndex(i)); +} + +PokeMod::Time& PokeMod::Pokemod::getTimeByID(const unsigned i) throw(IndexException) +{ + return getTime(getTimeIndex(i)); +} + +unsigned PokeMod::Pokemod::getTimeIndex(const unsigned _id) const { for (unsigned i = 0; i < getTimeCount(); ++i) { @@ -1871,7 +1938,17 @@ PokeMod::Type& PokeMod::Pokemod::getType(const unsigned i) throw(IndexException) return types[i]; } -unsigned PokeMod::Pokemod::getTypeByID(const unsigned _id) const +const PokeMod::Type& PokeMod::Pokemod::getTypeByID(const unsigned i) const throw(IndexException) +{ + return getType(getTypeIndex(i)); +} + +PokeMod::Type& PokeMod::Pokemod::getTypeByID(const unsigned i) throw(IndexException) +{ + return getType(getTypeIndex(i)); +} + +unsigned PokeMod::Pokemod::getTypeIndex(const unsigned _id) const { for (unsigned i = 0; i < getTypeCount(); ++i) { diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index fc4a8e75..8f2453b7 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -84,12 +84,7 @@ namespace PokeMod void setVersion(const QString& v); void setDescription(const QString& d); void setStartMap(const unsigned s) throw(BoundsException); - void setStartMoney(const unsigned s); - void setStartCoordinate(const unsigned x, const unsigned y) throw(BoundsException); - void setStartCoordinateX(const unsigned x) throw(BoundsException); - void setStartCoordinateY(const unsigned y) throw(BoundsException); - void setStartDirection(const unsigned s) throw(BoundsException); - void setStartDialog(const unsigned s) throw(BoundsException); + void setStartWarp(const unsigned s) throw(BoundsException); void setWalkSkin(const QString& fname) throw(Exception); void setBikeSkin(const QString& fname) throw(Exception); void setSurfSkin(const QString& fname) throw(Exception); @@ -108,10 +103,7 @@ namespace PokeMod QString getVersion() const; QString getDescription() const; unsigned getStartMap() const; - unsigned getStartMoney() const; - Point getStartCoordinate() const; - unsigned getStartDirection() const; - unsigned getStartDialog() const; + unsigned getStartWarp() const; QString getSuperPCUname() const; QString getSuperPCPasswd() const; const FracMatrix& getTypeChart() const; @@ -122,7 +114,9 @@ namespace PokeMod const Ability& getAbility(const unsigned i) const throw(IndexException); Ability& getAbility(const unsigned i) throw(IndexException); - unsigned getAbilityByID(const unsigned i) const; + const Ability& getAbilityByID(const unsigned i) const throw(IndexException); + Ability& getAbilityByID(const unsigned i) throw(IndexException); + unsigned getAbilityIndex(const unsigned i) const; unsigned getAbilityCount() const; Ability& newAbility(); Ability& newAbility(const QString& fname); @@ -131,7 +125,9 @@ namespace PokeMod const Author& getAuthor(const unsigned i) const throw(IndexException); Author& getAuthor(const unsigned i) throw(IndexException); - unsigned getAuthorByID(const unsigned i) const; + const Author& getAuthorByID(const unsigned i) const throw(IndexException); + Author& getAuthorByID(const unsigned i) throw(IndexException); + unsigned getAuthorIndex(const unsigned i) const; unsigned getAuthorCount() const; Author& newAuthor(); Author& newAuthor(const QString& fname); @@ -140,7 +136,9 @@ namespace PokeMod const Badge& getBadge(const unsigned i) const throw(IndexException); Badge& getBadge(const unsigned i) throw(IndexException); - unsigned getBadgeByID(const unsigned i) const; + const Badge& getBadgeByID(const unsigned i) const throw(IndexException); + Badge& getBadgeByID(const unsigned i) throw(IndexException); + unsigned getBadgeIndex(const unsigned i) const; unsigned getBadgeCount() const; Badge& newBadge(); Badge& newBadge(const QString& fname); @@ -149,7 +147,9 @@ namespace PokeMod const CoinList& getCoinList(const unsigned i) const throw(IndexException); CoinList& getCoinList(const unsigned i) throw(IndexException); - unsigned getCoinListByID(const unsigned i) const; + const CoinList& getCoinListByID(const unsigned i) const throw(IndexException); + CoinList& getCoinListByID(const unsigned i) throw(IndexException); + unsigned getCoinListIndex(const unsigned i) const; unsigned getCoinListCount() const; CoinList& newCoinList(); CoinList& newCoinList(const QString& fname); @@ -158,7 +158,9 @@ namespace PokeMod const Dialog& getDialog(const unsigned i) const throw(IndexException); Dialog& getDialog(const unsigned i) throw(IndexException); - unsigned getDialogByID(const unsigned i) const; + const Dialog& getDialogByID(const unsigned i) const throw(IndexException); + Dialog& getDialogByID(const unsigned i) throw(IndexException); + unsigned getDialogIndex(const unsigned i) const; unsigned getDialogCount() const; Dialog& newDialog(); Dialog& newDialog(const QString& fname); @@ -167,7 +169,9 @@ namespace PokeMod const EggGroup& getEggGroup(const unsigned i) const throw(IndexException); EggGroup& getEggGroup(const unsigned i) throw(IndexException); - unsigned getEggGroupByID(const unsigned i) const; + const EggGroup& getEggGroupByID(const unsigned i) const throw(IndexException); + EggGroup& getEggGroupByID(const unsigned i) throw(IndexException); + unsigned getEggGroupIndex(const unsigned i) const; unsigned getEggGroupCount() const; EggGroup& newEggGroup(); EggGroup& newEggGroup(const QString& fname); @@ -176,7 +180,9 @@ namespace PokeMod const Item& getItem(const unsigned i) const throw(IndexException); Item& getItem(const unsigned i) throw(IndexException); - unsigned getItemByID(const unsigned i) const; + const Item& getItemByID(const unsigned i) const throw(IndexException); + Item& getItemByID(const unsigned i) throw(IndexException); + unsigned getItemIndex(const unsigned i) const; unsigned getItemCount() const; Item& newItem(); Item& newItem(const QString& fname); @@ -185,7 +191,9 @@ namespace PokeMod const ItemType& getItemType(const unsigned i) const throw(IndexException); ItemType& getItemType(const unsigned i) throw(IndexException); - unsigned getItemTypeByID(const unsigned i) const; + const ItemType& getItemTypeByID(const unsigned i) const throw(IndexException); + ItemType& getItemTypeByID(const unsigned i) throw(IndexException); + unsigned getItemTypeIndex(const unsigned i) const; unsigned getItemTypeCount() const; ItemType& newItemType(); ItemType& newItemType(const QString& fname); @@ -194,7 +202,9 @@ namespace PokeMod const Map& getMap(const unsigned i) const throw(IndexException); Map& getMap(const unsigned i) throw(IndexException); - unsigned getMapByID(const unsigned i) const; + const Map& getMapByID(const unsigned i) const throw(IndexException); + Map& getMapByID(const unsigned i) throw(IndexException); + unsigned getMapIndex(const unsigned i) const; unsigned getMapCount() const; Map& newMap(); Map& newMap(const QString& fname); @@ -203,7 +213,9 @@ namespace PokeMod const Move& getMove(const unsigned i) const throw(IndexException); Move& getMove(const unsigned i) throw(IndexException); - unsigned getMoveByID(const unsigned i) const; + const Move& getMoveByID(const unsigned i) const throw(IndexException); + Move& getMoveByID(const unsigned i) throw(IndexException); + unsigned getMoveIndex(const unsigned i) const; unsigned getMoveCount() const; Move& newMove(); Move& newMove(const QString& fname); @@ -212,7 +224,9 @@ namespace PokeMod const Nature& getNature(const unsigned i) const throw(IndexException); Nature& getNature(const unsigned i) throw(IndexException); - unsigned getNatureByID(const unsigned i) const; + const Nature& getNatureByID(const unsigned i) const throw(IndexException); + Nature& getNatureByID(const unsigned i) throw(IndexException); + unsigned getNatureIndex(const unsigned i) const; unsigned getNatureCount() const; Nature& newNature(); Nature& newNature(const QString& fname); @@ -221,7 +235,9 @@ namespace PokeMod const Species& getSpecies(const unsigned i) const throw(IndexException); Species& getSpecies(const unsigned i) throw(IndexException); - unsigned getSpeciesByID(const unsigned i) const; + const Species& getSpeciesByID(const unsigned i) const throw(IndexException); + Species& getSpeciesByID(const unsigned i) throw(IndexException); + unsigned getSpeciesIndex(const unsigned i) const; unsigned getSpeciesCount() const; Species& newSpecies(); Species& newSpecies(const QString& fname); @@ -230,7 +246,9 @@ namespace PokeMod const Store& getStore(const unsigned i) const throw(IndexException); Store& getStore(const unsigned i) throw(IndexException); - unsigned getStoreByID(const unsigned i) const; + const Store& getStoreByID(const unsigned i) const throw(IndexException); + Store& getStoreByID(const unsigned i) throw(IndexException); + unsigned getStoreIndex(const unsigned i) const; unsigned getStoreCount() const; Store& newStore(); Store& newStore(const QString& fname); @@ -239,7 +257,9 @@ namespace PokeMod const Tile& getTile(const unsigned i) const throw(IndexException); Tile& getTile(const unsigned i) throw(IndexException); - unsigned getTileByID(const unsigned i) const; + const Tile& getTileByID(const unsigned i) const throw(IndexException); + Tile& getTileByID(const unsigned i) throw(IndexException); + unsigned getTileIndex(const unsigned i) const; unsigned getTileCount() const; Tile& newTile(); Tile& newTile(const QString& fname); @@ -248,7 +268,9 @@ namespace PokeMod const Time& getTime(const unsigned i) const throw(IndexException); Time& getTime(const unsigned i) throw(IndexException); - unsigned getTimeByID(const unsigned i) const; + const Time& getTimeByID(const unsigned i) const throw(IndexException); + Time& getTimeByID(const unsigned i) throw(IndexException); + unsigned getTimeIndex(const unsigned i) const; unsigned getTimeCount() const; Time& newTime(); Time& newTime(const QString& fname); @@ -257,7 +279,9 @@ namespace PokeMod const Type& getType(const unsigned i) const throw(IndexException); Type& getType(const unsigned i) throw(IndexException); - unsigned getTypeByID(const unsigned i) const; + const Type& getTypeByID(const unsigned i) const throw(IndexException); + Type& getTypeByID(const unsigned i) throw(IndexException); + unsigned getTypeIndex(const unsigned i) const; unsigned getTypeCount() const; Type& newType(); Type& newType(const QString& fname); @@ -288,10 +312,7 @@ namespace PokeMod QString version; QString description; unsigned startMap; - unsigned startMoney; - Point startCoordinate; - unsigned startDirection; - unsigned startDialog; + unsigned startWarp; QString superPCUname; QString superPCPasswd; FracMatrix typeChart; diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp index 41776b2a..92461eca 100644 --- a/pokemod/Rules.cpp +++ b/pokemod/Rules.cpp @@ -30,8 +30,8 @@ PokeMod::Rules::Rules(const Pokemod& par) : criticalDomains(false), abilityAllowed(false), natureAllowed(false), - numPokemonBoxes(0), - numPokemonPerBox(1), + numBoxes(0), + boxSize(1), maxParty(1), maxFight(1), maxMoves(1), @@ -62,26 +62,26 @@ bool PokeMod::Rules::validate() const { bool valid = true; pokemod.validationMsg("---Rules", Pokemod::V_Msg); - if (!numPokemonBoxes) - pokemod.validationMsg("Invalid number of Pokémon boxes", Pokemod::V_Warn); - else if (!numPokemonPerBox) + if (!numBoxes) + pokemod.validationMsg("No box storage", Pokemod::V_Warn); + else if (!boxSize) { - pokemod.validationMsg("Invalid number of Pokémon per box"); + pokemod.validationMsg("Invalid box size"); valid = false; } if (!maxParty) { - pokemod.validationMsg("Invalid number of Pokémon for max party"); + pokemod.validationMsg("Invalid party size"); valid = false; } if (!maxParty || (maxParty < maxFight)) { - pokemod.validationMsg("More Pokémon can fight than are allowed in the party"); + pokemod.validationMsg("Larger active than party"); valid = false; } if (!maxMoves) { - pokemod.validationMsg("Pokémon cannot learn any moves"); + pokemod.validationMsg("No moves can be learned"); valid = false; } if (!maxMoney) @@ -99,7 +99,7 @@ bool PokeMod::Rules::validate() const valid = false; } } - if (.05 < pokerusChance) + if (.005 < pokerusChance) pokemod.validationMsg("Pokérus chance is unusually high", Pokemod::V_Warn); return valid; } @@ -115,8 +115,8 @@ void PokeMod::Rules::load(const QString& fname) throw(Exception) ini.getValue("criticalDomains", criticalDomains, false); ini.getValue("abilityAllowed", abilityAllowed, false); ini.getValue("natureAllowed", natureAllowed, false); - ini.getValue("numPokemonBoxes", numPokemonBoxes, 0); - ini.getValue("numPokemonPerBox", numPokemonPerBox, 1); + ini.getValue("numBoxes", numBoxes, 0); + ini.getValue("boxSize", boxSize, 1); ini.getValue("maxParty", maxParty, 1); ini.getValue("maxFight", maxFight, 1); ini.getValue("maxMoves", maxMoves, 1); @@ -147,8 +147,8 @@ void PokeMod::Rules::save() const throw(Exception) ini.addField("criticalDomains", criticalDomains); ini.addField("abilityAllowed", abilityAllowed); ini.addField("natureAllowed", natureAllowed); - ini.addField("numPokemonBoxes", numPokemonBoxes); - ini.addField("numPokemonPerBox", numPokemonPerBox); + ini.addField("numBoxes", numBoxes); + ini.addField("boxSize", boxSize); ini.addField("maxParty", maxParty); ini.addField("maxFight", maxFight); ini.addField("maxMoves", maxMoves); @@ -204,14 +204,14 @@ void PokeMod::Rules::setNatureAllowed(const bool n) natureAllowed = n; } -void PokeMod::Rules::setNumPokemonBoxes(const unsigned n) +void PokeMod::Rules::setNumBoxes(const unsigned n) { - numPokemonBoxes = n; + numBoxes = n; } -void PokeMod::Rules::setNumPokemonPerBox(const unsigned n) +void PokeMod::Rules::setBoxSize(const unsigned b) { - numPokemonPerBox = n; + boxSize = b; } void PokeMod::Rules::setMaxParty(const unsigned m) throw(BoundsException) @@ -355,14 +355,14 @@ bool PokeMod::Rules::getNatureAllowed() const return natureAllowed; } -unsigned PokeMod::Rules::getNumPokemonBoxes() const +unsigned PokeMod::Rules::getNumBoxes() const { - return numPokemonBoxes; + return numBoxes; } -unsigned PokeMod::Rules::getNumPokemonPerBox() const +unsigned PokeMod::Rules::getBoxSize() const { - return numPokemonPerBox; + return boxSize; } unsigned PokeMod::Rules::getMaxParty() const @@ -460,8 +460,8 @@ PokeMod::Rules& PokeMod::Rules::operator=(const Rules& rhs) criticalDomains = rhs.criticalDomains; abilityAllowed = rhs.abilityAllowed; natureAllowed = rhs.natureAllowed; - numPokemonBoxes = rhs.numPokemonBoxes; - numPokemonPerBox = rhs.numPokemonPerBox; + numBoxes = rhs.numBoxes; + boxSize = rhs.boxSize; maxParty = rhs.maxParty; maxFight = rhs.maxFight; maxMoves = rhs.maxMoves; diff --git a/pokemod/Rules.h b/pokemod/Rules.h index f3447f5c..db0289b7 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -48,8 +48,8 @@ namespace PokeMod void setCriticalDomains(const bool c); void setAbilityAllowed(const bool a); void setNatureAllowed(const bool n); - void setNumPokemonBoxes(const unsigned n); - void setNumPokemonPerBox(const unsigned n); + void setNumBoxes(const unsigned n); + void setBoxSize(const unsigned b); void setMaxParty(const unsigned m) throw(BoundsException); void setMaxFight(const unsigned m) throw(BoundsException); void setMaxMoves(const unsigned m) throw(BoundsException); @@ -76,8 +76,8 @@ namespace PokeMod bool getCriticalDomains() const; bool getAbilityAllowed() const; bool getNatureAllowed() const; - unsigned getNumPokemonBoxes() const; - unsigned getNumPokemonPerBox() const; + unsigned getNumBoxes() const; + unsigned getBoxSize() const; unsigned getMaxParty() const; unsigned getMaxFight() const; unsigned getMaxMoves() const; @@ -106,8 +106,8 @@ namespace PokeMod bool criticalDomains; bool abilityAllowed; bool natureAllowed; - unsigned numPokemonBoxes; - unsigned numPokemonPerBox; + unsigned numBoxes; + unsigned boxSize; unsigned maxParty; unsigned maxFight; unsigned maxMoves; diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 55b315b9..b0c5593b 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -39,7 +39,6 @@ PokeMod::Species::Species(const Pokemod& par, const unsigned _id) : genderFactor(1, 1, true), eggSpecies(UINT_MAX), eggSteps(0), - isDitto(false), nidoranGroup(UINT_MAX) { for (unsigned i = 0; i < ST_End_GSC; ++i) @@ -95,35 +94,35 @@ bool PokeMod::Species::validate() const pokemod.validationMsg("Invalid height inches"); valid = false; } - if (!QFile::exists(QString("%1/pokemon/%2/front%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) + if (!QFile::exists(QString("%1/species/%2/front%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) { pokemod.validationMsg(QString("Cannot find the front%1 image").arg(pokemod.getRules().getGenderAllowed() ? " male" : "")); valid = false; } - if (!QFile::exists(QString("%1/pokemon/%2/back%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) + if (!QFile::exists(QString("%1/species/%2/back%3.png").arg(pokemod.getPath()).arg(name).arg(pokemod.getRules().getGenderAllowed() ? "-male" : ""))) { pokemod.validationMsg(QString("Cannot find the back%1 image").arg(pokemod.getRules().getGenderAllowed() ? " male" : "")); valid = false; } if (pokemod.getRules().getGenderAllowed()) { - if (!QFile::exists(QString("%1/pokemon/%2/front-female.png").arg(pokemod.getPath()).arg(name))) + if (!QFile::exists(QString("%1/species/%2/front-female.png").arg(pokemod.getPath()).arg(name))) { pokemod.validationMsg("Cannot find the front female image"); valid = false; } - if (!QFile::exists(QString("%1/pokemon/%2/back-female.png").arg(pokemod.getPath()).arg(name))) + if (!QFile::exists(QString("%1/species/%2/back-female.png").arg(pokemod.getPath()).arg(name))) { pokemod.validationMsg("Cannot find the back female image"); valid = false; } } - if (!QFile::exists(QString("%1/pokemon/%2/list.png").arg(pokemod.getPath()).arg(name))) + if (!QFile::exists(QString("%1/species/%2/list.png").arg(pokemod.getPath()).arg(name))) { pokemod.validationMsg("Cannot find the list sprite"); valid = false; } - if (pokemod.getSpeciesByID(eggSpecies) == UINT_MAX) + if (pokemod.getSpeciesIndex(eggSpecies) == UINT_MAX) pokemod.validationMsg("Invalid egg species", Pokemod::V_Warn); else if (!eggSteps) { @@ -134,7 +133,7 @@ bool PokeMod::Species::validate() const QMap nameChecker; for (QListIterator i(types); i.hasNext(); i.next()) { - if (pokemod.getTypeByID(i.peekNext()) == UINT_MAX) + if (pokemod.getTypeIndex(i.peekNext()) == UINT_MAX) { pokemod.validationMsg("Invalid type"); valid = false; @@ -152,7 +151,7 @@ bool PokeMod::Species::validate() const nameChecker.clear(); for (QListIterator i(eggGroups); i.hasNext(); i.next()) { - if (pokemod.getEggGroupByID(i.peekNext()) == UINT_MAX) + if (pokemod.getEggGroupIndex(i.peekNext()) == UINT_MAX) { pokemod.validationMsg("Invalid egg group"); valid = false; @@ -296,7 +295,7 @@ bool PokeMod::Species::validate() const unsigned PokeMod::Species::getNewAbilityId() const { unsigned i = 0; - for (; (i < getAbilityCount()) && (getAbilityByID(i) != UINT_MAX); ++i) + for (; (i < getAbilityCount()) && (getAbilityIndex(i) != UINT_MAX); ++i) ; return i; } @@ -304,7 +303,7 @@ unsigned PokeMod::Species::getNewAbilityId() const unsigned PokeMod::Species::getNewEvolutionId() const { unsigned i = 0; - for (; (i < getEvolutionCount()) && (getEvolutionByID(i) != UINT_MAX); ++i) + for (; (i < getEvolutionCount()) && (getEvolutionIndex(i) != UINT_MAX); ++i) ; return i; } @@ -312,7 +311,7 @@ unsigned PokeMod::Species::getNewEvolutionId() const unsigned PokeMod::Species::getNewItemId() const { unsigned i = 0; - for (; (i < getItemCount()) && (getItemByID(i) != UINT_MAX); ++i) + for (; (i < getItemCount()) && (getItemIndex(i) != UINT_MAX); ++i) ; return i; } @@ -320,7 +319,7 @@ unsigned PokeMod::Species::getNewItemId() const unsigned PokeMod::Species::getNewMoveId() const { unsigned i = 0; - for (; (i < getMoveCount()) && (getMoveByID(i) != UINT_MAX); ++i) + for (; (i < getMoveCount()) && (getMoveIndex(i) != UINT_MAX); ++i) ; return i; } @@ -358,7 +357,6 @@ void PokeMod::Species::load(const QString& fname, const unsigned _id) throw(Exce genderFactor.set(i, j, true); ini.getValue("eggSpecies", eggSpecies); ini.getValue("eggSteps", eggSteps, 0); - ini.getValue("isDitto", isDitto, false); ini.getValue("nidoranGroup", nidoranGroup); ini.getValue("numTypes", i); for (unsigned k = 0; k < i; ++k) @@ -431,7 +429,6 @@ void PokeMod::Species::save() const throw(Exception) ini.addField("genderFactor-d", genderFactor.getDenom()); ini.addField("eggSpecies", eggSpecies); ini.addField("eggSteps", eggSteps); - ini.addField("isDitto", isDitto); ini.addField("nidoranGroup", nidoranGroup); ini.addField("numTypes", types.size()); for (unsigned i = 0; i < unsigned(types.size()); ++i) @@ -613,7 +610,7 @@ void PokeMod::Species::setGenderFactorDenom(const unsigned d) throw(Exception) void PokeMod::Species::setEggSpecies(const unsigned e) throw(BoundsException) { - if (pokemod.getSpeciesByID(e) == UINT_MAX) + if (pokemod.getSpeciesIndex(e) == UINT_MAX) throw(BoundsException("Species", "eggSpecies")); eggSpecies = e; } @@ -623,11 +620,6 @@ void PokeMod::Species::setEggSteps(const unsigned e) eggSteps = e; } -void PokeMod::Species::setIsDitto(const bool i) -{ - isDitto = i; -} - void PokeMod::Species::setNidoranGroup(const unsigned n) { nidoranGroup = n; @@ -635,6 +627,8 @@ void PokeMod::Species::setNidoranGroup(const unsigned n) void PokeMod::Species::setType(const unsigned ty, const bool t) throw(Exception) { + if (pokemod.getTypeIndex(ty) == UINT_MAX) + throw(BoundsException("Species", "type")); for (QMutableListIterator i(types); i.hasNext(); ) { if (i.next() == ty) @@ -652,6 +646,8 @@ void PokeMod::Species::setType(const unsigned ty, const bool t) throw(Exception) void PokeMod::Species::setEggGroup(const unsigned eg, const bool e) throw(Exception) { + if (pokemod.getEggGroupIndex(eg) == UINT_MAX) + throw(BoundsException("Species", "eggGroup")); for (QMutableListIterator i(eggGroups); i.hasNext(); ) { if (i.next() == eg) @@ -751,11 +747,6 @@ unsigned PokeMod::Species::getEggSteps() const return eggSteps; } -bool PokeMod::Species::getIsDitto() const -{ - return isDitto; -} - unsigned PokeMod::Species::getNidoranGroup() const { return nidoranGroup; @@ -795,7 +786,17 @@ PokeMod::SpeciesAbility& PokeMod::Species::getAbility(const unsigned i) throw(In return abilities[i]; } -unsigned PokeMod::Species::getAbilityByID(const unsigned _id) const +const PokeMod::SpeciesAbility& PokeMod::Species::getAbilityByID(const unsigned i) const throw(IndexException) +{ + return getAbility(getAbilityIndex(i)); +} + +PokeMod::SpeciesAbility& PokeMod::Species::getAbilityByID(const unsigned i) throw(IndexException) +{ + return getAbility(getAbilityIndex(i)); +} + +unsigned PokeMod::Species::getAbilityIndex(const unsigned _id) const { for (unsigned i = 0; i < getAbilityCount(); ++i) { @@ -849,7 +850,17 @@ PokeMod::SpeciesEvolution& PokeMod::Species::getEvolution(const unsigned i) thro return evolutions[i]; } -unsigned PokeMod::Species::getEvolutionByID(const unsigned _id) const +const PokeMod::SpeciesEvolution& PokeMod::Species::getEvolutionByID(const unsigned i) const throw(IndexException) +{ + return getEvolution(getEvolutionIndex(i)); +} + +PokeMod::SpeciesEvolution& PokeMod::Species::getEvolutionByID(const unsigned i) throw(IndexException) +{ + return getEvolution(getEvolutionIndex(i)); +} + +unsigned PokeMod::Species::getEvolutionIndex(const unsigned _id) const { for (unsigned i = 0; i < getEvolutionCount(); ++i) { @@ -903,7 +914,17 @@ PokeMod::SpeciesItem& PokeMod::Species::getItem(const unsigned i) throw(IndexExc return items[i]; } -unsigned PokeMod::Species::getItemByID(const unsigned _id) const +const PokeMod::SpeciesItem& PokeMod::Species::getItemByID(const unsigned i) const throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +PokeMod::SpeciesItem& PokeMod::Species::getItemByID(const unsigned i) throw(IndexException) +{ + return getItem(getItemIndex(i)); +} + +unsigned PokeMod::Species::getItemIndex(const unsigned _id) const { for (unsigned i = 0; i < getItemCount(); ++i) { @@ -957,7 +978,17 @@ PokeMod::SpeciesMove& PokeMod::Species::getMove(const unsigned i) throw(IndexExc return moves[i]; } -unsigned PokeMod::Species::getMoveByID(const unsigned _id) const +const PokeMod::SpeciesMove& PokeMod::Species::getMoveByID(const unsigned i) const throw(IndexException) +{ + return getMove(getMoveIndex(i)); +} + +PokeMod::SpeciesMove& PokeMod::Species::getMoveByID(const unsigned i) throw(IndexException) +{ + return getMove(getMoveIndex(i)); +} + +unsigned PokeMod::Species::getMoveIndex(const unsigned _id) const { for (unsigned i = 0; i < getMoveCount(); ++i) { @@ -1020,7 +1051,6 @@ PokeMod::Species& PokeMod::Species::operator=(const Species& rhs) genderFactor = rhs.genderFactor; eggSpecies = rhs.eggSpecies; eggSteps = rhs.eggSteps; - isDitto = rhs.isDitto; nidoranGroup = rhs.nidoranGroup; types = rhs.types; eggGroups = rhs.eggGroups; diff --git a/pokemod/Species.h b/pokemod/Species.h index b199896d..2da580a7 100644 --- a/pokemod/Species.h +++ b/pokemod/Species.h @@ -91,7 +91,6 @@ namespace PokeMod void setGenderFactorDenom(const unsigned d) throw(Exception); void setEggSpecies(const unsigned e) throw(BoundsException); void setEggSteps(const unsigned e); - void setIsDitto(const bool i); void setNidoranGroup(const unsigned n); void setType(const unsigned ty, const bool t) throw(Exception); void setEggGroup(const unsigned eg, const bool e) throw(Exception); @@ -117,14 +116,15 @@ namespace PokeMod Frac getGenderFactor() const; unsigned getEggSpecies() const; unsigned getEggSteps() const; - bool getIsDitto() const; unsigned getNidoranGroup() const; bool getType(const unsigned ty) const; bool getEggGroup(const unsigned eg) const; const SpeciesAbility& getAbility(const unsigned i) const throw(IndexException); SpeciesAbility& getAbility(const unsigned i) throw(IndexException); - unsigned getAbilityByID(const unsigned _id) const; + const SpeciesAbility& getAbilityByID(const unsigned i) const throw(IndexException); + SpeciesAbility& getAbilityByID(const unsigned i) throw(IndexException); + unsigned getAbilityIndex(const unsigned _id) const; unsigned getAbilityCount() const; SpeciesAbility& newAbility(); SpeciesAbility& newAbility(const QString& fname); @@ -133,7 +133,9 @@ namespace PokeMod const SpeciesEvolution& getEvolution(const unsigned i) const throw(IndexException); SpeciesEvolution& getEvolution(const unsigned i) throw(IndexException); - unsigned getEvolutionByID(const unsigned _id) const; + const SpeciesEvolution& getEvolutionByID(const unsigned i) const throw(IndexException); + SpeciesEvolution& getEvolutionByID(const unsigned i) throw(IndexException); + unsigned getEvolutionIndex(const unsigned _id) const; unsigned getEvolutionCount() const; SpeciesEvolution& newEvolution(); SpeciesEvolution& newEvolution(const QString& fname); @@ -142,7 +144,9 @@ namespace PokeMod const SpeciesItem& getItem(const unsigned i) const throw(IndexException); SpeciesItem& getItem(const unsigned i) throw(IndexException); - unsigned getItemByID(const unsigned _id) const; + const SpeciesItem& getItemByID(const unsigned i) const throw(IndexException); + SpeciesItem& getItemByID(const unsigned i) throw(IndexException); + unsigned getItemIndex(const unsigned _id) const; unsigned getItemCount() const; SpeciesItem& newItem(); SpeciesItem& newItem(const QString& fname); @@ -151,7 +155,9 @@ namespace PokeMod const SpeciesMove& getMove(const unsigned i) const throw(IndexException); SpeciesMove& getMove(const unsigned i) throw(IndexException); - unsigned getMoveByID(const unsigned _id) const; + const SpeciesMove& getMoveByID(const unsigned i) const throw(IndexException); + SpeciesMove& getMoveByID(const unsigned i) throw(IndexException); + unsigned getMoveIndex(const unsigned _id) const; unsigned getMoveCount() const; SpeciesMove& newMove(); SpeciesMove& newMove(const QString& fname); @@ -182,7 +188,6 @@ namespace PokeMod Frac genderFactor; unsigned eggSpecies; unsigned eggSteps; - bool isDitto; unsigned nidoranGroup; QList types; QList eggGroups; diff --git a/pokemod/SpeciesAbility.cpp b/pokemod/SpeciesAbility.cpp index f6dfc1eb..6728c1b0 100644 --- a/pokemod/SpeciesAbility.cpp +++ b/pokemod/SpeciesAbility.cpp @@ -45,7 +45,7 @@ bool PokeMod::SpeciesAbility::validate() const { bool valid = true; pokemod.validationMsg(QString("------Ability with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getAbilityByID(ability) == UINT_MAX) + if (pokemod.getAbilityIndex(ability) == UINT_MAX) { pokemod.validationMsg("Invalid ability"); valid = false; @@ -80,7 +80,7 @@ void PokeMod::SpeciesAbility::save(const QString& species) const throw(Exception void PokeMod::SpeciesAbility::setAbility(const unsigned a) throw(BoundsException) { - if (pokemod.getAbilityByID(a) == UINT_MAX) + if (pokemod.getAbilityIndex(a) == UINT_MAX) throw(BoundsException("SpeciesAbility", "ability")); ability = a; } diff --git a/pokemod/SpeciesAbility.h b/pokemod/SpeciesAbility.h index 0c424f49..6fbfcbb9 100644 --- a/pokemod/SpeciesAbility.h +++ b/pokemod/SpeciesAbility.h @@ -11,7 +11,7 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// This program is distributPokemoned in the hope that it will be useful, +// 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. diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp index b41f82fc..36e81686 100644 --- a/pokemod/SpeciesEvolution.cpp +++ b/pokemod/SpeciesEvolution.cpp @@ -52,7 +52,7 @@ bool PokeMod::SpeciesEvolution::validate() const { bool valid = true; pokemod.validationMsg(QString("------Evolution with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getSpeciesByID(species) == UINT_MAX) + if (pokemod.getSpeciesIndex(species) == UINT_MAX) { pokemod.validationMsg("Invalid species"); valid = false; @@ -69,13 +69,13 @@ bool PokeMod::SpeciesEvolution::validate() const break; case S_Item: case S_TradeItem: - if (pokemod.getItemByID(val1) == UINT_MAX) + if (pokemod.getItemIndex(val1) == UINT_MAX) ok = false; else { - for (unsigned i = 0; (i < pokemod.getItem(pokemod.getItemByID(val1)).getEffectCount()) && !ok; ++i) + for (unsigned i = 0; (i < pokemod.getItem(pokemod.getItemIndex(val1)).getEffectCount()) && !ok; ++i) { - if (pokemod.getItem(pokemod.getItemByID(val1)).getEffect(i).getEffect() == ItemEffect::E_Evolution) + if (pokemod.getItem(pokemod.getItemIndex(val1)).getEffect(i).getEffect() == ItemEffect::E_Evolution) ok = true; } } @@ -156,7 +156,7 @@ void PokeMod::SpeciesEvolution::save(const QString& species) const throw(Excepti void PokeMod::SpeciesEvolution::setSpecies(const unsigned s) throw(BoundsException) { - if (pokemod.getSpeciesByID(s) == UINT_MAX) + if (pokemod.getSpeciesIndex(s) == UINT_MAX) throw(BoundsException("SpeciesEvolution", "species")); species = s; } @@ -182,11 +182,11 @@ void PokeMod::SpeciesEvolution::setVal1(const unsigned v1) throw(Exception) break; case S_Item: case S_TradeItem: - if (pokemod.getItemByID(val1) == UINT_MAX) + if (pokemod.getItemIndex(val1) == UINT_MAX) throw(BoundsException("SpeciesEvolution", "val1")); - for (unsigned i = 0; (i < pokemod.getItem(pokemod.getItemByID(val1)).getEffectCount()) && !ok; ++i) + for (unsigned i = 0; (i < pokemod.getItem(pokemod.getItemIndex(val1)).getEffectCount()) && !ok; ++i) { - if (pokemod.getItem(pokemod.getItemByID(val1)).getEffect(i).getEffect() == ItemEffect::E_Evolution) + if (pokemod.getItem(pokemod.getItemIndex(val1)).getEffect(i).getEffect() == ItemEffect::E_Evolution) ok = true; } if (!ok) diff --git a/pokemod/SpeciesItem.cpp b/pokemod/SpeciesItem.cpp index 4d132670..ebd20187 100644 --- a/pokemod/SpeciesItem.cpp +++ b/pokemod/SpeciesItem.cpp @@ -45,7 +45,7 @@ bool PokeMod::SpeciesItem::validate() const { bool valid = true; pokemod.validationMsg(QString("------Item with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getItemByID(item) == UINT_MAX) + if (pokemod.getItemIndex(item) == UINT_MAX) { pokemod.validationMsg("Invalid item"); valid = false; @@ -80,7 +80,7 @@ void PokeMod::SpeciesItem::save(const QString& species) const throw(Exception) void PokeMod::SpeciesItem::setItem(const unsigned i) throw(BoundsException) { - if (pokemod.getItemByID(i) == UINT_MAX) + if (pokemod.getItemIndex(i) == UINT_MAX) throw(BoundsException("SpeciesItem", "item")); item = i; } diff --git a/pokemod/SpeciesItem.h b/pokemod/SpeciesItem.h index 9fa9fda8..532e4730 100644 --- a/pokemod/SpeciesItem.h +++ b/pokemod/SpeciesItem.h @@ -3,7 +3,7 @@ // Purpose: Define an item that a species can be found with in the wild // Author: Ben Boeckel // Modified by: Ben Boeckel -// Created: Tue Mar 20 18:40:28 2007Pokémon +// Created: Tue Mar 20 18:40:28 2007 // Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions // Licence: // This program is free software: you can redistribute it and/or modify diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp index 36606966..d7e0ad2e 100644 --- a/pokemod/SpeciesMove.cpp +++ b/pokemod/SpeciesMove.cpp @@ -46,7 +46,7 @@ bool PokeMod::SpeciesMove::validate() const { bool valid = true; pokemod.validationMsg(QString("------Move with id %1---").arg(id), Pokemod::V_Msg); - if (pokemod.getMoveByID(move) == UINT_MAX) + if (pokemod.getMoveIndex(move) == UINT_MAX) { pokemod.validationMsg("Invalid move"); valid = false; @@ -88,7 +88,7 @@ void PokeMod::SpeciesMove::save(const QString& species) const throw(Exception) void PokeMod::SpeciesMove::setMove(const unsigned m) throw(BoundsException) { - if (pokemod.getMoveByID(m) == UINT_MAX) + if (pokemod.getMoveIndex(m) == UINT_MAX) throw(BoundsException("SpeciesMove", "move")); move = m; } diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp index 626b249d..ab20947b 100644 --- a/pokemod/Store.cpp +++ b/pokemod/Store.cpp @@ -57,7 +57,7 @@ bool PokeMod::Store::validate() const QMap nameChecker; for (QListIterator i(items); i.hasNext(); i.next()) { - if (pokemod.getItemByID(i.peekNext()) == UINT_MAX) + if (pokemod.getItemIndex(i.peekNext()) == UINT_MAX) { pokemod.validationMsg("Invalid item"); valid = false; @@ -113,6 +113,8 @@ void PokeMod::Store::setName(const QString& n) void PokeMod::Store::setItem(const unsigned itm, const bool it) throw(Exception) { + if (pokemod.getItemIndex(itm) == UINT_MAX) + throw(BoundsException("Store", "item")); for (QMutableListIterator i(items); i.hasNext(); ) { if (i.next() == itm) @@ -133,11 +135,11 @@ QString PokeMod::Store::getName() const return name; } -bool PokeMod::Store::getItem(const unsigned it) const +bool PokeMod::Store::getItem(const unsigned itm) const { for (QListIterator i(items); i.hasNext(); ) { - if (i.next() == it) + if (i.next() == itm) return true; } return false; diff --git a/pokemod/TODO b/pokemod/TODO index 4cc23837..82f9633f 100644 --- a/pokemod/TODO +++ b/pokemod/TODO @@ -5,7 +5,7 @@ Urgent --------------- Effect Switches --------------- -MoveEffect +MoveEffects ------------------ PokéMod comparison diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index 60486b9f..7d941bf6 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -72,12 +72,12 @@ bool PokeMod::Tile::validate() const pokemod.validationMsg("A waterfall tile must be accessible from above and below"); valid = false; } - else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileByID(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileByID(under)).getHMType() != H_Surf) || (pokemod.getTile(pokemod.getTileByID(under)).getHMType() != H_Dive))) + else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_Surf) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_Dive))) { pokemod.validationMsg("Invalid under tile"); valid = false; } - else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileByID(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileByID(under)).getHMType() != H_None))) + else if ((hmType == H_Whirlpool) && ((under == id) || (pokemod.getTileIndex(under) == UINT_MAX) || (pokemod.getTile(pokemod.getTileIndex(under)).getHMType() != H_None))) { pokemod.validationMsg("Invalid under tile"); valid = false; @@ -192,7 +192,7 @@ void PokeMod::Tile::setUnder(const unsigned u) throw(Exception) { if ((hmType != H_Whirlpool) || (hmType != H_Cut) || (hmType != H_RockSmash)) throw(UnusedException("Tile", "under")); - if ((u == id) || (pokemod.getTileByID(u) == UINT_MAX)) + if ((u == id) || (pokemod.getTileIndex(u) == UINT_MAX)) throw(BoundsException("Tile", "under")); under = u; } diff --git a/pokemod/Type.h b/pokemod/Type.h index 2cf62e16..6195c80a 100644 --- a/pokemod/Type.h +++ b/pokemod/Type.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: pokemod/Type.h -// Purpose: Define a type for a Pokémon +// Purpose: Define a type for species and moves // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Tue Mar 20 18:05:05 2007 diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro index 44cd6041..0d927da4 100644 --- a/pokemod/pokemod.pro +++ b/pokemod/pokemod.pro @@ -3,7 +3,7 @@ DESTDIR = ../../lib TEMPLATE = lib LIBS += -L../../lib -lgeneral -CONFIG += qt warn_on dll +CONFIG += qt warn_on dll -SOURCES += *.cpp -HEADERS += *.h +SOURCES += *.cpp +HEADERS += *.h diff --git a/pokemod/pokemod_inc.h b/pokemod/pokemod_inc.h index 3923f2e5..202972fb 100644 --- a/pokemod/pokemod_inc.h +++ b/pokemod/pokemod_inc.h @@ -39,10 +39,10 @@ namespace PokeMod class Map; class MapEffect; class MapTrainer; - class MapTrainerPokemon; + class MapTrainerTeamMember; class MapWarp; class MapWildList; - class MapWildListPokemon; + class MapWildListEncounter; class Move; class MoveEffect; class Nature; diff --git a/pokemodr/gui/ability.ui b/pokemodr/gui/ability.ui index 94648215..539b2e72 100644 --- a/pokemodr/gui/ability.ui +++ b/pokemodr/gui/ability.ui @@ -1,40 +1,55 @@ - panelAbility - + formAbility + 0 0 - 92 - 95 + 201 + 179 - + + + + - + - Name + &Apply + + + Ctrl+Return - - - Qt::Horizontal + + + &Discard - - - 20 - 40 - + + Esc - + + + + + + + + Name + + + + Name of the ability + true @@ -64,6 +79,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/abilityeffect.ui b/pokemodr/gui/abilityeffect.ui index cbc22ca1..c9826b23 100644 --- a/pokemodr/gui/abilityeffect.ui +++ b/pokemodr/gui/abilityeffect.ui @@ -1,21 +1,78 @@ - panelAbilityEffect - + formAbilityEffect + 0 0 244 - 658 + 922 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + Chance - + + + + + Chance the effect is activated + + + + + + + Numerator + + + 0 + + + + + + + Denominator + + + 1 + + + + @@ -25,7 +82,17 @@ - + + + Effect the ability has + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -34,7 +101,17 @@ - + + + Value 1 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -46,7 +123,17 @@ - + + + Value 2 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -59,6 +146,9 @@ + + Value 3 + 0 @@ -77,7 +167,17 @@ - + + + What triggers the effect to happen + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -86,7 +186,17 @@ - + + + Trigger value 1 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -99,6 +209,9 @@ + + Trigger value 2 + true @@ -161,6 +274,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/author.ui b/pokemodr/gui/author.ui index 814f5865..33cfee23 100644 --- a/pokemodr/gui/author.ui +++ b/pokemodr/gui/author.ui @@ -1,15 +1,44 @@ - panelAuthor - + formAuthor + 0 0 - 80 - 236 + 191 + 311 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of an author of the PokéMod + true @@ -34,6 +66,9 @@ + + Email address of the author + true @@ -50,6 +85,9 @@ + + What the author did + true @@ -79,6 +117,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/badge.ui b/pokemodr/gui/badge.ui index 8dc6a455..7c3da553 100644 --- a/pokemodr/gui/badge.ui +++ b/pokemodr/gui/badge.ui @@ -1,15 +1,44 @@ - panelBadge - + formBadge + 0 0 - 226 - 534 + 244 + 720 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + The name of the badge + true @@ -34,6 +66,9 @@ + + The maximum level where the player will always be obeyed + 0 @@ -43,48 +78,120 @@ - + - Stat + Images - + + + + 0 + 0 + + + + + 64 + 64 + + + + + 64 + 64 + + + + The face displayed when the badge has not been earned + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + 64 + 64 + + + + The badge + + - + - Multiplier + Stat - - - true + + + The stat the badge boosts - - - - - - Numerator + + QComboBox::NoInsert - - 0 + + QComboBox::AdjustToContents - - - Denominator - - - 1 + + + Multiplier + + + + + The multiplier the badge gives to the stat (internal battles only) + + + true + + + + + + + Numerator + + + 0 + + + + + + + Denominator + + + 1 + + + + @@ -104,6 +211,9 @@ 75 + + The list of HMs the badge allows to be used in the overworld + true @@ -146,6 +256,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/coinlist.ui b/pokemodr/gui/coinlist.ui index 36093592..a06e49a5 100644 --- a/pokemodr/gui/coinlist.ui +++ b/pokemodr/gui/coinlist.ui @@ -1,15 +1,44 @@ - panelCoinList - + formCoinList + 0 0 - 134 - 161 + 226 + 238 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the coin list + true @@ -33,7 +65,14 @@ - + + + Type of coin needed + + + 0 + + @@ -64,6 +103,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/coinlistobject.ui b/pokemodr/gui/coinlistobject.ui index 08e9490a..01f60892 100644 --- a/pokemodr/gui/coinlistobject.ui +++ b/pokemodr/gui/coinlistobject.ui @@ -1,35 +1,84 @@ - panelCoinListObject - + formCoinListObject + 0 0 226 - 318 + 393 - + - Type + - + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + - + - Object + Type - + - + + + Type of object + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Object + + + + + + Object to be sold + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + @@ -42,6 +91,9 @@ + + How many are sold + 1 @@ -58,6 +110,9 @@ + + How much the object(s) cost + 0 @@ -73,8 +128,8 @@
- 20 - 40 + 218 + 16 @@ -92,6 +147,11 @@ QWidget
knuminput.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/dialog.ui b/pokemodr/gui/dialog.ui index ad5e778b..69c6dbdb 100644 --- a/pokemodr/gui/dialog.ui +++ b/pokemodr/gui/dialog.ui @@ -1,15 +1,44 @@ - panelDialog - + formDialog + 0 0 - 109 - 189 + 191 + 264 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -17,7 +46,11 @@ - + + + Dialog text and commands + + @@ -29,7 +62,17 @@ - + + + Insert a command into the dialog + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -55,6 +98,11 @@ QComboBox
kcombobox.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
KTextEdit QTextEdit diff --git a/pokemodr/gui/egggroup.ui b/pokemodr/gui/egggroup.ui index 6c940215..cc0d7f6d 100644 --- a/pokemodr/gui/egggroup.ui +++ b/pokemodr/gui/egggroup.ui @@ -1,15 +1,44 @@ - panelEggGroup - + formEggGroup + 0 0 - 80 - 84 + 191 + 159 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the egg group + true @@ -47,6 +79,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/item.ui b/pokemodr/gui/item.ui index d52f421f..f51c5daa 100644 --- a/pokemodr/gui/item.ui +++ b/pokemodr/gui/item.ui @@ -1,15 +1,44 @@ - panelItem - + formItem + 0 0 226 - 391 + 466 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the item + true @@ -28,6 +60,9 @@ + + Whether the item is sellable at a store or not + Sellable @@ -44,7 +79,17 @@ - + + + Type of item + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -57,6 +102,9 @@ + + Price of the item at the store (resell value is 50%; 25% for "Hard Cash" mode) + 0 @@ -72,7 +120,11 @@ - + + + Description of the item + + @@ -108,6 +160,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
KTextEdit QTextEdit diff --git a/pokemodr/gui/itemeffect.ui b/pokemodr/gui/itemeffect.ui index da017c62..99fa3b4b 100644 --- a/pokemodr/gui/itemeffect.ui +++ b/pokemodr/gui/itemeffect.ui @@ -1,55 +1,81 @@ - panelItemEffect - + formItemEffect + 0 0 - 152 - 598 + 244 + 704 - + - Overworld + - - true - - - false - - - - - - - - Battle - - - true - - - false - - + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + - + - Held - - - true + Flags - - false - - + + + + + If checked, effect only works in the overworld + + + Overworld + + + + + + + If checked, effect only works in battle + + + Battle + + + + + + + If checked, effect only works when item is being held + + + Held + + + + @@ -59,7 +85,17 @@ - + + + Effect + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -68,7 +104,14 @@ - + + + Value 1 + + + 0 + + @@ -80,7 +123,17 @@ - + + + Value 2 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -92,7 +145,17 @@ - + + + Value 3 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -105,6 +168,9 @@ + + Value 4 + true @@ -167,6 +233,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/itemtype.ui b/pokemodr/gui/itemtype.ui index 408cdd33..4ba1eb4a 100644 --- a/pokemodr/gui/itemtype.ui +++ b/pokemodr/gui/itemtype.ui @@ -1,15 +1,44 @@ - panelItemType - + formItemType + 0 0 226 - 242 + 317 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the item type + false @@ -37,6 +69,9 @@ + + How many of the items can be stored on the computer system + 0 @@ -53,6 +88,9 @@ + + How many of the item the player can carry + 1 @@ -87,6 +125,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/map.ui b/pokemodr/gui/map.ui index d9c7bb3c..beebbfd3 100644 --- a/pokemodr/gui/map.ui +++ b/pokemodr/gui/map.ui @@ -1,32 +1,57 @@ - panelMap - + formMap + 0 0 - 109 - 236 + 191 + 311 - + - Name + - - - true + + + &Apply + + + Ctrl+Return - + - + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the map + + + true @@ -38,9 +63,25 @@ Fly Warp + + true + + + false + - + + + The destination when flown to the map + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -52,7 +93,17 @@
- + + + They type of map + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + +
@@ -83,6 +134,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/mapeffect.ui b/pokemodr/gui/mapeffect.ui index 438d22d7..9242fd38 100644 --- a/pokemodr/gui/mapeffect.ui +++ b/pokemodr/gui/mapeffect.ui @@ -1,15 +1,44 @@ - panelMapEffect - + formMapEffect + 0 0 290 - 969 + 1047 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the effect + true @@ -37,6 +69,9 @@ + + x coordinate of the effect + x @@ -47,6 +82,9 @@ + + y coordinate of the effect + y @@ -66,6 +104,9 @@ + + flag which determines if the effect is on the overworld + @@ -76,6 +117,9 @@ + + Whether the flag has to be on, off, or is ignored + State @@ -107,6 +151,9 @@ 128 + + Skin of the effect + @@ -120,6 +167,9 @@ + + The effect the effect has + QComboBox::NoInsert @@ -139,6 +189,9 @@ + + Value 1 + QComboBox::NoInsert @@ -161,6 +214,9 @@ + + Value 2 + QComboBox::NoInsert @@ -186,6 +242,9 @@ + + The direction the effect faces + QComboBox::NoInsert @@ -201,31 +260,32 @@ - - - Ghost - - - true - - - false - - - - - - + - Movable - - - true - - - false + Flags - + + + + + If checked, the effect is able to be walked through + + + Ghost + + + + + + + If checked, the effect will move around the map randomly + + + Movable + + + + @@ -235,7 +295,17 @@ - + + + The dialog to use when talked to + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -271,6 +341,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/maptrainer.ui b/pokemodr/gui/maptrainer.ui new file mode 100644 index 00000000..a1b72fa2 --- /dev/null +++ b/pokemodr/gui/maptrainer.ui @@ -0,0 +1,383 @@ + + Form + + + + 0 + 0 + 290 + 1227 + + + + Form + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the trainer + + + true + + + + + + + + + + Coordinate + + + + + + x coordinate of the trainer + + + x + + + 0 + + + + + + + y coordinate of the trainer + + + y + + + 0 + + + + + + + + + + Skin + + + false + + + + + + + 0 + 0 + + + + + 192 + 128 + + + + + 192 + 128 + + + + Skin of the trainer + + + + + + + + + + Sight + + + + + + How far the trainer can see + + + 0 + + + + + + + + + + Direction + + + + + + Direction the trainer faces + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Number Fight + + + + + + How many team members from each side fight at a time + + + 0 + + + + + + + + + + AI + + + + + + The AI scheme used + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Appear Flag + + + + + + The flag that determines if the trainer is on the map or not + + + 0 + + + + + + + Whether the flag has to be on, off, or is ignored + + + State + + + + + + + + + + Dialogs + + + + + + Overworld + + + + + + The dialog used when talked to in the overworld + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Lose + + + + + + The dialog used when the trainer loses + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Win + + + + + + The dialog used when the trainer wins + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + + + + Lead Team Member + + + + + + The lead team member + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Qt::Vertical + + + + 282 + 16 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/maptrainerteammember.ui b/pokemodr/gui/maptrainerteammember.ui new file mode 100644 index 00000000..646d1c4f --- /dev/null +++ b/pokemodr/gui/maptrainerteammember.ui @@ -0,0 +1,160 @@ + + forMapTrainerTeamMember + + + + 0 + 0 + 226 + 419 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Species + + + + + + Species of the team member + + + + + + + + + + Level + + + + + + Level + + + 1 + + + + + + + + + + Nature + + + + + + Nature the team member has + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Items + + + + + + Items held + + + QAbstractItemView::ExtendedSelection + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KListWidget + QListWidget +
klistwidget.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/mapwarp.ui b/pokemodr/gui/mapwarp.ui new file mode 100644 index 00000000..cd88416e --- /dev/null +++ b/pokemodr/gui/mapwarp.ui @@ -0,0 +1,368 @@ + + Form + + + + 0 + 0 + 290 + 1051 + + + + Form + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the warp + + + true + + + + + + + + + + Coordinate + + + + + + x coordinate of the warp + + + x + + + 0 + + + + + + + y coordinate of the warp + + + y + + + 0 + + + + + + + + + + Activation + + + + + + Directions, that when walked into FROM, the warp is activated + + + + + + + + + + Direction Out + + + + + + Direction the warp pushes things when arrived at + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Type + + + + + + The type of warp + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Flags + + + + + + Whether to force, allow, of disable biking when going through + + + Biking + + + true + + + + + + + Whether to force, allow, of disable darkness when going through + + + Flash + + + true + + + + + + + Whether to force, allow, of disable fog when going through + + + Fog + + + true + + + + + + + + + + Destination + + + + + + Map + + + + + + Map the warp goes to + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Warp + + + + + + Warp on the map the warp goes to + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + + + + Flag + + + + + + The flag that determines if the warp works or not + + + 0 + + + + + + + Whether the flag must be on, off, or it is ignored + + + State + + + + + + + + + + Dialog + + + + + + The dialog to parse when the warp is activated + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Qt::Vertical + + + + 20 + 16 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KListWidget + QListWidget +
klistwidget.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/mapwildlist.ui b/pokemodr/gui/mapwildlist.ui new file mode 100644 index 00000000..f95b1178 --- /dev/null +++ b/pokemodr/gui/mapwildlist.ui @@ -0,0 +1,157 @@ + + formMapWildList + + + + 0 + 0 + 244 + 400 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Control + + + + + + Type of wild list + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Value of the controlling factor + + + Value + + + 0 + + + + + + + + + + Times + + + + + + Times when the list is active + + + QAbstractItemView::ExtendedSelection + + + + + + + + + + Scope + + + + + + Scope needed to see encounters (-1 for none) + + + -1 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KListWidget + QListWidget +
klistwidget.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/mapwildlistencounter.ui b/pokemodr/gui/mapwildlistencounter.ui new file mode 100644 index 00000000..4af39f15 --- /dev/null +++ b/pokemodr/gui/mapwildlistencounter.ui @@ -0,0 +1,139 @@ + + formMapWildListEncounter + + + + 0 + 0 + 226 + 317 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Species + + + + + + Species of the encounter + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Level + + + + + + Level of the encounter + + + 0 + + + + + + + + + + Weight + + + + + + Weighting + + + 1 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/move.ui b/pokemodr/gui/move.ui new file mode 100644 index 00000000..6ae05ab9 --- /dev/null +++ b/pokemodr/gui/move.ui @@ -0,0 +1,337 @@ + + formMove + + + + 0 + 0 + 244 + 1124 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the move + + + true + + + + + + + + + + Accuracy + + + + + + Chance the move hits + + + true + + + + + + + Numerator + + + 0 + + + + + + + Denominator + + + 1 + + + + + + + + + + Power + + + + + + The power of the move + + + 0 + + + + + + + + + + Type + + + + + + The type of the move + + + + + + + + + + Power Points + + + + + + How many power points the move has + + + 1 + + + + + + + + + + Target + + + + + + The target of the move + + + + + + + Target Choice + + + + + + Whose choice the target is + + + + + + + + + + NumTargets + + + + + + The number of targets + + + 0 + + + + + + + + + + + + + Flags + + + + + + If checked, the move uses the Special stat(s) rather than the physical + + + Special + + + + + + + If checked, the move ignores any accuracy-affecting items the enemy may be holding + + + Ignore Accuracy + + + + + + + If checked, the move can make the target flinch with items + + + Can Flinch + + + + + + + If checked, Metronome-like moves can use this move + + + Randomizable + + + + + + + If checked, the effects can be stolen + + + Can Snatch + + + + + + + If checked, the move makes sound + + + Makes Sound + + + + + + + + + + Description + + + + + + Description of the move + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+ + KTextEdit + QTextEdit +
ktextedit.h
+
+
+ + +
diff --git a/pokemodr/gui/nature.ui b/pokemodr/gui/nature.ui new file mode 100644 index 00000000..5fd54691 --- /dev/null +++ b/pokemodr/gui/nature.ui @@ -0,0 +1,180 @@ + + formNature + + + + 0 + 0 + 244 + 504 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the nature + + + + + + + + + + Stat + + + + + + Stat the nature affects + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Multiplier + + + + + + Stat multiplier + + + true + + + + + + + Numerator + + + 0 + + + + + + + Denominator + + + 1 + + + + + + + + + + + + + Weight + + + + + + Weighting + + + 1 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui index 1d512ad3..86becf1b 100644 --- a/pokemodr/gui/pokemod.ui +++ b/pokemodr/gui/pokemod.ui @@ -1,15 +1,44 @@ - panelInfo - + formPokemod + 0 0 244 - 925 + 687 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -17,7 +46,10 @@ - + + + The title of the PokéMod + true @@ -33,7 +65,10 @@ - + + + PokéMod version + true @@ -49,92 +84,56 @@ - + + + Description of the PokéMod + + - + - Initial Conditions + Start Position - - - Map + + + Map the player starts on - - - - - - - - - - - Coordinates + + QComboBox::NoInsert - - - - - 0 - - - - - - - 0 - - - - - - - - - - Direction + + QComboBox::AdjustToContents - - - - - - + - Money + Warp - - - 0 + + + Warp the player starts on + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents - - - - Dialog - - - - - - - - @@ -151,7 +150,10 @@ - + + + Username to access the Super PC + true @@ -167,7 +169,10 @@ - + + + Password to access the Super PC + true @@ -200,16 +205,16 @@ QComboBox
kcombobox.h
- - KIntNumInput - QWidget -
knuminput.h
-
KLineEdit QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
KTextEdit QTextEdit diff --git a/pokemodr/gui/rules.ui b/pokemodr/gui/rules.ui index 07f2bc0b..473ec1a6 100644 --- a/pokemodr/gui/rules.ui +++ b/pokemodr/gui/rules.ui @@ -1,27 +1,59 @@ - panelRules - + formRules + 0 0 418 - 764 + 847 - + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + 2 - + General + + If checked, species will be able to have male and female counterparts + Genders @@ -35,10 +67,10 @@ - If checked, Pokémon are allowed to have genders + If checked, breeding will be enabled - If checked, Pokémon are allowed to have genders + Breeding @@ -56,6 +88,9 @@ + + How many items can be held at once + @@ -69,6 +104,9 @@ + + If checked, critical hit chances will be determined by generation II and newer formulas + Critical Domains @@ -83,6 +121,9 @@ + + If checked, abilities will be enabled + Abilities @@ -97,6 +138,9 @@ + + If checked, natures will be enabled + Natures @@ -124,7 +168,7 @@ - + Storage @@ -132,13 +176,16 @@ - Pokémon Storage + Storage - + + + How many boxes on the computer will be available + - Pokémon Boxes + Boxes 0 @@ -148,7 +195,7 @@ - Pokémon Per Box + Box Size 1 @@ -166,6 +213,9 @@ + + The size of the largest party possible + @@ -185,6 +235,9 @@ + + Maximum amount of team members active at one time per side + @@ -204,6 +257,9 @@ + + Maximum amount of knowable moves + @@ -223,6 +279,9 @@ + + Maximum level allowed + @@ -236,11 +295,17 @@ + + Max Money + + + Maximum amount of money allowed + - Max Money + 1 @@ -252,6 +317,9 @@ + + If checked, money will be harder to come across (only check for challenge games) + Hard Cash @@ -279,13 +347,16 @@ - + Stats + + If checked, the special stat will be split into separate attack and defense stats + Split Special @@ -298,6 +369,9 @@ + + If checked, the each special stat will have their own DV + Split Special DV @@ -313,13 +387,26 @@ - + + + The highest a DV may be + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + If checked, happiness will be enabled + Happiness @@ -332,6 +419,9 @@ + + How many happiness points are lost when fainting + Loss From Faint @@ -342,6 +432,9 @@ + + How many happiness points are gained along with the level + Gain From Level @@ -352,6 +445,9 @@ + + The number of steps it takes to raise happiness by 1 + Steps @@ -365,6 +461,9 @@ + + If checked, stats will have effort values + Effort Values @@ -377,6 +476,9 @@ + + The maximum amount of effort values allowed + Max EV @@ -387,6 +489,9 @@ + + The maximum amount of effort values allowed for a single stat + Max EV Per Stat @@ -406,6 +511,9 @@ + + The chance of contracting the Pokérus virus + true @@ -483,9 +591,9 @@
klineedit.h
- QPanel - QWidget -
qpanel.h
+ KPushButton + QPushButton +
kpushbutton.h
diff --git a/pokemodr/gui/skins.ui b/pokemodr/gui/skins.ui index 81010e8f..e8928cc3 100644 --- a/pokemodr/gui/skins.ui +++ b/pokemodr/gui/skins.ui @@ -1,16 +1,45 @@ - panelSkins - + formSkins + 0 0 432 - 533 + 608 - + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + Walking @@ -35,7 +64,7 @@
- + Biking @@ -60,7 +89,7 @@
- + Flying @@ -85,7 +114,7 @@
- + Surfing @@ -110,7 +139,7 @@
- + Fishing @@ -135,7 +164,7 @@
- + Surf Fishing @@ -160,21 +189,28 @@
- + Qt::Vertical - 20 - 40 + 424 + 16
+ + + KPushButton + QPushButton +
kpushbutton.h
+
+
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui new file mode 100644 index 00000000..5de86c39 --- /dev/null +++ b/pokemodr/gui/species.ui @@ -0,0 +1,585 @@ + + Ben Boeckel + formSpecies + + + + 0 + 0 + 244 + 2064 + + + + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + + + + &Discard + + + Esc + + + + + + + + + + Name + + + + + + Name of the species + + + true + + + + + + + + + + Base Stats + + + + + + Stat + + + + + + + Base value for the stat + + + + + + 0 + + + + + + + + + + Effort Values + + + + + + Stat + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Number of effort value points given when defeated for given stat + + + 0 + + + + + + + + + + Growth + + + + + + Level growth pattern + + + false + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + false + + + + + + + + + + Experience Value + + + + + + Base value for experience points earned + + + 0 + + + + + + + + + + Catch Value + + + + + + How easy it is to catch the species + + + 0 + + + 255 + + + + + + + + + + Run Chance + + + + + + Chance the species runs from a wild battle + + + true + + + + + + + + + + Numerator + + + 0 + + + + + + + + + + Denominator + + + 1 + + + + + + + + + + Item Chance + + + + + + Chance the species is carrying an item in a wild battle + + + true + + + + + + + + + + Numerator + + + 0 + + + + + + + + + + Denominator + + + 1 + + + + + + + + + + PokéDex Information + + + + + + The PokéDex number of the species + + + Number + + + 0 + + + + + + + The weight of the species + + + Weight + + + 0 + + + + + + + Height + + + + + + Height of the species + + + Feet + + + 0 + + + + + + + + + + Height of the species + + + Inches + + + 0 + + + 11 + + + + + + + + + + + + + Entry + + + + + + The information on the species given in the PokéDex + + + + + + + + + + + + + Gender Chance + + + + + + Chance of getting a female version of the species (negative is genderless) + + + true + + + + + + + + + + Numerator + + + -1 + + + + + + + + + + Denominator + + + 1 + + + + + + + + + + Egg + + + + + + Species + + + + + + The species that hatches from an egg from this species + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + The number of steps it takes to hatch the egg of the species + + + Steps + + + 0 + + + + + + + + + + Nidoran Group + + + + + + Nidoran group the species belongs to + + + + + + 0 + + + + + + + + + + Types + + + + + + The types of the species + + + QAbstractItemView::ExtendedSelection + + + + + + + + + + Egg Groups + + + + + + The egg groups the species belongs to + + + QAbstractItemView::ExtendedSelection + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
+
+ + KListWidget + QListWidget +
klistwidget.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+ + KTextEdit + QTextEdit +
ktextedit.h
+
+
+ + +
diff --git a/pokemodr/gui/speciesability.ui b/pokemodr/gui/speciesability.ui new file mode 100644 index 00000000..707584ae --- /dev/null +++ b/pokemodr/gui/speciesability.ui @@ -0,0 +1,120 @@ + + Form + + + + 0 + 0 + 226 + 238 + + + + Form + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Ability + + + + + + Ability available + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Weight + + + + + + Weighting + + + 1 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/speciesevolution.ui b/pokemodr/gui/speciesevolution.ui new file mode 100644 index 00000000..b41cba16 --- /dev/null +++ b/pokemodr/gui/speciesevolution.ui @@ -0,0 +1,208 @@ + + formSpeciesEvolution + + + + 0 + 0 + 226 + 542 + + + + + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Species + + + + + + Species evolved into + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Style + + + + + + How the evolution is triggered + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Value 1 + + + + + + Value 1 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Value 2 + + + + + + Value 2 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Value 3 + + + + + + Value 3 + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + + + + Level + + + + + + Minimum level necessary + + + 0 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/speciesitem.ui b/pokemodr/gui/speciesitem.ui new file mode 100644 index 00000000..51a9f46f --- /dev/null +++ b/pokemodr/gui/speciesitem.ui @@ -0,0 +1,86 @@ + + formSpeciesItem + + + + 0 + 0 + 226 + 163 + + + + + + + + + + Item + + + + + + Item that can be held + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Weight + + + + + + Weighting + + + 1 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+
+ + +
diff --git a/pokemodr/gui/speciesmove.ui b/pokemodr/gui/speciesmove.ui new file mode 100644 index 00000000..e1661924 --- /dev/null +++ b/pokemodr/gui/speciesmove.ui @@ -0,0 +1,139 @@ + + forSpeciesMove + + + + 0 + 0 + 226 + 317 + + + + Form + + + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + + + + + Move + + + + + + Move that is learned + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + + + + Level + + + + + + Level learned when the player levels up + + + 0 + + + + + + + + + + Wild Level + + + + + + Level learned in the wild (used to give wilds better moves) + + + 0 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + KComboBox + QComboBox +
kcombobox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KPushButton + QPushButton +
kpushbutton.h
+
+
+ + +
diff --git a/pokemodr/gui/tile.ui b/pokemodr/gui/tile.ui index 641c5f45..dbfc1f73 100644 --- a/pokemodr/gui/tile.ui +++ b/pokemodr/gui/tile.ui @@ -1,15 +1,44 @@ - panelTile - + formTile + 0 0 226 - 874 + 949 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the tile + @@ -43,6 +75,9 @@ 64 + + Image of the tile + @@ -62,6 +97,9 @@ 75 + + Directions into the tile + true @@ -81,6 +119,9 @@ + + Chacne of having a wild encounter on the tile + true @@ -122,7 +163,17 @@ - + + + HM required to access the tile + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -134,7 +185,17 @@ - + + + Tile that replaces when HM is used + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -155,7 +216,17 @@ - + + + Force the tile exerts on the player + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + @@ -167,7 +238,17 @@ - + + + Direction the force is exerted in + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + +
@@ -206,6 +287,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/time.ui b/pokemodr/gui/time.ui index e1477257..9d6f0db3 100644 --- a/pokemodr/gui/time.ui +++ b/pokemodr/gui/time.ui @@ -1,15 +1,44 @@ - panelTime - + formTime + 0 0 226 - 241 + 316 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + Name of the time period + true @@ -34,6 +66,9 @@ + + Hour the time period starts + Hour @@ -47,6 +82,9 @@ + + Minute the time period starts + Minute @@ -87,6 +125,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui index 18e55e31..2c1270b0 100644 --- a/pokemodr/gui/type.ui +++ b/pokemodr/gui/type.ui @@ -1,15 +1,44 @@ - panelType - + formType + 0 0 - 134 - 228 + 226 + 349 + + + + + + + + + + &Apply + + + Ctrl+Return + + + + + + + &Discard + + + Esc + + + + + + @@ -18,6 +47,9 @@ + + The name of the type + true @@ -33,14 +65,20 @@ - + + + Multiplier for STAB (Same Type Attack Bonus) + true - + + + + Numerator @@ -50,7 +88,10 @@ - + + + + Denominator @@ -88,6 +129,11 @@ QLineEdit
klineedit.h
+ + KPushButton + QPushButton +
kpushbutton.h
+
diff --git a/pokemodr/gui/typechart.ui b/pokemodr/gui/typechart.ui index e02734cc..912c3ad2 100644 --- a/pokemodr/gui/typechart.ui +++ b/pokemodr/gui/typechart.ui @@ -1,67 +1,87 @@ - panelTypeChart - + formTypeEffectiveness + 0 0 - 109 - 207 + 226 + 226 + + Type Effectiveness + - + - Attacker + Effectiveness - + - + + + Multiplier for attacks between the two types + + + + + + true + + - - - - - - - Defender - - - + + + Numerator + + + 0 + + + + + + + Denominator + + + 1 + + - - - Effectiveness - - - - - - - - Qt::Vertical + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - 20 - 40 - + + true - +
- KComboBox - QComboBox -
kcombobox.h
+ KDialogButtonBox + QDialogButtonBox +
kdialogbuttonbox.h
+
+ + KIntNumInput + QWidget +
knuminput.h
+
+ + KLineEdit + QLineEdit +
klineedit.h
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index e8fbd2fd..d1ffe65e 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -3,7 +3,9 @@ DESTDIR = ../../bin TEMPLATE = app LIBS += -L../../lib -lgeneral -lpokemod -laudio -CONFIG += qt gui warn_on dll -SOURCES += *.cpp -HEADERS += *.h +CONFIG += qt gui warn_on dll + +FORMS += gui/*.ui +SOURCES += *.cpp +HEADERS += *.h -- cgit