summaryrefslogtreecommitdiffstats
path: root/pokemod/AbilityEffect.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-19 18:12:17 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-19 18:12:17 +0000
commitfe31331e2807634ae659e372358bac5781de9130 (patch)
tree6b208974e3f141e9b22152526e2d42e967bfd4ec /pokemod/AbilityEffect.cpp
parent6679f5cffa9d35a23b76605ddfbf3257f882b6ee (diff)
[FIX] IndexException is more explicit
[FIX] Added SizeException for image validation [FIX] QPixmaps are now verified [FIX] Classes now use error and warning rather than throwing [FIX] Deleted Object.cpp git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@100 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/AbilityEffect.cpp')
-rw-r--r--pokemod/AbilityEffect.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index 40f3368a..382ccf39 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -239,7 +239,7 @@ void AbilityEffect::setChance(const Fraction& chance) throw(Exception)
void AbilityEffect::setEffect(const int effect) throw(BoundsException)
{
if (E_End <= effect)
- throw(BoundsException(className(), "effect"));
+ error<BoundsException>("effect");
m_effect = effect;
m_value1 = INT_MAX;
m_value2 = INT_MAX;
@@ -252,34 +252,34 @@ void AbilityEffect::setValue1(const int value1) throw(Exception)
{
case E_Stats:
if ((Pokemod::ST_HP == value1) || (Pokemod::ST_End_Battle <= value1) || ((Pokemod::ST_SpecialDefense == value1) && !pokemod()->rules()->specialSplit()))
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_Status:
if (Pokemod::STS_End <= value1)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_Ability:
if (pokemod()->abilityIndex(value1) == INT_MAX)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_AccuracyPowerTrade:
if (PA_End <= value1)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_ItemEffect:
if (IT_End <= value1)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_Type:
if (pokemod()->typeIndex(value1) == INT_MAX)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
case E_Weather:
if (Pokemod::W_End_All <= value1)
- throw(BoundsException(className(), "value1"));
+ error<BoundsException>("value1");
break;
default:
- throw(UnusedException(className(), "value1"));
+ error<UnusedException>("value1");
break;
}
m_value1 = value1;
@@ -291,23 +291,23 @@ void AbilityEffect::setValue2(const int value2) throw(Exception)
{
case E_Stats:
if (Pokemod::BM_End <= value2)
- throw(BoundsException(className(), "value2"));
+ error<BoundsException>("value2");
break;
case E_Status:
case E_Weather:
if (C_End <= value2)
- throw(BoundsException(className(), "value2"));
+ error<BoundsException>("value2");
break;
case E_Ability:
if (I_End <= value2)
- throw(BoundsException(className(), "value2"));
+ error<BoundsException>("value2");
break;
case E_Type:
if (B_End <= value2)
- throw(BoundsException(className(), "value2"));
+ error<BoundsException>("value2");
break;
default:
- throw(UnusedException(className(), "value2"));
+ error<UnusedException>("value2");
break;
}
m_value2 = value2;
@@ -326,14 +326,14 @@ void AbilityEffect::setValue3(const int value3) throw(Exception)
case E_Type:
case E_FastHatch:
if ((value3 < 0) || (100 < value3))
- throw(BoundsException(className(), "value3"));
+ error<BoundsException>("value3");
break;
case E_Stats:
if ((value3 < -12) || (12 < value3))
- throw(BoundsException(className(), "value3"));
+ error<BoundsException>("value3");
break;
default:
- throw(UnusedException(className(), "value3"));
+ error<UnusedException>("value3");
break;
}
m_value3 = value3;
@@ -342,7 +342,7 @@ void AbilityEffect::setValue3(const int value3) throw(Exception)
void AbilityEffect::setTrigger(const int trigger) throw(BoundsException)
{
if (T_End <= trigger)
- throw(BoundsException(className(), "trigger"));
+ error<BoundsException>("trigger");
m_trigger = trigger;
m_triggerValue1 = INT_MAX;
m_triggerValue2.set(1, 1);
@@ -354,26 +354,26 @@ void AbilityEffect::setTriggerValue1(const int triggerValue1) throw(Exception)
{
case T_Weather:
if (Pokemod::W_End_All <= triggerValue1)
- throw(BoundsException(className(), "triggerValue1"));
+ error<BoundsException>("triggerValue1");
break;
case T_Type:
if (pokemod()->typeIndex(triggerValue1) == INT_MAX)
- throw(BoundsException(className(), "triggerValue1"));
+ error<BoundsException>("triggerValue1");
break;
case T_HPBoundary:
if (S_End <= triggerValue1)
- throw(BoundsException(className(), "triggerValue1"));
+ error<BoundsException>("triggerValue1");
break;
case T_StatChange:
if ((Pokemod::ST_HP == triggerValue1) || (Pokemod::ST_End_Battle <= triggerValue1) || ((Pokemod::ST_SpecialDefense == triggerValue1) && !pokemod()->rules()->specialSplit()))
- throw(BoundsException(className(), "triggerValue1"));
+ error<BoundsException>("triggerValue1");
break;
case T_Status:
if (Pokemod::STS_End <= triggerValue1)
- throw(BoundsException(className(), "triggerValue1"));
+ error<BoundsException>("triggerValue1");
break;
default:
- throw(UnusedException(className(), "triggerValue1"));
+ error<UnusedException>("triggerValue1");
break;
}
m_triggerValue1 = triggerValue1;
@@ -382,7 +382,7 @@ void AbilityEffect::setTriggerValue1(const int triggerValue1) throw(Exception)
void AbilityEffect::setTriggerValue2(const Fraction& triggerValue2) throw(Exception)
{
if (m_trigger != T_HPBoundary)
- throw(UnusedException(className(), "triggerValue2"));
+ error<UnusedException>("triggerValue2");
m_triggerValue2 = triggerValue2;
}