summaryrefslogtreecommitdiffstats
path: root/pokemod/MoveEffect.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-03 10:45:40 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-03 10:45:40 +0000
commit8714e1d409f46b05980b3e1e9f3a10910294b429 (patch)
tree5d4931ed73a4947df329c6825474ddb902c465b8 /pokemod/MoveEffect.cpp
parent822b5fcaa34b78b9668a58680f9e0d89aa3fd7bd (diff)
downloadsigen-8714e1d409f46b05980b3e1e9f3a10910294b429.tar.gz
sigen-8714e1d409f46b05980b3e1e9f3a10910294b429.tar.xz
sigen-8714e1d409f46b05980b3e1e9f3a10910294b429.zip
[FIX] pokemod now uses signals/slots for errors and warnings
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@120 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/MoveEffect.cpp')
-rw-r--r--pokemod/MoveEffect.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
index 9847ffdf..37cb51fc 100644
--- a/pokemod/MoveEffect.cpp
+++ b/pokemod/MoveEffect.cpp
@@ -19,6 +19,7 @@
#include "MoveEffect.h"
// Pokemod includes
+#include "Move.h"
#include "Pokemod.h"
const QStringList MoveEffect::EffectStr = QStringList() << "Damage" << "Status" << "Confuse" << "Stat" << "StealHP" << "Counter" << "Selfdestruct" << "Need Status" << "Mirror" << "GetMoney" << "Never Miss" << "Steal Types" << "Clear Effects" << "Wait And Return" << "Self Confuse" << "Force Switch" << "Hit Multiple" << "Hit Multiple Turns" << "Flinch" << "One Hit K.O." << "Recoil" << "Recover" << "Rest" << "Sheild" << "Substitute" << "Recharge" << "Rage" << "Mimic" << "Random Move" << "Seed" << "Disable" << "Cut HM" << "Fly HM" << "Surf HM" << "Strength HM" << "Flash HM" << "Rock Smash HM" << "Rock Climb HM" << "Whirlpool HM" << "Waterfall HM" << "Share HP HM " << "Escape HM";
@@ -29,7 +30,7 @@ MoveEffect::MoveEffect(const MoveEffect& effect) :
*this = effect;
}
-MoveEffect::MoveEffect(const Object* parent, const int id) :
+MoveEffect::MoveEffect(const Move* parent, const int id) :
Object("MoveEffect", parent, id),
m_chance(1, 1),
m_effect(INT_MAX),
@@ -40,21 +41,20 @@ MoveEffect::MoveEffect(const Object* parent, const int id) :
{
}
-MoveEffect::MoveEffect(const MoveEffect& effect, const Object* parent, const int id) :
+MoveEffect::MoveEffect(const MoveEffect& effect, const Move* parent, const int id) :
Object("MoveEffect", parent, id)
{
*this = effect;
}
-MoveEffect::MoveEffect(const QDomElement& xml, const Object* parent, const int id) :
+MoveEffect::MoveEffect(const QDomElement& xml, const Move* parent, const int id) :
Object("MoveEffect", parent, id)
{
load(xml, id);
}
-void MoveEffect::validate(QTextStream& stream)
+void MoveEffect::validate()
{
- TEST_SETUP();
TEST(setChance, chance);
TEST(setEffect, effect);
TEST(setValue1, value1);
@@ -90,7 +90,7 @@ void MoveEffect::setChance(const Fraction& chance)
{
if (1 < chance)
{
- boundsError("chance");
+ emit(error(bounds("chance")));
return;
}
m_chance = chance;
@@ -100,7 +100,7 @@ void MoveEffect::setEffect(const int effect)
{
if (E_End <= effect)
{
- boundsError("effect");
+ emit(error(bounds("effect")));
return;
}
m_effect = effect;
@@ -117,7 +117,7 @@ void MoveEffect::setValue1(const int value1)
case E_Damage:
if (D_End <= value1)
{
- boundsError("value1");
+ emit(error(bounds("value1")));
return;
}
break;
@@ -125,14 +125,14 @@ void MoveEffect::setValue1(const int value1)
case E_NeedStatus:
if (Pokemod::STS_End <= value1)
{
- boundsError("value1");
+ emit(error(bounds("value1")));
return;
}
throw;
case E_Stat:
if (Pokemod::ST_End_Battle <= value1)
{
- boundsError("value1");
+ emit(error(bounds("value1")));
return;
}
break;
@@ -140,19 +140,19 @@ void MoveEffect::setValue1(const int value1)
case E_Shield:
if (MT_End <= value1)
{
- boundsError("value1");
+ emit(error(bounds("value1")));
return;
}
break;
case E_Recoil:
if (R_End <= value1)
{
- boundsError("value1");
+ emit(error(bounds("value1")));
return;
}
break;
default:
- unusedError("value1");
+ emit(warning(unused("value1")));
return;
}
m_value1 = value1;
@@ -165,12 +165,12 @@ void MoveEffect::setValue2(const int value2)
case E_Damage:
if ((D_Level <= m_value1) || !value2)
{
- boundsError("value2");
+ emit(error(bounds("value2")));
return;
}
break;
default:
- unusedError("value2");
+ emit(warning(unused("value2")));
return;
}
m_value2 = value2;
@@ -191,7 +191,7 @@ void MoveEffect::setValue4(const Fraction& value4)
{
if ((m_effect != E_StealHP) && (m_effect != E_Counter) && (m_effect != E_Selfdestruct) && (m_effect != E_Mirror) && (m_effect != E_GetMoney) && (m_effect != E_WaitAndReturn) && (m_effect != E_Recoil) && (1 < value4))
{
- boundsError("value4");
+ emit(error(bounds("value4")));
return;
}
m_value4 = value4;