summaryrefslogtreecommitdiffstats
path: root/pokemod/CoinList.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-01-21 00:44:23 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-01-21 00:44:23 +0000
commit2b653821cc31f18adb5d50bb0bc19048939670dc (patch)
treed333bbf0d1dde8fe0c1633bea60785b20ac07841 /pokemod/CoinList.cpp
parente27ba66952a1e851bb417611e0ed7df1fbf5f945 (diff)
downloadsigen-2b653821cc31f18adb5d50bb0bc19048939670dc.tar.gz
sigen-2b653821cc31f18adb5d50bb0bc19048939670dc.tar.xz
sigen-2b653821cc31f18adb5d50bb0bc19048939670dc.zip
[ADD] More GUI classes (only MoveEffect left)
[FIX] Polished up GUI classes [FIX] renamed methods get*ByID -> get*Index instead for more logical get*ByID [FIX] Renaming in pokemod to remove mention of Pokémon [FIX] minor .pro fixes (aesthetic mainly) git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@35 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/CoinList.cpp')
-rw-r--r--pokemod/CoinList.cpp20
1 files changed, 15 insertions, 5 deletions
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<unsigned, unsigned> idChecker;
QMap<unsigned, unsigned> itemChecker;
- QMap<unsigned, unsigned> pokemonChecker;
+ QMap<unsigned, unsigned> speciesChecker;
for (QListIterator<CoinListObject> 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<unsigned, unsigned> i(idChecker); i.hasNext(); i.next())
{
@@ -82,7 +82,7 @@ bool PokeMod::CoinList::validate() const
valid = false;
}
}
- for (QMapIterator<unsigned, unsigned> i(pokemonChecker); i.hasNext(); i.next())
+ for (QMapIterator<unsigned, unsigned> 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)
{