diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 00:44:23 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-01-21 00:44:23 +0000 |
| commit | 2b653821cc31f18adb5d50bb0bc19048939670dc (patch) | |
| tree | d333bbf0d1dde8fe0c1633bea60785b20ac07841 /pokemod/Move.cpp | |
| parent | e27ba66952a1e851bb417611e0ed7df1fbf5f945 (diff) | |
| download | sigen-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/Move.cpp')
| -rw-r--r-- | pokemod/Move.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
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) { |
