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 --- pokemod/Move.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'pokemod/Move.cpp') 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) { -- cgit