summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog13
-rw-r--r--battle/Arena.h1
-rw-r--r--battle/Pokemon.h1
-rw-r--r--general/Flag.h2
-rw-r--r--general/general.pro6
-rw-r--r--pokemod/Ability.cpp38
-rw-r--r--pokemod/Ability.h5
-rw-r--r--pokemod/AbilityEffect.cpp30
-rw-r--r--pokemod/Badge.cpp29
-rw-r--r--pokemod/Badge.h8
-rw-r--r--pokemod/CoinList.cpp46
-rw-r--r--pokemod/CoinList.h5
-rw-r--r--pokemod/Item.cpp38
-rw-r--r--pokemod/Item.h5
-rw-r--r--pokemod/ItemEffect.cpp26
-rw-r--r--pokemod/Map.cpp158
-rw-r--r--pokemod/Map.h17
-rw-r--r--pokemod/MapEffect.cpp4
-rw-r--r--pokemod/MapTrainer.cpp42
-rw-r--r--pokemod/MapTrainer.h5
-rw-r--r--pokemod/MapWarp.cpp30
-rw-r--r--pokemod/MapWarp.h2
-rw-r--r--pokemod/MapWildList.cpp33
-rw-r--r--pokemod/MapWildList.h5
-rw-r--r--pokemod/Move.cpp38
-rw-r--r--pokemod/Move.h5
-rw-r--r--pokemod/MoveEffect.cpp6
-rw-r--r--pokemod/Nature.cpp16
-rw-r--r--pokemod/Nature.h3
-rw-r--r--pokemod/Pokemod.cpp589
-rw-r--r--pokemod/Pokemod.h162
-rw-r--r--pokemod/Species.cpp174
-rw-r--r--pokemod/Species.h22
-rw-r--r--pokemod/SpeciesEvolution.cpp10
-rw-r--r--pokemod/TODO21
-rw-r--r--pokemod/Tile.cpp40
-rw-r--r--pokemod/Tile.h3
-rw-r--r--pokemodr/BadgeUI.cpp7
-rw-r--r--pokemodr/MapWarpUI.cpp7
-rw-r--r--pokemodr/NatureUI.cpp3
-rw-r--r--pokemodr/PokeModr.cpp9
-rw-r--r--pokemodr/SpeciesEvolutionUI.cpp7
-rw-r--r--pokemodr/SpeciesUI.cpp5
-rw-r--r--pokemodr/TODO1
-rw-r--r--pokemodr/TileUI.cpp11
-rw-r--r--pokemodr/gui/pokemod.ui7
-rw-r--r--pokemodr/gui/rules.ui7
-rw-r--r--pokemodr/gui/species.ui7
48 files changed, 981 insertions, 728 deletions
diff --git a/Changelog b/Changelog
index 99407b3e..203a7250 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,17 @@
-----------------
+Rev: 82
+Date: 24 February 2008
+User: MathStuf
+-----------------
+[FIX] KTabWidget now used rather than QTabWidget (though this kills Qt Designer interaction :\ )
+[FIX] Minor fixes in PokeModr class
+[DEL] Ref.{h, cpp}
+[FIX] Ref enumerations now in Pokemod class
+[FIX] new/delete used for subclasses in pokemod now
+[FIX] Inclusion hell in pokemod (should compile faster)
+[FIX] Spelling typos
+
+-----------------
Rev: 81
Date: 24 February 2008
User: MathStuf
diff --git a/battle/Arena.h b/battle/Arena.h
index 0a3e7bd3..3745b065 100644
--- a/battle/Arena.h
+++ b/battle/Arena.h
@@ -26,7 +26,6 @@
#include <QString>
#include "Pokemon.h"
#include "Team.h"
-#include "../gnereal/Ref.h"
#include "pokemod/Ability.h"
#include "pokemod/Item.h"
#include "pokemod/MapTrainer.h"
diff --git a/battle/Pokemon.h b/battle/Pokemon.h
index f527b72b..5b5b7a8c 100644
--- a/battle/Pokemon.h
+++ b/battle/Pokemon.h
@@ -28,7 +28,6 @@
#include <QString>
#include "../general/Frac.h"
#include "../general/Ini.h"
-#include "../general/Ref.h"
#include "../pokemod/Ability.h"
#include "../pokemod/Item.h"
#include "../pokemod/Nature.h"
diff --git a/general/Flag.h b/general/Flag.h
index 90fd755e..1b7d5857 100644
--- a/general/Flag.h
+++ b/general/Flag.h
@@ -25,8 +25,6 @@
#include <QStringList>
-#include "Ref.h"
-
class Flag
{
public:
diff --git a/general/general.pro b/general/general.pro
index f394982d..0a434644 100644
--- a/general/general.pro
+++ b/general/general.pro
@@ -51,8 +51,7 @@ SOURCES += Audio.cpp \
Flag.cpp \
Frac.cpp \
ImageCache.cpp \
- Ini.cpp \
- Ref.cpp
+ Ini.cpp
HEADERS += Audio.h \
BugCatcher.h \
@@ -63,5 +62,4 @@ HEADERS += Audio.h \
ImageCache.h \
Ini.h \
Matrix.h \
- Point.h \
- Ref.h
+ Point.h
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 234d2dae..8cc1a319 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -29,6 +29,7 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "AbilityEffect.h"
#include "Ability.h"
Ability::Ability(const Pokemod* par, const int _id) :
@@ -49,6 +50,12 @@ Ability::Ability(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+Ability::~Ability()
+{
+ for (QListIterator<AbilityEffect*> i(effects); i.hasNext(); )
+ delete i.next();
+}
+
bool Ability::validate() const
{
bool valid = true;
@@ -61,11 +68,11 @@ bool Ability::validate() const
if (getEffectCount())
{
QMap<int, int> idChecker;
- for (QListIterator<AbilityEffect> i(effects); i.hasNext(); i.next())
+ for (QListIterator<AbilityEffect*> i(effects); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -117,8 +124,8 @@ void Ability::save() const throw(Exception)
ini.addField("id", id);
ini.addField("name", name);
ini.save(QString("%1/ability/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<AbilityEffect> i(effects); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<AbilityEffect*> i(effects); i.hasNext(); )
+ i.next()->save(name);
}
void Ability::setName(const QString& n)
@@ -135,14 +142,14 @@ const AbilityEffect* Ability::getEffect(const int i) const throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects.at(i);
+ return effects.at(i);
}
AbilityEffect* Ability::getEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects[i];
+ return effects[i];
}
const AbilityEffect* Ability::getEffectByID(const int i) const throw(IndexException)
@@ -159,7 +166,7 @@ int Ability::getEffectIndex(const int _id) const
{
for (int i = 0; i < getEffectCount(); ++i)
{
- if (effects[i].getId() == _id)
+ if (effects[i]->getId() == _id)
return i;
}
return -1;
@@ -172,26 +179,27 @@ int Ability::getEffectCount() const
AbilityEffect* Ability::newEffect()
{
- effects.append(AbilityEffect(pokemod, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new AbilityEffect(pokemod, getNewId()));
+ return effects[getEffectCount() - 1];
}
AbilityEffect* Ability::newEffect(const QString& fname)
{
- effects.append(AbilityEffect(pokemod, fname, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new AbilityEffect(pokemod, fname, getNewId()));
+ return effects[getEffectCount() - 1];
}
AbilityEffect* Ability::newEffect(const AbilityEffect& e)
{
- effects.append(AbilityEffect(pokemod, e, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new AbilityEffect(pokemod, e, getNewId()));
+ return effects[getEffectCount() - 1];
}
void Ability::deleteEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
+ delete effects[i];
effects.removeAt(i);
}
@@ -202,6 +210,6 @@ Ability& Ability::operator=(const Ability& rhs)
name = rhs.name;
effects.clear();
for (int i = 0; i < rhs.getEffectCount(); ++i)
- effects.append(AbilityEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
+ effects.append(new AbilityEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
return *this;
}
diff --git a/pokemod/Ability.h b/pokemod/Ability.h
index 08532ba0..f1494bc3 100644
--- a/pokemod/Ability.h
+++ b/pokemod/Ability.h
@@ -30,8 +30,8 @@
#include <Exception.h>
#include "Object.h"
-#include "AbilityEffect.h"
+class AbilityEffect;
class Pokemod;
class Ability : public Object
@@ -40,6 +40,7 @@ class Ability : public Object
Ability(const Pokemod* par, const int _id);
Ability(const Pokemod* par, const Ability& a, const int _id);
Ability(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~Ability();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -66,7 +67,7 @@ class Ability : public Object
QString name;
- QList<AbilityEffect> effects;
+ QList<AbilityEffect*> effects;
};
#endif
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index e0cc7f5c..c4f5c470 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -20,8 +20,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include <Ref.h>
-
#include "Pokemod.h"
#include "Ability.h"
#include "Type.h"
@@ -72,11 +70,11 @@ bool AbilityEffect::validate() const
switch (effect)
{
case E_Stats:
- if ((ST_HP == val1) || (ST_End_Battle <= val1) || ((val1 == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_HP == val1) || (Pokemod::ST_End_Battle <= val1) || ((val1 == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
ok = false;
break;
case E_Status:
- if (STS_End <= val1)
+ if (Pokemod::STS_End <= val1)
ok = false;
break;
case E_Ability:
@@ -96,7 +94,7 @@ bool AbilityEffect::validate() const
ok = false;
break;
case E_Weather:
- if (W_End_All <= val1)
+ if (Pokemod::W_End_All <= val1)
ok = false;
break;
}
@@ -109,7 +107,7 @@ bool AbilityEffect::validate() const
switch (effect)
{
case E_Stats:
- if (BM_End <= val2)
+ if (Pokemod::BM_End <= val2)
ok = false;
break;
case E_Status:
@@ -168,7 +166,7 @@ bool AbilityEffect::validate() const
switch (trigger)
{
case T_Weather:
- if (W_End_All <= tval1)
+ if (Pokemod::W_End_All <= tval1)
ok = false;
break;
case T_Type:
@@ -180,11 +178,11 @@ bool AbilityEffect::validate() const
ok = false;
break;
case T_StatChange:
- if ((ST_HP == tval1) || (ST_End_Battle <= tval1) || ((tval1 == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_HP == tval1) || (Pokemod::ST_End_Battle <= tval1) || ((tval1 == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
ok = false;
break;
case T_Status:
- if (STS_End <= tval1)
+ if (Pokemod::STS_End <= tval1)
ok = false;
break;
}
@@ -272,11 +270,11 @@ void AbilityEffect::setVal1(const int v1) throw(Exception)
switch (effect)
{
case E_Stats:
- if ((ST_HP == val1) || (ST_End_Battle <= val1) || ((val1 == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_HP == val1) || (Pokemod::ST_End_Battle <= val1) || ((val1 == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "val1"));
break;
case E_Status:
- if (STS_End <= v1)
+ if (Pokemod::STS_End <= v1)
throw(BoundsException(className, "val1"));
break;
case E_Ability:
@@ -296,7 +294,7 @@ void AbilityEffect::setVal1(const int v1) throw(Exception)
throw(BoundsException(className, "val1"));
break;
case E_Weather:
- if (W_End_All <= v1)
+ if (Pokemod::W_End_All <= v1)
throw(BoundsException(className, "val1"));
break;
default:
@@ -311,7 +309,7 @@ void AbilityEffect::setVal2(const int v2) throw(Exception)
switch (effect)
{
case E_Stats:
- if (BM_End <= v2)
+ if (Pokemod::BM_End <= v2)
throw(BoundsException(className, "val2"));
break;
case E_Status:
@@ -374,7 +372,7 @@ void AbilityEffect::setTval1(const int tv1) throw(Exception)
switch (trigger)
{
case T_Weather:
- if (W_End_All <= tv1)
+ if (Pokemod::W_End_All <= tv1)
throw(BoundsException(className, "tval1"));
break;
case T_Type:
@@ -386,11 +384,11 @@ void AbilityEffect::setTval1(const int tv1) throw(Exception)
throw(BoundsException(className, "tval1"));
break;
case T_StatChange:
- if ((ST_HP == tval1) || (ST_End_Battle <= tval1) || ((tval1 == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_HP == tval1) || (Pokemod::ST_End_Battle <= tval1) || ((tval1 == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "tval1"));
break;
case T_Status:
- if (STS_End <= tv1)
+ if (Pokemod::STS_End <= tv1)
throw(BoundsException(className, "tval1"));
break;
default:
diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp
index cdc150d1..2868f93d 100644
--- a/pokemod/Badge.cpp
+++ b/pokemod/Badge.cpp
@@ -21,7 +21,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include "Pokemod.h"
#include "Badge.h"
Badge::Badge(const Pokemod* par, const int _id) :
@@ -29,9 +28,9 @@ Badge::Badge(const Pokemod* par, const int _id) :
name(""),
obey(0)
{
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
stats[i].set(1, 1);
- for (int i = 0; i < HM_End_All; ++i)
+ for (int i = 0; i < Pokemod::HM_End_All; ++i)
hm[i] = false;
}
@@ -83,7 +82,7 @@ void Badge::load(const QString& fname, const int _id) throw(Exception)
id = _id;
ini.getValue("name", name);
ini.getValue("obey", obey, 0);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
{
int j;
int k;
@@ -91,7 +90,7 @@ void Badge::load(const QString& fname, const int _id) throw(Exception)
ini.getValue(QString("stats-%1-d").arg(i), k, 1);
stats[i].set(j, k);
}
- for (int i = 0; i < HM_End_All; ++i)
+ for (int i = 0; i < Pokemod::HM_End_All; ++i)
ini.getValue(QString("hm-%1").arg(i), hm[i], false);
}
@@ -101,12 +100,12 @@ void Badge::save() const throw(Exception)
ini.addField("id", id);
ini.addField("name", name);
ini.addField("obey", obey);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
{
ini.addField(QString("stats-%1-n").arg(i), stats[i].getNum());
ini.addField(QString("stats-%1-d").arg(i), stats[i].getDenom());
}
- for (int i = 0; i < HM_End_All; ++i)
+ for (int i = 0; i < Pokemod::HM_End_All; ++i)
ini.addField(QString("hm-%1").arg(i), hm[i]);
ini.save(QString("%1/badge/%2.pini").arg(pokemod->getPath()).arg(name));
}
@@ -143,28 +142,28 @@ void Badge::setObey(const int o) throw(BoundsException)
void Badge::setStat(const int s, const int n, const int d) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].set(n, d);
}
void Badge::setStatNum(const int s, const int n) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].setNum(n);
}
void Badge::setStatDenom(const int s, const int d) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].setDenom(d);
}
void Badge::setHm(const int h, const bool hb) throw(BoundsException)
{
- if (HM_End_All <= h)
+ if (Pokemod::HM_End_All <= h)
throw(BoundsException(className, "hm"));
hm[h] = hb;
}
@@ -191,14 +190,14 @@ int Badge::getObey() const
Frac Badge::getStat(const int s) const throw(BoundsException)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
return stats[s];
}
bool Badge::getHm(const int h) const throw(BoundsException)
{
- if (HM_End_All <= h)
+ if (Pokemod::HM_End_All <= h)
throw(BoundsException(className, "hm"));
return hm[h];
}
@@ -209,9 +208,9 @@ Badge& Badge::operator=(const Badge& rhs)
return *this;
name = rhs.name;
obey = rhs.obey;
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
stats[i] = rhs.stats[i];
- for (int i = 0; i < HM_End_All; ++i)
+ for (int i = 0; i < Pokemod::HM_End_All; ++i)
hm[i] = rhs.hm[i];
return *this;
}
diff --git a/pokemod/Badge.h b/pokemod/Badge.h
index 84c43256..c5c3bca5 100644
--- a/pokemod/Badge.h
+++ b/pokemod/Badge.h
@@ -29,11 +29,9 @@
#include <Exception.h>
#include <Frac.h>
-#include <Ref.h>
#include "Object.h"
-
-class Pokemod;
+#include "Pokemod.h"
class Badge : public Object
{
@@ -67,8 +65,8 @@ class Badge : public Object
QString name;
int obey;
- Frac stats[ST_End_GSC];
- bool hm[HM_End_All];
+ Frac stats[Pokemod::ST_End_GSC];
+ bool hm[Pokemod::HM_End_All];
};
#endif
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 48bfbc5c..53002fa0 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -28,6 +28,7 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "CoinListObject.h"
#include "Item.h"
#include "ItemEffect.h"
#include "CoinList.h"
@@ -51,6 +52,12 @@ CoinList::CoinList(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+CoinList::~CoinList()
+{
+ for (QListIterator<CoinListObject*> i(items); i.hasNext(); )
+ delete i.next();
+}
+
bool CoinList::validate() const
{
bool valid = true;
@@ -81,15 +88,15 @@ bool CoinList::validate() const
QMap<int, int> idChecker;
QMap<int, int> itemChecker;
QMap<int, int> speciesChecker;
- for (QListIterator<CoinListObject> i(items); i.hasNext(); i.next())
+ for (QListIterator<CoinListObject*> i(items); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- if (i.peekNext().getType() == CoinListObject::Item)
- ++itemChecker[i.peekNext().getObject()];
- else if (i.peekNext().getType() == CoinListObject::Species)
- ++speciesChecker[i.peekNext().getObject()];
+ ++idChecker[i.peekNext()->getId()];
+ if (i.peekNext()->getType() == CoinListObject::Item)
+ ++itemChecker[i.peekNext()->getObject()];
+ else if (i.peekNext()->getType() == CoinListObject::Species)
+ ++speciesChecker[i.peekNext()->getObject()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -159,8 +166,8 @@ void CoinList::save() const throw(Exception)
ini.addField("name", name);
ini.addField("value", value);
ini.save(QString("%1/coinlist/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<CoinListObject> i(items); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<CoinListObject*> i(items); i.hasNext(); )
+ i.next()->save(name);
}
void CoinList::setName(const QString& n)
@@ -200,14 +207,14 @@ const CoinListObject* CoinList::getItem(const int i) const throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items.at(i);
+ return items.at(i);
}
CoinListObject* CoinList::getItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items[i];
+ return items[i];
}
const CoinListObject* CoinList::getItemByID(const int i) const throw(IndexException)
@@ -224,7 +231,7 @@ int CoinList::getItemIndex(const int _id) const
{
for (int i = 0; i < getItemCount(); ++i)
{
- if (items[i].getId() == _id)
+ if (items[i]->getId() == _id)
return i;
}
return -1;
@@ -237,26 +244,27 @@ int CoinList::getItemCount() const
CoinListObject* CoinList::newItem()
{
- items.append(CoinListObject(pokemod, getNewId()));
- return &items[getItemCount() - 1];
+ items.append(new CoinListObject(pokemod, getNewId()));
+ return items[getItemCount() - 1];
}
CoinListObject* CoinList::newItem(const QString& fname)
{
- items.append(CoinListObject(pokemod, fname, getNewId()));
- return &items[getItemCount() - 1];
+ items.append(new CoinListObject(pokemod, fname, getNewId()));
+ return items[getItemCount() - 1];
}
CoinListObject* CoinList::newItem(const CoinListObject& o)
{
- items.append(CoinListObject(pokemod, o, getNewId()));
- return &items[getItemCount() - 1];
+ items.append(new CoinListObject(pokemod, o, getNewId()));
+ return items[getItemCount() - 1];
}
void CoinList::deleteItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
+ delete items[i];
items.removeAt(i);
}
@@ -267,6 +275,6 @@ CoinList& CoinList::operator=(const CoinList& rhs)
name = rhs.name;
items.clear();
for (int i = 0; i < rhs.getItemCount(); ++i)
- items.append(CoinListObject(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId()));
+ items.append(new CoinListObject(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId()));
return *this;
}
diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h
index 041177be..09e11aa0 100644
--- a/pokemod/CoinList.h
+++ b/pokemod/CoinList.h
@@ -30,8 +30,8 @@
#include <Exception.h>
#include "Object.h"
-#include "CoinListObject.h"
+class CoinListObject;
class Pokemod;
class CoinList : public Object
@@ -40,6 +40,7 @@ class CoinList : public Object
CoinList(const Pokemod* par, const int _id);
CoinList(const Pokemod* par, const CoinList& c, const int _id);
CoinList(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~CoinList();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -69,7 +70,7 @@ class CoinList : public Object
QString name;
int value;
- QList<CoinListObject> items;
+ QList<CoinListObject*> items;
};
#endif
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index f6293cf7..f2a594d6 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -28,6 +28,7 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "ItemEffect.h"
#include "Item.h"
Item::Item(const Pokemod* par, const int _id) :
@@ -52,6 +53,12 @@ Item::Item(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+Item::~Item()
+{
+ for (QListIterator<ItemEffect*> i(effects); i.hasNext(); )
+ delete i.next();
+}
+
bool Item::validate() const
{
bool valid = true;
@@ -74,11 +81,11 @@ bool Item::validate() const
if (getEffectCount())
{
QMap<int, int> idChecker;
- for (QListIterator<ItemEffect> i(effects); i.hasNext(); i.next())
+ for (QListIterator<ItemEffect*> i(effects); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -138,8 +145,8 @@ void Item::save() const throw(Exception)
ini.addField("price", price);
ini.addField("description", description);
ini.save(QString("%1/item/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<ItemEffect> i(effects); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<ItemEffect*> i(effects); i.hasNext(); )
+ i.next()->save(name);
}
void Item::setName(const QString& n)
@@ -200,14 +207,14 @@ const ItemEffect* Item::getEffect(const int i) const throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects.at(i);
+ return effects.at(i);
}
ItemEffect* Item::getEffectByID(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects[i];
+ return effects[i];
}
const ItemEffect* Item::getEffectByID(const int i) const throw(IndexException)
@@ -224,7 +231,7 @@ int Item::getEffectIndex(const int _id) const
{
for (int i = 0; i < getEffectCount(); ++i)
{
- if (effects[i].getId() == _id)
+ if (effects[i]->getId() == _id)
return i;
}
return -1;
@@ -237,26 +244,27 @@ int Item::getEffectCount() const
ItemEffect* Item::newEffect()
{
- effects.append(ItemEffect(pokemod, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new ItemEffect(pokemod, getNewId()));
+ return effects[getEffectCount() - 1];
}
ItemEffect* Item::newEffect(const QString& fname)
{
- effects.append(ItemEffect(pokemod, fname, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new ItemEffect(pokemod, fname, getNewId()));
+ return effects[getEffectCount() - 1];
}
ItemEffect* Item::newEffect(const ItemEffect& e)
{
- effects.append(ItemEffect(pokemod, e, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new ItemEffect(pokemod, e, getNewId()));
+ return effects[getEffectCount() - 1];
}
void Item::deleteEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
+ delete effects[i];
effects.removeAt(i);
}
@@ -271,6 +279,6 @@ Item& Item::operator=(const Item& rhs)
description = rhs.description;
effects.clear();
for (int i = 0; i < rhs.getEffectCount(); ++i)
- effects.append(ItemEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
+ effects.append(new ItemEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
return *this;
}
diff --git a/pokemod/Item.h b/pokemod/Item.h
index 9a040789..d5d4e087 100644
--- a/pokemod/Item.h
+++ b/pokemod/Item.h
@@ -29,8 +29,8 @@
#include <Exception.h>
#include "Object.h"
-#include "ItemEffect.h"
+class ItemEffect;
class Pokemod;
class Item : public Object
@@ -39,6 +39,7 @@ class Item : public Object
Item(const Pokemod* par, const int _id);
Item(const Pokemod* par, const Item& i, const int _id);
Item(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~Item();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -77,7 +78,7 @@ class Item : public Object
int price;
QString description;
- QList<ItemEffect> effects;
+ QList<ItemEffect*> effects;
};
#endif
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp
index 29363252..d2e5b2d2 100644
--- a/pokemod/ItemEffect.cpp
+++ b/pokemod/ItemEffect.cpp
@@ -20,8 +20,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include <Ref.h>
-
#include "Pokemod.h"
#include "MapWildList.h"
#include "ItemEffect.h"
@@ -173,7 +171,7 @@ bool ItemEffect::validate() const
ok = false;
break;
case E_CureStatus:
- if (STS_End <= val2)
+ if (Pokemod::STS_End <= val2)
ok = false;
break;
case E_StatBoost:
@@ -181,7 +179,7 @@ bool ItemEffect::validate() const
ok = false;
break;
case E_ModifyStatBattle:
- if (ST_End_Battle <= val2)
+ if (Pokemod::ST_End_Battle <= val2)
ok = false;
break;
case E_ShieldBattle:
@@ -236,7 +234,7 @@ bool ItemEffect::validate() const
switch (effect)
{
case E_StatBoost:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3)
ok = false;
break;
case E_Ball:
@@ -259,7 +257,7 @@ bool ItemEffect::validate() const
ok = false;
break;
case B_Stat:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3)
ok = false;
break;
case B_Type:
@@ -272,11 +270,11 @@ bool ItemEffect::validate() const
switch (val2)
{
case B2_HPCure:
- if (REL_End <= val3)
+ if (Pokemod::REL_End <= val3)
ok = false;
break;
case B2_StatusCure:
- if (STS_End <= val3)
+ if (Pokemod::STS_End <= val3)
ok = false;
break;
default:
@@ -505,7 +503,7 @@ void ItemEffect::setVal2(const int v2) throw(Exception)
throw(BoundsException(className, "val2"));
break;
case E_CureStatus:
- if (STS_End <= val2)
+ if (Pokemod::STS_End <= val2)
throw(BoundsException(className, "val2"));
break;
case E_StatBoost:
@@ -513,7 +511,7 @@ void ItemEffect::setVal2(const int v2) throw(Exception)
throw(BoundsException(className, "val2"));
break;
case E_ModifyStatBattle:
- if (ST_End_Battle <= val2)
+ if (Pokemod::ST_End_Battle <= val2)
throw(BoundsException(className, "val2"));
break;
case E_ShieldBattle:
@@ -572,7 +570,7 @@ void ItemEffect::setVal3(const int v3) throw(Exception)
switch (effect)
{
case E_StatBoost:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3)
throw(BoundsException(className, "val3"));
break;
case E_Ball:
@@ -591,7 +589,7 @@ void ItemEffect::setVal3(const int v3) throw(Exception)
throw(BoundsException(className, "val3"));
break;
case B_Stat:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val3)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val3)
throw(BoundsException(className, "val3"));
break;
case B_Type:
@@ -610,11 +608,11 @@ void ItemEffect::setVal3(const int v3) throw(Exception)
switch (val2)
{
case B2_HPCure:
- if (REL_End <= val3)
+ if (Pokemod::REL_End <= val3)
throw(BoundsException(className, "val3"));
break;
case B2_StatusCure:
- if (STS_End <= val3)
+ if (Pokemod::STS_End <= val3)
throw(BoundsException(className, "val3"));
break;
default:
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp
index 7a575271..e3adeff5 100644
--- a/pokemod/Map.cpp
+++ b/pokemod/Map.cpp
@@ -26,6 +26,10 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "MapEffect.h"
+#include "MapTrainer.h"
+#include "MapWarp.h"
+#include "MapWildList.h"
#include "Map.h"
const QStringList Map::TypeStr = QStringList() << "Outdoor" << "Dungeon" << "Building";
@@ -50,6 +54,18 @@ Map::Map(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+Map::~Map()
+{
+ for (QListIterator<MapEffect*> i(effects); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<MapTrainer*> i(trainers); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<MapWarp*> i(warps); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<MapWildList*> i(wildLists); i.hasNext(); )
+ delete i.next();
+}
+
bool Map::validate() const
{
bool valid = true;
@@ -73,22 +89,22 @@ bool Map::validate() const
QMap<QString, int> nameChecker;
if (getEffectCount())
{
- for (QListIterator<MapEffect> i(effects); i.hasNext(); i.next())
+ for (QListIterator<MapEffect*> i(effects); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- if (getWidth() <= i.peekNext().getCoordinate().getX())
+ if (getWidth() <= i.peekNext()->getCoordinate().getX())
{
pokemod->validationMsg("Invalid x coordinate");
valid = false;
}
- if (getHeight() <= i.peekNext().getCoordinate().getY())
+ if (getHeight() <= i.peekNext()->getCoordinate().getY())
{
pokemod->validationMsg("Invalid y coordinate");
valid = false;
}
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -113,22 +129,22 @@ bool Map::validate() const
pokemod->validationMsg("There are no effects", Pokemod::V_Warn);
if (getTrainerCount())
{
- for (QListIterator<MapTrainer> i(trainers); i.hasNext(); i.next())
+ for (QListIterator<MapTrainer*> i(trainers); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- if (getWidth() <= i.peekNext().getCoordinate().getX())
+ if (getWidth() <= i.peekNext()->getCoordinate().getX())
{
pokemod->validationMsg("Invalid x coordinate");
valid = false;
}
- if (getHeight() <= i.peekNext().getCoordinate().getY())
+ if (getHeight() <= i.peekNext()->getCoordinate().getY())
{
pokemod->validationMsg("Invalid y coordinate");
valid = false;
}
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -153,22 +169,22 @@ bool Map::validate() const
pokemod->validationMsg("There are no trainers", Pokemod::V_Warn);
if (getWarpCount())
{
- for (QListIterator<MapWarp> i(warps); i.hasNext(); i.next())
+ for (QListIterator<MapWarp*> i(warps); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- if (getWidth() <= i.peekNext().getCoordinate().getX())
+ if (getWidth() <= i.peekNext()->getCoordinate().getX())
{
pokemod->validationMsg("Invalid x coordinate");
valid = false;
}
- if (getHeight() <= i.peekNext().getCoordinate().getY())
+ if (getHeight() <= i.peekNext()->getCoordinate().getY())
{
pokemod->validationMsg("Invalid y coordinate");
valid = false;
}
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -196,11 +212,11 @@ bool Map::validate() const
}
if (getWildListCount())
{
- for (QListIterator<MapWildList> i(wildLists); i.hasNext(); i.next())
+ for (QListIterator<MapWildList*> i(wildLists); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -327,14 +343,14 @@ void Map::save() const throw(Exception)
ini.addField(QString("tiles-%1-%2").arg(i).arg(j), tiles(i, j));
}
ini.save(QString("%1/map/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<MapEffect> i(effects); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<MapTrainer> i(trainers); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<MapWarp> i(warps); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<MapWildList> i(wildLists); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<MapEffect*> i(effects); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<MapTrainer*> i(trainers); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<MapWarp*> i(warps); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<MapWildList*> i(wildLists); i.hasNext(); )
+ i.next()->save(name);
}
void Map::setName(const QString& n)
@@ -437,14 +453,14 @@ const MapEffect* Map::getEffect(const int i) const throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects.at(i);
+ return effects.at(i);
}
MapEffect* Map::getEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects[i];
+ return effects[i];
}
const MapEffect* Map::getEffectByID(const int i) const throw(IndexException)
@@ -461,7 +477,7 @@ int Map::getEffectIndex(const int _id) const
{
for (int i = 0; i < getEffectCount(); ++i)
{
- if (effects[i].getId() == _id)
+ if (effects[i]->getId() == _id)
return i;
}
return -1;
@@ -474,26 +490,27 @@ int Map::getEffectCount() const
MapEffect* Map::newEffect()
{
- effects.append(MapEffect(pokemod, getNewEffectId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MapEffect(pokemod, getNewEffectId()));
+ return effects[getEffectCount() - 1];
}
MapEffect* Map::newEffect(const QString& fname)
{
- effects.append(MapEffect(pokemod, fname, getNewEffectId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MapEffect(pokemod, fname, getNewEffectId()));
+ return effects[getEffectCount() - 1];
}
MapEffect* Map::newEffect(const MapEffect& e)
{
- effects.append(MapEffect(pokemod, e, getNewEffectId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MapEffect(pokemod, e, getNewEffectId()));
+ return effects[getEffectCount() - 1];
}
void Map::deleteEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
+ delete effects[i];
effects.removeAt(i);
}
@@ -501,14 +518,14 @@ const MapTrainer* Map::getTrainer(const int i) const throw(IndexException)
{
if (getTrainerCount() <= i)
throw(IndexException(className));
- return &trainers.at(i);
+ return trainers.at(i);
}
MapTrainer* Map::getTrainer(const int i) throw(IndexException)
{
if (getTrainerCount() <= i)
throw(IndexException(className));
- return &trainers[i];
+ return trainers[i];
}
const MapTrainer* Map::getTrainerByID(const int i) const throw(IndexException)
@@ -525,7 +542,7 @@ int Map::getTrainerIndex(const int _id) const
{
for (int i = 0; i < getTrainerCount(); ++i)
{
- if (trainers[i].getId() == _id)
+ if (trainers[i]->getId() == _id)
return i;
}
return -1;
@@ -538,26 +555,27 @@ int Map::getTrainerCount() const
MapTrainer* Map::newTrainer()
{
- trainers.append(MapTrainer(pokemod, getNewTrainerId()));
- return &trainers[getTrainerCount() - 1];
+ trainers.append(new MapTrainer(pokemod, getNewTrainerId()));
+ return trainers[getTrainerCount() - 1];
}
MapTrainer* Map::newTrainer(const QString& fname)
{
- trainers.append(MapTrainer(pokemod, fname, getNewTrainerId()));
- return &trainers[getTrainerCount() - 1];
+ trainers.append(new MapTrainer(pokemod, fname, getNewTrainerId()));
+ return trainers[getTrainerCount() - 1];
}
MapTrainer* Map::newTrainer(const MapTrainer& t)
{
- trainers.append(MapTrainer(pokemod, t, getNewTrainerId()));
- return &trainers[getTrainerCount() - 1];
+ trainers.append(new MapTrainer(pokemod, t, getNewTrainerId()));
+ return trainers[getTrainerCount() - 1];
}
void Map::deleteTrainer(const int i) throw(IndexException)
{
if (getTrainerCount() <= i)
throw(IndexException(className));
+ delete trainers[i];
trainers.removeAt(i);
}
@@ -565,14 +583,14 @@ const MapWarp* Map::getWarp(const int i) const throw(IndexException)
{
if (getWarpCount() <= i)
throw(IndexException(className));
- return &warps.at(i);
+ return warps.at(i);
}
MapWarp* Map::getWarp(const int i) throw(IndexException)
{
if (getWarpCount() <= i)
throw(IndexException(className));
- return &warps[i];
+ return warps[i];
}
const MapWarp* Map::getWarpByID(const int i) const throw(IndexException)
@@ -589,7 +607,7 @@ int Map::getWarpIndex(const int _id) const
{
for (int i = 0; i < getWarpCount(); ++i)
{
- if (warps[i].getId() == _id)
+ if (warps[i]->getId() == _id)
return i;
}
return -1;
@@ -602,26 +620,27 @@ int Map::getWarpCount() const
MapWarp* Map::newWarp()
{
- warps.append(MapWarp(pokemod, getNewWarpId()));
- return &warps[getWarpCount() - 1];
+ warps.append(new MapWarp(pokemod, getNewWarpId()));
+ return warps[getWarpCount() - 1];
}
MapWarp* Map::newWarp(const QString& fname)
{
- warps.append(MapWarp(pokemod, fname, getNewWarpId()));
- return &warps[getWarpCount() - 1];
+ warps.append(new MapWarp(pokemod, fname, getNewWarpId()));
+ return warps[getWarpCount() - 1];
}
MapWarp* Map::newWarp(const MapWarp& w)
{
- warps.append(MapWarp(pokemod, w, getNewWarpId()));
- return &warps[getWarpCount() - 1];
+ warps.append(new MapWarp(pokemod, w, getNewWarpId()));
+ return warps[getWarpCount() - 1];
}
void Map::deleteWarp(const int i) throw(IndexException)
{
if (getWarpCount() <= i)
throw(IndexException(className));
+ delete warps[i];
warps.removeAt(i);
}
@@ -629,14 +648,14 @@ const MapWildList* Map::getWildList(const int i) const throw(IndexException)
{
if (getWildListCount() <= i)
throw(IndexException(className));
- return &wildLists.at(i);
+ return wildLists.at(i);
}
MapWildList* Map::getWildList(const int i) throw(IndexException)
{
if (getWildListCount() <= i)
throw(IndexException(className));
- return &wildLists[i];
+ return wildLists[i];
}
const MapWildList* Map::getWildListByID(const int i) const throw(IndexException)
@@ -653,7 +672,7 @@ int Map::getWildListIndex(const int _id) const
{
for (int i = 0; i < getWildListCount(); ++i)
{
- if (wildLists[i].getId() == _id)
+ if (wildLists[i]->getId() == _id)
return i;
}
return -1;
@@ -666,26 +685,27 @@ int Map::getWildListCount() const
MapWildList* Map::newWildList()
{
- wildLists.append(MapWildList(pokemod, getNewWildListId()));
- return &wildLists[getWildListCount() - 1];
+ wildLists.append(new MapWildList(pokemod, getNewWildListId()));
+ return wildLists[getWildListCount() - 1];
}
MapWildList* Map::newWildList(const QString& fname)
{
- wildLists.append(MapWildList(pokemod, fname, getNewWildListId()));
- return &wildLists[getWildListCount() - 1];
+ wildLists.append(new MapWildList(pokemod, fname, getNewWildListId()));
+ return wildLists[getWildListCount() - 1];
}
MapWildList* Map::newWildList(const MapWildList& w)
{
- wildLists.append(MapWildList(pokemod, w, getNewWildListId()));
- return &wildLists[getWildListCount() - 1];
+ wildLists.append(new MapWildList(pokemod, w, getNewWildListId()));
+ return wildLists[getWildListCount() - 1];
}
void Map::deleteWildList(const int i) throw(IndexException)
{
if (getWildListCount() <= i)
throw(IndexException(className));
+ delete wildLists[i];
wildLists.removeAt(i);
}
@@ -699,15 +719,15 @@ Map& Map::operator=(const Map& rhs)
tiles = rhs.tiles;
effects.clear();
for (int i = 0; i < rhs.getEffectCount(); ++i)
- effects.append(MapEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
+ effects.append(new MapEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
trainers.clear();
for (int i = 0; i < rhs.getTrainerCount(); ++i)
- trainers.append(MapTrainer(pokemod, *rhs.getTrainer(i), rhs.getTrainer(i)->getId()));
+ trainers.append(new MapTrainer(pokemod, *rhs.getTrainer(i), rhs.getTrainer(i)->getId()));
warps.clear();
for (int i = 0; i < rhs.getWarpCount(); ++i)
- warps.append(MapWarp(pokemod, *rhs.getWarp(i), rhs.getWarp(i)->getId()));
+ warps.append(new MapWarp(pokemod, *rhs.getWarp(i), rhs.getWarp(i)->getId()));
wildLists.clear();
for (int i = 0; i < rhs.getWildListCount(); ++i)
- wildLists.append(MapWildList(pokemod, *rhs.getWildList(i), rhs.getWildList(i)->getId()));
+ wildLists.append(new MapWildList(pokemod, *rhs.getWildList(i), rhs.getWildList(i)->getId()));
return *this;
}
diff --git a/pokemod/Map.h b/pokemod/Map.h
index 70697799..2acc5b84 100644
--- a/pokemod/Map.h
+++ b/pokemod/Map.h
@@ -31,11 +31,11 @@
#include <Matrix.h>
#include "Object.h"
-#include "MapEffect.h"
-#include "MapTrainer.h"
-#include "MapWarp.h"
-#include "MapWildList.h"
+class MapEffect;
+class MapTrainer;
+class MapWarp;
+class MapWildList;
class Pokemod;
class Map : public Object
@@ -53,6 +53,7 @@ class Map : public Object
Map(const Pokemod* par, const int _id);
Map(const Pokemod* par, const Map& m, const int _id);
Map(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~Map();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -136,10 +137,10 @@ class Map : public Object
int type;
Matrix<int> tiles;
- QList<MapEffect> effects;
- QList<MapTrainer> trainers;
- QList<MapWarp> warps;
- QList<MapWildList> wildLists;
+ QList<MapEffect*> effects;
+ QList<MapTrainer*> trainers;
+ QList<MapWarp*> warps;
+ QList<MapWildList*> wildLists;
};
#endif
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index 5ca7f96f..484e304f 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -104,7 +104,7 @@ bool MapEffect::validate() const
pokemod->validationMsg("Invalid effect");
valid = false;
}
- if (D_End_None <= direction)
+ if (Pokemod::D_End_None <= direction)
{
pokemod->validationMsg("Invalid driection");
valid = false;
@@ -247,7 +247,7 @@ void MapEffect::setVal2(const int v2) throw(Exception)
void MapEffect::setDirection(const int d) throw(BoundsException)
{
- if (D_End_None <= d)
+ if (Pokemod::D_End_None <= d)
throw(BoundsException(className, "direction"));
direction = d;
}
diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp
index cd6b4c98..5688c34f 100644
--- a/pokemod/MapTrainer.cpp
+++ b/pokemod/MapTrainer.cpp
@@ -29,6 +29,7 @@
#include "Pokemod.h"
#include "Dialog.h"
+#include "MapTrainerTeamMember.h"
#include "MapTrainer.h"
MapTrainer::MapTrainer(const Pokemod* par, const int _id) :
@@ -60,6 +61,12 @@ MapTrainer::MapTrainer(const Pokemod* par, const QString& fname, const int _id)
load(fname, _id);
}
+MapTrainer::~MapTrainer()
+{
+ for (QListIterator<MapTrainerTeamMember*> i(teamMembers); i.hasNext(); )
+ delete i.next();
+}
+
bool MapTrainer::validate() const
{
bool valid = true;
@@ -74,7 +81,7 @@ bool MapTrainer::validate() const
pokemod->validationMsg("Skin could't be found");
valid = false;
}
- if (D_End_None <= direction)
+ if (Pokemod::D_End_None <= direction)
{
pokemod->validationMsg("Invalid direction");
valid = false;
@@ -112,11 +119,11 @@ bool MapTrainer::validate() const
if (getTeamMemberCount())
{
QMap<int, int> idChecker;
- for (QListIterator<MapTrainerTeamMember> i(teamMembers); i.hasNext(); i.next())
+ for (QListIterator<MapTrainerTeamMember*> i(teamMembers); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -202,8 +209,8 @@ void MapTrainer::save(const QString& map) const throw(Exception)
ini.addField("loseDialog", loseDialog);
ini.addField("leadTeamMember", leadTeamMember);
ini.save(QString("%1/map/%2/trainer/%3/data.pini").arg(pokemod->getPath()).arg(map).arg(name));
- for (QListIterator<MapTrainerTeamMember> i(teamMembers); i.hasNext(); )
- i.next().save(map, name);
+ for (QListIterator<MapTrainerTeamMember*> i(teamMembers); i.hasNext(); )
+ i.next()->save(map, name);
}
void MapTrainer::setName(const QString& n)
@@ -240,7 +247,7 @@ void MapTrainer::setSight(const int s)
void MapTrainer::setDirection(const int d) throw(BoundsException)
{
- if (D_End_None <= d)
+ if (Pokemod::D_End_None <= d)
throw(BoundsException(className, "direction"));
direction = d;
}
@@ -366,14 +373,14 @@ const MapTrainerTeamMember* MapTrainer::getTeamMember(const int i) const throw(I
{
if (getTeamMemberCount() <= i)
throw(IndexException(className));
- return &teamMembers.at(i);
+ return teamMembers.at(i);
}
MapTrainerTeamMember* MapTrainer::getTeamMember(const int i) throw(IndexException)
{
if (getTeamMemberCount() <= i)
throw(IndexException(className));
- return &teamMembers[i];
+ return teamMembers[i];
}
const MapTrainerTeamMember* MapTrainer::getTeamMemberByID(const int i) const throw(IndexException)
@@ -390,7 +397,7 @@ int MapTrainer::getTeamMemberIndex(const int _id) const
{
for (int i = 0; i < getTeamMemberCount(); ++i)
{
- if (teamMembers[i].getId() == _id)
+ if (teamMembers[i]->getId() == _id)
return i;
}
return -1;
@@ -403,26 +410,27 @@ int MapTrainer::getTeamMemberCount() const
MapTrainerTeamMember* MapTrainer::newTeamMember()
{
- teamMembers.append(MapTrainerTeamMember(pokemod, getNewId()));
- return &teamMembers[getTeamMemberCount() - 1];
+ teamMembers.append(new MapTrainerTeamMember(pokemod, getNewId()));
+ return teamMembers[getTeamMemberCount() - 1];
}
MapTrainerTeamMember* MapTrainer::newTeamMember(const QString& fname)
{
- teamMembers.append(MapTrainerTeamMember(pokemod, fname, getNewId()));
- return &teamMembers[getTeamMemberCount() - 1];
+ teamMembers.append(new MapTrainerTeamMember(pokemod, fname, getNewId()));
+ return teamMembers[getTeamMemberCount() - 1];
}
MapTrainerTeamMember* MapTrainer::newTeamMember(const MapTrainerTeamMember& p)
{
- teamMembers.append(MapTrainerTeamMember(pokemod, p, getNewId()));
- return &teamMembers[getTeamMemberCount() - 1];
+ teamMembers.append(new MapTrainerTeamMember(pokemod, p, getNewId()));
+ return teamMembers[getTeamMemberCount() - 1];
}
void MapTrainer::deleteTeamMember(const int i) throw(IndexException)
{
if (getTeamMemberCount() <= i)
throw(IndexException(className));
+ delete teamMembers[i];
teamMembers.removeAt(i);
}
@@ -444,6 +452,6 @@ MapTrainer& MapTrainer::operator=(const MapTrainer& rhs)
leadTeamMember = rhs.leadTeamMember;
teamMembers.clear();
for (int i = 0; i < rhs.getTeamMemberCount(); ++i)
- teamMembers.append(MapTrainerTeamMember(pokemod, *rhs.getTeamMember(i), rhs.getTeamMember(i)->getId()));
+ teamMembers.append(new MapTrainerTeamMember(pokemod, *rhs.getTeamMember(i), rhs.getTeamMember(i)->getId()));
return *this;
}
diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h
index 168c1053..bf9e07ea 100644
--- a/pokemod/MapTrainer.h
+++ b/pokemod/MapTrainer.h
@@ -31,8 +31,8 @@
#include <Point.h>
#include "Object.h"
-#include "MapTrainerTeamMember.h"
+class MapTrainerTeamMember;
class Pokemod;
class MapTrainer : public Object
@@ -41,6 +41,7 @@ class MapTrainer : public Object
MapTrainer(const Pokemod* par, const int _id);
MapTrainer(const Pokemod* par, const MapTrainer& t, const int _id);
MapTrainer(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~MapTrainer();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save(const QString& map) const throw(Exception);
@@ -104,7 +105,7 @@ class MapTrainer : public Object
int loseDialog;
int leadTeamMember;
- QList<MapTrainerTeamMember> teamMembers;
+ QList<MapTrainerTeamMember*> teamMembers;
};
#endif
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp
index 1cc17994..35d56de7 100644
--- a/pokemod/MapWarp.cpp
+++ b/pokemod/MapWarp.cpp
@@ -41,7 +41,7 @@ MapWarp::MapWarp(const Pokemod* par, const int _id) :
workingFlag(0, 0),
dialog(-1)
{
- for (int i = 0; i < D_End; ++i)
+ for (int i = 0; i < Pokemod::D_End; ++i)
from[i] = false;
}
@@ -66,12 +66,12 @@ bool MapWarp::validate() const
pokemod->validationMsg("Name is not defined");
valid = false;
}
- if (!from[D_Up] && !from[D_Down] && !from[D_Left] && !from[D_Right])
+ if (!from[Pokemod::D_Up] && !from[Pokemod::D_Down] && !from[Pokemod::D_Left] && !from[Pokemod::D_Right])
{
pokemod->validationMsg("No access from any direction");
valid = false;
}
- if (D_End_None <= directionOut)
+ if (Pokemod::D_End_None <= directionOut)
{
pokemod->validationMsg("Invalid direction out");
valid = false;
@@ -115,10 +115,10 @@ void MapWarp::load(const QString& fname, const int _id) throw(Exception)
ini.getValue("coordinate-x", i, 0);
ini.getValue("coordinate-y", j, 0);
coordinate.set(i, j);
- ini.getValue("from-up", from[D_Up], false);
- ini.getValue("from-down", from[D_Down], false);
- ini.getValue("from-left", from[D_Left], false);
- ini.getValue("from-right", from[D_Right], false);
+ ini.getValue("from-up", from[Pokemod::D_Up], false);
+ ini.getValue("from-down", from[Pokemod::D_Down], false);
+ ini.getValue("from-left", from[Pokemod::D_Left], false);
+ ini.getValue("from-right", from[Pokemod::D_Right], false);
ini.getValue("directionOut", directionOut);
ini.getValue("warpType", warpType);
ini.getValue("isBiking", isBiking, false);
@@ -138,10 +138,10 @@ void MapWarp::save(const QString& map) const throw(Exception)
ini.addField("id", id);
ini.addField("coordinate-x", coordinate.getX());
ini.addField("coordinate-y", coordinate.getY());
- ini.addField("from-up", from[D_Up]);
- ini.addField("from-down", from[D_Down]);
- ini.addField("from-left", from[D_Left]);
- ini.addField("from-right", from[D_Right]);
+ ini.addField("from-up", from[Pokemod::D_Up]);
+ ini.addField("from-down", from[Pokemod::D_Down]);
+ ini.addField("from-left", from[Pokemod::D_Left]);
+ ini.addField("from-right", from[Pokemod::D_Right]);
ini.addField("directionOut", directionOut);
ini.addField("warpType", warpType);
ini.addField("isBiking", isBiking);
@@ -177,14 +177,14 @@ void MapWarp::setCoordinateY(const int y)
void MapWarp::setFrom(const int d, const bool f) throw(BoundsException)
{
- if (D_End <= d)
+ if (Pokemod::D_End <= d)
throw(BoundsException(className, "direction"));
from[d] = f;
}
void MapWarp::setDirectionOut(const int d) throw(BoundsException)
{
- if (D_End <= d)
+ if (Pokemod::D_End <= d)
throw(BoundsException(className, "direction"));
directionOut = d;
}
@@ -267,7 +267,7 @@ Point MapWarp::getCoordinate() const
bool MapWarp::getFrom(const int d) const throw(BoundsException)
{
- if (D_End <= d)
+ if (Pokemod::D_End <= d)
throw(BoundsException(className, "direction"));
return from[d];
}
@@ -323,7 +323,7 @@ MapWarp& MapWarp::operator=(const MapWarp& rhs)
return *this;
name = rhs.name;
coordinate = rhs.coordinate;
- for (int i = 0; i < D_End; ++i)
+ for (int i = 0; i < Pokemod::D_End; ++i)
from[i] = rhs.from[i];
directionOut = rhs.directionOut;
warpType = rhs.warpType;
diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h
index a852b3d2..0a70f695 100644
--- a/pokemod/MapWarp.h
+++ b/pokemod/MapWarp.h
@@ -90,7 +90,7 @@ class MapWarp : public Object
QString name;
Point coordinate;
- bool from[D_End];
+ bool from[Pokemod::D_End];
int directionOut;
int warpType;
int isBiking;
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 68ff881b..737f506d 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -30,6 +30,7 @@
#include "Pokemod.h"
#include "Item.h"
#include "ItemEffect.h"
+#include "MapWildListEncounter.h"
#include "MapWildList.h"
const QStringList MapWildList::ControlStr = QStringList() << "Grass" << "Surfing" << "Fishing" << "Dive" << "Headbutt" << "Rock Smash";
@@ -54,6 +55,12 @@ MapWildList::MapWildList(const Pokemod* par, const QString& fname, const int _id
load(fname, _id);
}
+MapWildList::~MapWildList()
+{
+ for (QListIterator<MapWildListEncounter*> i(encounters); i.hasNext(); )
+ delete i.next();
+}
+
bool MapWildList::validate() const
{
bool valid = true;
@@ -117,6 +124,7 @@ bool MapWildList::validate() const
valid = false;
}
}
+ // TODO: MapWildList Encounter validation
return valid;
}
@@ -170,8 +178,8 @@ void MapWildList::save(const QString& map) const throw(Exception)
ini.addField(QString("time-%1").arg(i), times[i]);
ini.addField("scope", scope);
ini.save(QString("%1/map/%2/wildlist/%3/data.pini").arg(pokemod->getPath()).arg(map).arg(id));
- for (QListIterator<MapWildListEncounter> i(encounters); i.hasNext(); )
- i.next().save(map, id);
+ for (QListIterator<MapWildListEncounter*> i(encounters); i.hasNext(); )
+ i.next()->save(map, id);
}
void MapWildList::setControl(const int c) throw(BoundsException)
@@ -267,14 +275,14 @@ const MapWildListEncounter* MapWildList::getEncounter(const int i) const throw(I
{
if (getEncounterCount() <= i)
throw(IndexException(className));
- return &encounters.at(i);
+ return encounters.at(i);
}
MapWildListEncounter* MapWildList::getEncounter(const int i) throw(IndexException)
{
if (getEncounterCount() <= i)
throw(IndexException(className));
- return &encounters[i];
+ return encounters[i];
}
const MapWildListEncounter* MapWildList::getEncounterByID(const int i) const throw(IndexException)
@@ -291,7 +299,7 @@ int MapWildList::getEncounterIndex(const int _id) const
{
for (int i = 0; i < getEncounterCount(); ++i)
{
- if (encounters[i].getId() == _id)
+ if (encounters[i]->getId() == _id)
return i;
}
return -1;
@@ -304,26 +312,27 @@ int MapWildList::getEncounterCount() const
MapWildListEncounter* MapWildList::newEncounter()
{
- encounters.append(MapWildListEncounter(pokemod, getNewId()));
- return &encounters[getEncounterCount() - 1];
+ encounters.append(new MapWildListEncounter(pokemod, getNewId()));
+ return encounters[getEncounterCount() - 1];
}
MapWildListEncounter* MapWildList::newEncounter(const QString& fname)
{
- encounters.append(MapWildListEncounter(pokemod, fname, getNewId()));
- return &encounters[getEncounterCount() - 1];
+ encounters.append(new MapWildListEncounter(pokemod, fname, getNewId()));
+ return encounters[getEncounterCount() - 1];
}
MapWildListEncounter* MapWildList::newEncounter(const MapWildListEncounter& p)
{
- encounters.append(MapWildListEncounter(pokemod, p, getNewId()));
- return &encounters[getEncounterCount() - 1];
+ encounters.append(new MapWildListEncounter(pokemod, p, getNewId()));
+ return encounters[getEncounterCount() - 1];
}
void MapWildList::deleteEncounter(const int i) throw(IndexException)
{
if (getEncounterCount() <= i)
throw(IndexException(className));
+ delete encounters[i];
encounters.removeAt(i);
}
@@ -337,6 +346,6 @@ MapWildList& MapWildList::operator=(const MapWildList& rhs)
scope = rhs.scope;
encounters.clear();
for (int i = 0; i < rhs.getEncounterCount(); ++i)
- newEncounter(*rhs.getEncounter(i));
+ encounters.append(new MapWildListEncounter(pokemod, *rhs.getEncounter(i), rhs.getEncounter(i)->getId()));
return *this;
}
diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h
index 4a2e1972..6026f18b 100644
--- a/pokemod/MapWildList.h
+++ b/pokemod/MapWildList.h
@@ -30,8 +30,8 @@
#include <Exception.h>
#include "Object.h"
-#include "MapWildListEncounter.h"
+class MapWildListEncounter;
class Pokemod;
class MapWildList : public Object
@@ -52,6 +52,7 @@ class MapWildList : public Object
MapWildList(const Pokemod* par, const int _id);
MapWildList(const Pokemod* par, const MapWildList& w, const int _id);
MapWildList(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~MapWildList();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save(const QString& map) const throw(Exception);
@@ -87,7 +88,7 @@ class MapWildList : public Object
QList<int> times;
int scope;
- QList<MapWildListEncounter> encounters;
+ QList<MapWildListEncounter*> encounters;
};
#endif
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp
index f79f5c3c..6f8ad323 100644
--- a/pokemod/Move.cpp
+++ b/pokemod/Move.cpp
@@ -27,6 +27,7 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "MoveEffect.h"
#include "Move.h"
const QStringList Move::TargetStr = QStringList() << "Player" << "Enemy" << "Both" << "Random";
@@ -63,6 +64,12 @@ Move::Move(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+Move::~Move()
+{
+ for (QListIterator<MoveEffect*> i(effects); i.hasNext(); )
+ delete i.next();
+}
+
bool Move::validate() const
{
bool valid = true;
@@ -100,11 +107,11 @@ bool Move::validate() const
if (getEffectCount())
{
QMap<int, int> idChecker;
- for (QListIterator<MoveEffect> i(effects); i.hasNext(); i.next())
+ for (QListIterator<MoveEffect*> i(effects); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -189,8 +196,8 @@ void Move::save() const throw(Exception)
ini.addField("sound", sound);
ini.addField("description", description);
ini.save(QString("%1/move/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<MoveEffect> i(effects); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<MoveEffect*> i(effects); i.hasNext(); )
+ i.next()->save(name);
}
void Move::setName(const QString& n)
@@ -357,14 +364,14 @@ const MoveEffect* Move::getEffect(const int i) const throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects.at(i);
+ return effects.at(i);
}
MoveEffect* Move::getEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
- return &effects[i];
+ return effects[i];
}
const MoveEffect* Move::getEffectByID(const int i) const throw(IndexException)
@@ -381,7 +388,7 @@ int Move::getEffectIndex(const int _id) const
{
for (int i = 0; i < getEffectCount(); ++i)
{
- if (effects[i].getId() == _id)
+ if (effects[i]->getId() == _id)
return i;
}
return -1;
@@ -394,26 +401,27 @@ int Move::getEffectCount() const
MoveEffect* Move::newEffect()
{
- effects.append(MoveEffect(pokemod, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MoveEffect(pokemod, getNewId()));
+ return effects[getEffectCount() - 1];
}
MoveEffect* Move::newEffect(const QString& fname)
{
- effects.append(MoveEffect(pokemod, fname, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MoveEffect(pokemod, fname, getNewId()));
+ return effects[getEffectCount() - 1];
}
MoveEffect* Move::newEffect(const MoveEffect& e)
{
- effects.append(MoveEffect(pokemod, e, getNewId()));
- return &effects[getEffectCount() - 1];
+ effects.append(new MoveEffect(pokemod, e, getNewId()));
+ return effects[getEffectCount() - 1];
}
void Move::deleteEffect(const int i) throw(IndexException)
{
if (getEffectCount() <= i)
throw(IndexException(className));
+ delete effects[i];
effects.removeAt(i);
}
@@ -438,6 +446,6 @@ Move& Move::operator=(const Move& rhs)
description = rhs.description;
effects.clear();
for (int i = 0; i < rhs.getEffectCount(); ++i)
- newEffect(*rhs.getEffect(i));
+ effects.append(new MoveEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId()));
return *this;
}
diff --git a/pokemod/Move.h b/pokemod/Move.h
index 76dab95d..b56fbc0e 100644
--- a/pokemod/Move.h
+++ b/pokemod/Move.h
@@ -30,8 +30,8 @@
#include <Exception.h>
#include "Object.h"
-#include "MoveEffect.h"
+class MoveEffect;
class Pokemod;
class Move : public Object
@@ -59,6 +59,7 @@ class Move : public Object
Move(const Pokemod* par, const int _id);
Move(const Pokemod* par, const Move& m, const int _id);
Move(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~Move();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -127,7 +128,7 @@ class Move : public Object
bool sound;
QString description;
- QList<MoveEffect> effects;
+ QList<MoveEffect*> effects;
};
#endif
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
index e2baf049..7db04244 100644
--- a/pokemod/MoveEffect.cpp
+++ b/pokemod/MoveEffect.cpp
@@ -20,8 +20,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include <Ref.h>
-
#include "Pokemod.h"
#include "MoveEffect.h"
@@ -133,11 +131,11 @@ void MoveEffect::setVal1(const int v1) throw(Exception)
break;
case E_Status:
case E_NeedStatus:
- if (STS_End <= v1)
+ if (Pokemod::STS_End <= v1)
throw(BoundsException(className, "val1"));
throw;
case E_Stat:
- if (ST_End_Battle <= v1)
+ if (Pokemod::ST_End_Battle <= v1)
throw(BoundsException(className, "val1"));
break;
case E_Counter:
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index eaacfab8..fa52ef43 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -28,7 +28,7 @@ Nature::Nature(const Pokemod* par, const int _id) :
name(""),
weight(1)
{
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
stats[i].set(1, 1, Frac::Improper);
}
@@ -71,7 +71,7 @@ void Nature::load(const QString& fname, const int _id) throw(Exception)
int i;
int j;
ini.getValue("name", name);
- for (int k = 0; k < ST_End_GSC; ++k)
+ for (int k = 0; k < Pokemod::ST_End_GSC; ++k)
{
ini.getValue(QString("stat-%1-n").arg(k), i, 1);
ini.getValue(QString("stat-%1-n").arg(k), j, 1);
@@ -84,7 +84,7 @@ void Nature::save() const throw(Exception)
{
Ini ini;
ini.addField("name", name);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
{
ini.addField(QString("stat-%1-n").arg(i), stats[i].getNum());
ini.addField(QString("stat-%1-d").arg(i), stats[i].getNum());
@@ -100,21 +100,21 @@ void Nature::setName(const QString& n)
void Nature::setStat(const int s, const int n, const int d) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].set(n, d);
}
void Nature::setStatNum(const int s, const int n) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].setNum(n);
}
void Nature::setStatDenom(const int s, const int d) throw(Exception)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
stats[s].setDenom(d);
}
@@ -133,7 +133,7 @@ QString Nature::getName() const
Frac Nature::getStat(const int s) const throw(BoundsException)
{
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= s)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= s)
throw(BoundsException(className, "stat"));
return stats[s];
}
@@ -148,7 +148,7 @@ Nature& Nature::operator=(const Nature& rhs)
if (this == &rhs)
return *this;
name = rhs.name;
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
stats[i] = rhs.stats[i];
weight = rhs.weight;
return *this;
diff --git a/pokemod/Nature.h b/pokemod/Nature.h
index 94822bfe..59322536 100644
--- a/pokemod/Nature.h
+++ b/pokemod/Nature.h
@@ -27,7 +27,6 @@
#include <Exception.h>
#include <Frac.h>
-#include <Ref.h>
#include "Object.h"
@@ -58,7 +57,7 @@ class Nature : public Object
bool validate() const;
QString name;
- Frac stats[ST_End_GSC];
+ Frac stats[Pokemod::ST_End_GSC];
int weight;
};
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 71d77375..b4b94b9c 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -28,11 +28,33 @@
#include <QTextStream>
#include <QTime>
-#include <Ref.h>
-
+#include "Ability.h"
+#include "Author.h"
+#include "Badge.h"
+#include "CoinList.h"
+#include "Dialog.h"
+#include "EggGroup.h"
+#include "Item.h"
+#include "ItemType.h"
+#include "Map.h"
+#include "Move.h"
+#include "Nature.h"
+#include "Species.h"
+#include "Store.h"
+#include "Tile.h"
+#include "Time.h"
+#include "Type.h"
#include "Pokemod.h"
const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error";
+const QStringList Pokemod::StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "Special" << "Accuracy" << "Evasion";
+const QStringList Pokemod::StatGSCStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special Attack" << "Special Defense" << "Accuracy" << "Evasion";
+const QStringList Pokemod::BattleMemberStr = QStringList() << "Player" << "Enemy";
+const QStringList Pokemod::WeatherStr = QStringList() << "Ice" << "Rain" << "Sun" << "Sand" << "All";
+const QStringList Pokemod::DirectionStr = QStringList() << "Up" << "Down" << "Left" << "Right" << "None";
+const QStringList Pokemod::RelativeStr = QStringList() << "Less" << "Less or Equal" << "Greater or Equal" << "Greater" << "Equal" << "Not Equal";
+const QStringList Pokemod::StatusStr = QStringList() << "Freeze" << "Paralyze" << "Sleep" << "Poison" << "Toxic Poison" << "Burn" << "Any";
+const QStringList Pokemod::HMStr = QStringList() << "Cut" << "Fly" << "Surf" << "Strength" << "Flash" << "Whirlpool" << "Waterfall" << "Dive" << "Headbutt" << "Rock Smash" << "Defog" << "Rock Climb" << "Heal" << "Escape";
Pokemod::Pokemod() :
Object("Pokemod", this, 0),
@@ -73,6 +95,40 @@ Pokemod::Pokemod(const QString& fname) :
load(fname);
}
+Pokemod::~Pokemod()
+{
+ for (QListIterator<Ability*> i(abilities); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Author*> i(authors); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Badge*> i(badges); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<CoinList*> i(coinLists); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Dialog*> i(dialogs); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Item*> i(items); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Map*> i(maps); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Nature*> i(natures); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Species*> i(species); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Store*> i(stores); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Tile*> i(tiles); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Time*> i(times); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<Type*> i(types); i.hasNext(); )
+ delete i.next();
+}
+
bool Pokemod::validate() const
{
bool valid = true;
@@ -153,12 +209,12 @@ bool Pokemod::validate() const
validationMsg("There are no abilities");
valid = false;
}
- for (QListIterator<Ability> i(abilities); i.hasNext(); i.next())
+ for (QListIterator<Ability*> i(abilities); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -184,12 +240,12 @@ bool Pokemod::validate() const
validationMsg("There are no authors");
valid = false;
}
- for (QListIterator<Author> i(authors); i.hasNext(); i.next())
+ for (QListIterator<Author*> i(authors); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -211,12 +267,12 @@ bool Pokemod::validate() const
nameChecker.clear();
if (!getBadgeCount())
validationMsg("There are no badges", V_Warn);
- for (QListIterator<Badge> i(badges); i.hasNext(); i.next())
+ for (QListIterator<Badge*> i(badges); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -238,12 +294,12 @@ bool Pokemod::validate() const
nameChecker.clear();
if (!getCoinListCount())
validationMsg("There are no coin lists", V_Warn);
- for (QListIterator<CoinList> i(coinLists); i.hasNext(); i.next())
+ for (QListIterator<CoinList*> i(coinLists); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -268,11 +324,11 @@ bool Pokemod::validate() const
validationMsg("There are no dialogs");
valid = false;
}
- for (QListIterator<Dialog> i(dialogs); i.hasNext(); i.next())
+ for (QListIterator<Dialog*> i(dialogs); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
+ ++idChecker[i.peekNext()->getId()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -290,12 +346,12 @@ bool Pokemod::validate() const
validationMsg("There are no egg grous");
valid = false;
}
- for (QListIterator<EggGroup> i(eggGroups); i.hasNext(); i.next())
+ for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -318,12 +374,12 @@ bool Pokemod::validate() const
}
if (!getItemCount())
validationMsg("There are no items", V_Warn);
- for (QListIterator<Item> i(items); i.hasNext(); i.next())
+ for (QListIterator<Item*> i(items); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -349,12 +405,12 @@ bool Pokemod::validate() const
if (getItemCount())
valid = false;
}
- for (QListIterator<ItemType> i(itemTypes); i.hasNext(); i.next())
+ for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -379,12 +435,12 @@ bool Pokemod::validate() const
validationMsg("There are no maps");
valid = false;
}
- for (QListIterator<Map> i(maps); i.hasNext(); i.next())
+ for (QListIterator<Map*> i(maps); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -409,12 +465,12 @@ bool Pokemod::validate() const
validationMsg("There are no moves");
valid = false;
}
- for (QListIterator<Move> i(moves); i.hasNext(); i.next())
+ for (QListIterator<Move*> i(moves); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -441,12 +497,12 @@ bool Pokemod::validate() const
validationMsg("There are no natures");
valid = false;
}
- for (QListIterator<Nature> i(natures); i.hasNext(); i.next())
+ for (QListIterator<Nature*> i(natures); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -472,12 +528,12 @@ bool Pokemod::validate() const
validationMsg("There are no species");
valid = false;
}
- for (QListIterator<Species> i(species); i.hasNext(); i.next())
+ for (QListIterator<Species*> i(species); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -499,12 +555,12 @@ bool Pokemod::validate() const
nameChecker.clear();
if (!getStoreCount())
validationMsg("There are no stores", V_Warn);
- for (QListIterator<Store> i(stores); i.hasNext(); i.next())
+ for (QListIterator<Store*> i(stores); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -526,12 +582,12 @@ bool Pokemod::validate() const
nameChecker.clear();
if (getTileCount())
{
- for (QListIterator<Tile> i(tiles); i.hasNext(); i.next())
+ for (QListIterator<Tile*> i(tiles); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -562,13 +618,13 @@ bool Pokemod::validate() const
validationMsg("There are no times");
valid = false;
}
- for (QListIterator<Time> i(times); i.hasNext(); i.next())
+ for (QListIterator<Time*> i(times); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
- ++timeChecker[(60 * i.peekNext().getStartHour()) + i.peekNext().getStartMinute()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
+ ++timeChecker[(60 * i.peekNext()->getStartHour()) + i.peekNext()->getStartMinute()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -601,12 +657,12 @@ bool Pokemod::validate() const
validationMsg("There are no types");
valid = false;
}
- for (QListIterator<Type> i(types); i.hasNext(); i.next())
+ for (QListIterator<Type*> i(types); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getName()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getName()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -912,38 +968,38 @@ void Pokemod::save() const throw(Exception)
}
ini.save(QString("%1/data.pini").arg(getPath()));
rules.save();
- for (QListIterator<Ability> i(abilities); i.hasNext(); )
- i.next().save();
- for (QListIterator<Author> i(authors); i.hasNext(); )
- i.next().save();
- for (QListIterator<Badge> i(badges); i.hasNext(); )
- i.next().save();
- for (QListIterator<CoinList> i(coinLists); i.hasNext(); )
- i.next().save();
- for (QListIterator<Dialog> i(dialogs); i.hasNext(); )
- i.next().save();
- for (QListIterator<EggGroup> i(eggGroups); i.hasNext(); )
- i.next().save();
- for (QListIterator<Item> i(items); i.hasNext(); )
- i.next().save();
- for (QListIterator<ItemType> i(itemTypes); i.hasNext(); )
- i.next().save();
- for (QListIterator<Map> i(maps); i.hasNext(); )
- i.next().save();
- for (QListIterator<Move> i(moves); i.hasNext(); )
- i.next().save();
- for (QListIterator<Nature> i(natures); i.hasNext(); )
- i.next().save();
- for (QListIterator<Species> i(species); i.hasNext(); )
- i.next().save();
- for (QListIterator<Store> i(stores); i.hasNext(); )
- i.next().save();
- for (QListIterator<Tile> i(tiles); i.hasNext(); )
- i.next().save();
- for (QListIterator<Time> i(times); i.hasNext(); )
- i.next().save();
- for (QListIterator<Type> i(types); i.hasNext(); )
- i.next().save();
+ for (QListIterator<Ability*> i(abilities); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Author*> i(authors); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Badge*> i(badges); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<CoinList*> i(coinLists); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Dialog*> i(dialogs); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<EggGroup*> i(eggGroups); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Item*> i(items); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<ItemType*> i(itemTypes); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Map*> i(maps); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Move*> i(moves); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Nature*> i(natures); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Species*> i(species); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Store*> i(stores); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Tile*> i(tiles); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Time*> i(times); i.hasNext(); )
+ i.next()->save();
+ for (QListIterator<Type*> i(types); i.hasNext(); )
+ i.next()->save();
}
QString Pokemod::getPath() const
@@ -1189,14 +1245,14 @@ const Ability* Pokemod::getAbility(const int i) const throw(IndexException)
{
if (getAbilityCount() <= i)
throw(IndexException(className));
- return &abilities.at(i);
+ return abilities.at(i);
}
Ability* Pokemod::getAbility(const int i) throw(IndexException)
{
if (getAbilityCount() <= i)
throw(IndexException(className));
- return &abilities[i];
+ return abilities[i];
}
const Ability* Pokemod::getAbilityByID(const int i) const throw(IndexException)
@@ -1213,7 +1269,7 @@ int Pokemod::getAbilityIndex(const int _id) const
{
for (int i = 0; i < getAbilityCount(); ++i)
{
- if (abilities[i].getId() == _id)
+ if (abilities[i]->getId() == _id)
return i;
}
return -1;
@@ -1226,26 +1282,27 @@ int Pokemod::getAbilityCount() const
Ability* Pokemod::newAbility()
{
- abilities.append(Ability(this, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new Ability(this, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
Ability* Pokemod::newAbility(const QString& fname)
{
- abilities.append(Ability(this, fname, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new Ability(this, fname, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
Ability* Pokemod::newAbility(const Ability& a)
{
- abilities.append(Ability(this, a, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new Ability(this, a, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
void Pokemod::deleteAbility(const int i) throw(IndexException)
{
if (getAbilityCount() <= i)
throw(IndexException(className));
+ delete abilities[i];
abilities.removeAt(i);
}
@@ -1253,14 +1310,14 @@ const Author* Pokemod::getAuthor(const int i) const throw(IndexException)
{
if (getAuthorCount() <= i)
throw(IndexException(className));
- return &authors.at(i);
+ return authors.at(i);
}
Author* Pokemod::getAuthor(const int i) throw(IndexException)
{
if (getAuthorCount() <= i)
throw(IndexException(className));
- return &authors[i];
+ return authors[i];
}
const Author* Pokemod::getAuthorByID(const int i) const throw(IndexException)
@@ -1277,7 +1334,7 @@ int Pokemod::getAuthorIndex(const int _id) const
{
for (int i = 0; i < getAuthorCount(); ++i)
{
- if (authors[i].getId() == _id)
+ if (authors[i]->getId() == _id)
return i;
}
return -1;
@@ -1290,26 +1347,27 @@ int Pokemod::getAuthorCount() const
Author* Pokemod::newAuthor()
{
- authors.append(Author(this, getNewAuthorId()));
- return &authors[getAuthorCount() + 1];
+ authors.append(new Author(this, getNewAuthorId()));
+ return authors[getAuthorCount() + 1];
}
Author* Pokemod::newAuthor(const QString& fname)
{
- authors.append(Author(this, fname, getNewAuthorId()));
- return &authors[getAuthorCount() + 1];
+ authors.append(new Author(this, fname, getNewAuthorId()));
+ return authors[getAuthorCount() + 1];
}
Author* Pokemod::newAuthor(const Author& a)
{
- authors.append(Author(this, a, getNewAuthorId()));
- return &authors[getAuthorCount() + 1];
+ authors.append(new Author(this, a, getNewAuthorId()));
+ return authors[getAuthorCount() + 1];
}
void Pokemod::deleteAuthor(const int i) throw(IndexException)
{
if (getAuthorCount() <= i)
throw(IndexException(className));
+ delete authors[i];
authors.removeAt(i);
}
@@ -1317,14 +1375,14 @@ const Badge* Pokemod::getBadge(const int i) const throw(IndexException)
{
if (i < getBadgeCount())
throw(IndexException(className));
- return &badges.at(i);
+ return badges.at(i);
}
Badge* Pokemod::getBadge(const int i) throw(IndexException)
{
if (i < getBadgeCount())
throw(IndexException(className));
- return &badges[i];
+ return badges[i];
}
const Badge* Pokemod::getBadgeByID(const int i) const throw(IndexException)
@@ -1341,7 +1399,7 @@ int Pokemod::getBadgeIndex(const int _id) const
{
for (int i = 0; i < getBadgeCount(); ++i)
{
- if (badges[i].getId() == _id)
+ if (badges[i]->getId() == _id)
return i;
}
return -1;
@@ -1354,26 +1412,27 @@ int Pokemod::getBadgeCount() const
Badge* Pokemod::newBadge()
{
- badges.append(Badge(this, getNewBadgeId()));
- return &badges[getBadgeCount() - 1];
+ badges.append(new Badge(this, getNewBadgeId()));
+ return badges[getBadgeCount() - 1];
}
Badge* Pokemod::newBadge(const QString& fname)
{
- badges.append(Badge(this, fname, getNewBadgeId()));
- return &badges[getBadgeCount() - 1];
+ badges.append(new Badge(this, fname, getNewBadgeId()));
+ return badges[getBadgeCount() - 1];
}
Badge* Pokemod::newBadge(const Badge& b)
{
- badges.append(Badge(this, b, getNewBadgeId()));
- return &badges[getBadgeCount() - 1];
+ badges.append(new Badge(this, b, getNewBadgeId()));
+ return badges[getBadgeCount() - 1];
}
void Pokemod::deleteBadge(const int i) throw(IndexException)
{
if (getBadgeCount() <= i)
throw(IndexException(className));
+ delete badges[i];
badges.removeAt(i);
}
@@ -1381,14 +1440,14 @@ const CoinList* Pokemod::getCoinList(const int i) const throw(IndexException)
{
if (getCoinListCount() <= i)
throw(IndexException(className));
- return &coinLists.at(i);
+ return coinLists.at(i);
}
CoinList* Pokemod::getCoinList(const int i) throw(IndexException)
{
if (getCoinListCount() <= i)
throw(IndexException(className));
- return &coinLists[i];
+ return coinLists[i];
}
const CoinList* Pokemod::getCoinListByID(const int i) const throw(IndexException)
@@ -1405,7 +1464,7 @@ int Pokemod::getCoinListIndex(const int _id) const
{
for (int i = 0; i < getCoinListCount(); ++i)
{
- if (coinLists[i].getId() == _id)
+ if (coinLists[i]->getId() == _id)
return i;
}
return -1;
@@ -1418,26 +1477,27 @@ int Pokemod::getCoinListCount() const
CoinList* Pokemod::newCoinList()
{
- coinLists.append(CoinList(this, getNewCoinListId()));
- return &coinLists[getCoinListCount() - 1];
+ coinLists.append(new CoinList(this, getNewCoinListId()));
+ return coinLists[getCoinListCount() - 1];
}
CoinList* Pokemod::newCoinList(const QString& fname)
{
- coinLists.append(CoinList(this, fname, getNewCoinListId()));
- return &coinLists[getCoinListCount() - 1];
+ coinLists.append(new CoinList(this, fname, getNewCoinListId()));
+ return coinLists[getCoinListCount() - 1];
}
CoinList* Pokemod::newCoinList(const CoinList& c)
{
- coinLists.append(CoinList(this, c, getNewCoinListId()));
- return &coinLists[getCoinListCount() - 1];
+ coinLists.append(new CoinList(this, c, getNewCoinListId()));
+ return coinLists[getCoinListCount() - 1];
}
void Pokemod::deleteCoinList(const int i) throw(IndexException)
{
if (getCoinListCount() <= i)
throw(IndexException(className));
+ delete coinLists[i];
coinLists.removeAt(i);
}
@@ -1445,14 +1505,14 @@ const Dialog* Pokemod::getDialog(const int i) const throw(IndexException)
{
if (getDialogCount() <= i)
throw(IndexException(className));
- return &dialogs.at(i);
+ return dialogs.at(i);
}
Dialog* Pokemod::getDialog(const int i) throw(IndexException)
{
if (getDialogCount() <= i)
throw(IndexException(className));
- return &dialogs[i];
+ return dialogs[i];
}
const Dialog* Pokemod::getDialogByID(const int i) const throw(IndexException)
@@ -1469,7 +1529,7 @@ int Pokemod::getDialogIndex(const int _id) const
{
for (int i = 0; i < getDialogCount(); ++i)
{
- if (dialogs[i].getId() == _id)
+ if (dialogs[i]->getId() == _id)
return i;
}
return -1;
@@ -1482,26 +1542,27 @@ int Pokemod::getDialogCount() const
Dialog* Pokemod::newDialog()
{
- dialogs.append(Dialog(this, getNewDialogId()));
- return &dialogs[getDialogCount() - 1];
+ dialogs.append(new Dialog(this, getNewDialogId()));
+ return dialogs[getDialogCount() - 1];
}
Dialog* Pokemod::newDialog(const QString& fname)
{
- dialogs.append(Dialog(this, fname, getNewDialogId()));
- return &dialogs[getDialogCount() - 1];
+ dialogs.append(new Dialog(this, fname, getNewDialogId()));
+ return dialogs[getDialogCount() - 1];
}
Dialog* Pokemod::newDialog(const Dialog& d)
{
- dialogs.append(Dialog(this, d, getNewDialogId()));
- return &dialogs[getDialogCount() - 1];
+ dialogs.append(new Dialog(this, d, getNewDialogId()));
+ return dialogs[getDialogCount() - 1];
}
void Pokemod::deleteDialog(const int i) throw(IndexException)
{
if (getDialogCount() <= i)
throw(IndexException(className));
+ delete dialogs[i];
dialogs.removeAt(i);
}
@@ -1509,14 +1570,14 @@ const EggGroup* Pokemod::getEggGroup(const int i) const throw(IndexException)
{
if (getEggGroupCount() <= i)
throw(IndexException(className));
- return &eggGroups.at(i);
+ return eggGroups.at(i);
}
EggGroup* Pokemod::getEggGroup(const int i) throw(IndexException)
{
if (getEggGroupCount() <= i)
throw(IndexException(className));
- return &eggGroups[i];
+ return eggGroups[i];
}
const EggGroup* Pokemod::getEggGroupByID(const int i) const throw(IndexException)
@@ -1533,7 +1594,7 @@ int Pokemod::getEggGroupIndex(const int _id) const
{
for (int i = 0; i < getEggGroupCount(); ++i)
{
- if (eggGroups[i].getId() == _id)
+ if (eggGroups[i]->getId() == _id)
return i;
}
return -1;
@@ -1546,26 +1607,27 @@ int Pokemod::getEggGroupCount() const
EggGroup* Pokemod::newEggGroup()
{
- eggGroups.append(EggGroup(this, getNewEggGroupId()));
- return &eggGroups[getEggGroupCount() - 1];
+ eggGroups.append(new EggGroup(this, getNewEggGroupId()));
+ return eggGroups[getEggGroupCount() - 1];
}
EggGroup* Pokemod::newEggGroup(const QString& fname)
{
- eggGroups.append(EggGroup(this, fname, getNewEggGroupId()));
- return &eggGroups[getEggGroupCount() - 1];
+ eggGroups.append(new EggGroup(this, fname, getNewEggGroupId()));
+ return eggGroups[getEggGroupCount() - 1];
}
EggGroup* Pokemod::newEggGroup(const EggGroup& e)
{
- eggGroups.append(EggGroup(this, e, getNewEggGroupId()));
- return &eggGroups[getEggGroupCount() - 1];
+ eggGroups.append(new EggGroup(this, e, getNewEggGroupId()));
+ return eggGroups[getEggGroupCount() - 1];
}
void Pokemod::deleteEggGroup(const int i) throw(IndexException)
{
if (getEggGroupCount() <= i)
throw(IndexException(className));
+ delete eggGroups[i];
eggGroups.removeAt(i);
}
@@ -1573,14 +1635,14 @@ const Item* Pokemod::getItem(const int i) const throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items.at(i);
+ return items.at(i);
}
Item* Pokemod::getItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items[i];
+ return items[i];
}
const Item* Pokemod::getItemByID(const int i) const throw(IndexException)
@@ -1597,7 +1659,7 @@ int Pokemod::getItemIndex(const int _id) const
{
for (int i = 0; i < getItemCount(); ++i)
{
- if (items[i].getId() == _id)
+ if (items[i]->getId() == _id)
return i;
}
return -1;
@@ -1610,26 +1672,27 @@ int Pokemod::getItemCount() const
Item* Pokemod::newItem()
{
- items.append(Item(this, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new Item(this, getNewItemId()));
+ return items[getItemCount() - 1];
}
Item* Pokemod::newItem(const QString& fname)
{
- items.append(Item(this, fname, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new Item(this, fname, getNewItemId()));
+ return items[getItemCount() - 1];
}
Item* Pokemod::newItem(const Item& i)
{
- items.append(Item(this, i, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new Item(this, i, getNewItemId()));
+ return items[getItemCount() - 1];
}
void Pokemod::deleteItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
+ delete items[i];
items.removeAt(i);
}
@@ -1637,14 +1700,14 @@ const ItemType* Pokemod::getItemType(const int i) const throw(IndexException)
{
if (getItemTypeCount() <= i)
throw(IndexException(className));
- return &itemTypes.at(i);
+ return itemTypes.at(i);
}
ItemType* Pokemod::getItemType(const int i) throw(IndexException)
{
if (getItemTypeCount() <= i)
throw(IndexException(className));
- return &itemTypes[i];
+ return itemTypes[i];
}
const ItemType* Pokemod::getItemTypeByID(const int i) const throw(IndexException)
@@ -1661,7 +1724,7 @@ int Pokemod::getItemTypeIndex(const int _id) const
{
for (int i = 0; i < getItemTypeCount(); ++i)
{
- if (itemTypes[i].getId() == _id)
+ if (itemTypes[i]->getId() == _id)
return i;
}
return -1;
@@ -1674,26 +1737,27 @@ int Pokemod::getItemTypeCount() const
ItemType* Pokemod::newItemType()
{
- itemTypes.append(ItemType(this, getNewItemTypeId()));
- return &itemTypes[getItemTypeCount() - 1];
+ itemTypes.append(new ItemType(this, getNewItemTypeId()));
+ return itemTypes[getItemTypeCount() - 1];
}
ItemType* Pokemod::newItemType(const QString& fname)
{
- itemTypes.append(ItemType(this, fname, getNewItemTypeId()));
- return &itemTypes[getItemTypeCount() - 1];
+ itemTypes.append(new ItemType(this, fname, getNewItemTypeId()));
+ return itemTypes[getItemTypeCount() - 1];
}
ItemType* Pokemod::newItemType(const ItemType& i)
{
- itemTypes.append(ItemType(this, i, getNewItemTypeId()));
- return &itemTypes[getItemTypeCount() - 1];
+ itemTypes.append(new ItemType(this, i, getNewItemTypeId()));
+ return itemTypes[getItemTypeCount() - 1];
}
void Pokemod::deleteItemType(const int i) throw(IndexException)
{
if (getItemTypeCount() <= i)
throw(IndexException(className));
+ delete itemTypes[i];
itemTypes.removeAt(i);
}
@@ -1701,14 +1765,14 @@ const Map* Pokemod::getMap(const int i) const throw(IndexException)
{
if (getMapCount() <= i)
throw(IndexException(className));
- return &maps.at(i);
+ return maps.at(i);
}
Map* Pokemod::getMap(const int i) throw(IndexException)
{
if (getMapCount() <= i)
throw(IndexException(className));
- return &maps[i];
+ return maps[i];
}
const Map* Pokemod::getMapByID(const int i) const throw(IndexException)
@@ -1725,7 +1789,7 @@ int Pokemod::getMapIndex(const int _id) const
{
for (int i = 0; i < getMapCount(); ++i)
{
- if (maps[i].getId() == _id)
+ if (maps[i]->getId() == _id)
return i;
}
return -1;
@@ -1738,26 +1802,27 @@ int Pokemod::getMapCount() const
Map* Pokemod::newMap()
{
- maps.append(Map(this, getNewMapId()));
- return &maps[getMapCount() - 1];
+ maps.append(new Map(this, getNewMapId()));
+ return maps[getMapCount() - 1];
}
Map* Pokemod::newMap(const QString& fname)
{
- maps.append(Map(this, fname, getNewMapId()));
- return &maps[getMapCount() - 1];
+ maps.append(new Map(this, fname, getNewMapId()));
+ return maps[getMapCount() - 1];
}
Map* Pokemod::newMap(const Map& m)
{
- maps.append(Map(this, m, getNewMapId()));
- return &maps[getMapCount() - 1];
+ maps.append(new Map(this, m, getNewMapId()));
+ return maps[getMapCount() - 1];
}
void Pokemod::deleteMap(const int i) throw(IndexException)
{
if (getMapCount() <= i)
throw(IndexException(className));
+ delete maps[i];
maps.removeAt(i);
}
@@ -1765,14 +1830,14 @@ const Move* Pokemod::getMove(const int i) const throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
- return &moves.at(i);
+ return moves.at(i);
}
Move* Pokemod::getMove(const int i) throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
- return &moves[i];
+ return moves[i];
}
const Move* Pokemod::getMoveByID(const int i) const throw(IndexException)
@@ -1789,7 +1854,7 @@ int Pokemod::getMoveIndex(const int _id) const
{
for (int i = 0; i < getMoveCount(); ++i)
{
- if (moves[i].getId() == _id)
+ if (moves[i]->getId() == _id)
return i;
}
return -1;
@@ -1802,26 +1867,27 @@ int Pokemod::getMoveCount() const
Move* Pokemod::newMove()
{
- moves.append(Move(this, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new Move(this, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
Move* Pokemod::newMove(const QString& fname)
{
- moves.append(Move(this, fname, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new Move(this, fname, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
Move* Pokemod::newMove(const Move& m)
{
- moves.append(Move(this, m, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new Move(this, m, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
void Pokemod::deleteMove(const int i) throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
+ delete moves[i];
moves.removeAt(i);
}
@@ -1829,14 +1895,14 @@ const Nature* Pokemod::getNature(const int i) const throw(IndexException)
{
if (getNatureCount() <= i)
throw(IndexException(className));
- return &natures.at(i);
+ return natures.at(i);
}
Nature* Pokemod::getNature(const int i) throw(IndexException)
{
if (getNatureCount() <= i)
throw(IndexException(className));
- return &natures[i];
+ return natures[i];
}
const Nature* Pokemod::getNatureByID(const int i) const throw(IndexException)
@@ -1853,7 +1919,7 @@ int Pokemod::getNatureIndex(const int _id) const
{
for (int i = 0; i < getNatureCount(); ++i)
{
- if (natures[i].getId() == _id)
+ if (natures[i]->getId() == _id)
return i;
}
return -1;
@@ -1866,26 +1932,27 @@ int Pokemod::getNatureCount() const
Nature* Pokemod::newNature()
{
- natures.append(Nature(this, getNewNatureId()));
- return &natures[getNatureCount() - 1];
+ natures.append(new Nature(this, getNewNatureId()));
+ return natures[getNatureCount() - 1];
}
Nature* Pokemod::newNature(const QString& fname)
{
- natures.append(Nature(this, fname, getNewNatureId()));
- return &natures[getNatureCount() - 1];
+ natures.append(new Nature(this, fname, getNewNatureId()));
+ return natures[getNatureCount() - 1];
}
Nature* Pokemod::newNature(const Nature& n)
{
- natures.append(Nature(this, n, getNewNatureId()));
- return &natures[getNatureCount() - 1];
+ natures.append(new Nature(this, n, getNewNatureId()));
+ return natures[getNatureCount() - 1];
}
void Pokemod::deleteNature(const int i) throw(IndexException)
{
if (getNatureCount() <= i)
throw(IndexException(className));
+ delete natures[i];
natures.removeAt(i);
}
@@ -1893,14 +1960,14 @@ const Species* Pokemod::getSpecies(const int i) const throw(IndexException)
{
if (getSpeciesCount() <= i)
throw(IndexException(className));
- return &species.at(i);
+ return species.at(i);
}
Species* Pokemod::getSpecies(const int i) throw(IndexException)
{
if (getSpeciesCount() <= i)
throw(IndexException(className));
- return &species[i];
+ return species[i];
}
const Species* Pokemod::getSpeciesByID(const int i) const throw(IndexException)
@@ -1917,7 +1984,7 @@ int Pokemod::getSpeciesIndex(const int _id) const
{
for (int i = 0; i < getSpeciesCount(); ++i)
{
- if (species[i].getId() == _id)
+ if (species[i]->getId() == _id)
return i;
}
return -1;
@@ -1930,26 +1997,27 @@ int Pokemod::getSpeciesCount() const
Species* Pokemod::newSpecies()
{
- species.append(Species(this, getNewSpeciesId()));
- return &species[getSpeciesCount() - 1];
+ species.append(new Species(this, getNewSpeciesId()));
+ return species[getSpeciesCount() - 1];
}
Species* Pokemod::newSpecies(const QString& fname)
{
- species.append(Species(this, fname, getNewSpeciesId()));
- return &species[getSpeciesCount() - 1];
+ species.append(new Species(this, fname, getNewSpeciesId()));
+ return species[getSpeciesCount() - 1];
}
Species* Pokemod::newSpecies(const Species& s)
{
- species.append(Species(this, s, getNewSpeciesId()));
- return &species[getSpeciesCount() - 1];
+ species.append(new Species(this, s, getNewSpeciesId()));
+ return species[getSpeciesCount() - 1];
}
void Pokemod::deleteSpecies(const int i) throw(IndexException)
{
if (getSpeciesCount() <= i)
throw(IndexException(className));
+ delete species[i];
species.removeAt(i);
}
@@ -1957,14 +2025,14 @@ const Store* Pokemod::getStore(const int i) const throw(IndexException)
{
if (getStoreCount() <= i)
throw(IndexException(className));
- return &stores.at(i);
+ return stores.at(i);
}
Store* Pokemod::getStore(const int i) throw(IndexException)
{
if (getStoreCount() <= i)
throw(IndexException(className));
- return &stores[i];
+ return stores[i];
}
const Store* Pokemod::getStoreByID(const int i) const throw(IndexException)
@@ -1981,7 +2049,7 @@ int Pokemod::getStoreIndex(const int _id) const
{
for (int i = 0; i < getStoreCount(); ++i)
{
- if (stores[i].getId() == _id)
+ if (stores[i]->getId() == _id)
return i;
}
return -1;
@@ -1994,26 +2062,27 @@ int Pokemod::getStoreCount() const
Store* Pokemod::newStore()
{
- stores.append(Store(this, getNewStoreId()));
- return &stores[getStoreCount() - 1];
+ stores.append(new Store(this, getNewStoreId()));
+ return stores[getStoreCount() - 1];
}
Store* Pokemod::newStore(const QString& fname)
{
- stores.append(Store(this, fname, getNewStoreId()));
- return &stores[getStoreCount() - 1];
+ stores.append(new Store(this, fname, getNewStoreId()));
+ return stores[getStoreCount() - 1];
}
Store* Pokemod::newStore(const Store& s)
{
- stores.append(Store(this, s, getNewStoreId()));
- return &stores[getStoreCount() - 1];
+ stores.append(new Store(this, s, getNewStoreId()));
+ return stores[getStoreCount() - 1];
}
void Pokemod::deleteStore(const int i) throw(IndexException)
{
if (getStoreCount() <= i)
throw(IndexException(className));
+ delete stores[i];
stores.removeAt(i);
}
@@ -2021,14 +2090,14 @@ const Tile* Pokemod::getTile(const int i) const throw(IndexException)
{
if (getTileCount() <= i)
throw(IndexException(className));
- return &tiles.at(i);
+ return tiles.at(i);
}
Tile* Pokemod::getTile(const int i) throw(IndexException)
{
if (getTileCount() <= i)
throw(IndexException(className));
- return &tiles[i];
+ return tiles[i];
}
const Tile* Pokemod::getTileByID(const int i) const throw(IndexException)
@@ -2045,7 +2114,7 @@ int Pokemod::getTileIndex(const int _id) const
{
for (int i = 0; i < getTileCount(); ++i)
{
- if (tiles[i].getId() == _id)
+ if (tiles[i]->getId() == _id)
return i;
}
return -1;
@@ -2058,26 +2127,27 @@ int Pokemod::getTileCount() const
Tile* Pokemod::newTile()
{
- tiles.append(Tile(this, getNewTileId()));
- return &tiles[getTileCount() - 1];
+ tiles.append(new Tile(this, getNewTileId()));
+ return tiles[getTileCount() - 1];
}
Tile* Pokemod::newTile(const QString& fname)
{
- tiles.append(Tile(this, fname, getNewTileId()));
- return &tiles[getTileCount() - 1];
+ tiles.append(new Tile(this, fname, getNewTileId()));
+ return tiles[getTileCount() - 1];
}
Tile* Pokemod::newTile(const Tile& t)
{
- tiles.append(Tile(this, t, getNewTileId()));
- return &tiles[getTileCount() - 1];
+ tiles.append(new Tile(this, t, getNewTileId()));
+ return tiles[getTileCount() - 1];
}
void Pokemod::deleteTile(const int i) throw(IndexException)
{
if (getTileCount() <= i)
throw(IndexException(className));
+ delete tiles[i];
tiles.removeAt(i);
}
@@ -2085,14 +2155,14 @@ const Time* Pokemod::getTime(const int i) const throw(IndexException)
{
if (getTimeCount() <= i)
throw(IndexException(className));
- return &times.at(i);
+ return times.at(i);
}
Time* Pokemod::getTime(const int i) throw(IndexException)
{
if (getTimeCount() <= i)
throw(IndexException(className));
- return &times[i];
+ return times[i];
}
const Time* Pokemod::getTimeByID(const int i) const throw(IndexException)
@@ -2109,7 +2179,7 @@ int Pokemod::getTimeIndex(const int _id) const
{
for (int i = 0; i < getTimeCount(); ++i)
{
- if (times[i].getId() == _id)
+ if (times[i]->getId() == _id)
return i;
}
return -1;
@@ -2122,26 +2192,27 @@ int Pokemod::getTimeCount() const
Time* Pokemod::newTime()
{
- times.append(Time(this, getNewTimeId()));
- return &times[getTimeCount() - 1];
+ times.append(new Time(this, getNewTimeId()));
+ return times[getTimeCount() - 1];
}
Time* Pokemod::newTime(const QString& fname)
{
- times.append(Time(this, fname, getNewTimeId()));
- return &times[getTimeCount() - 1];
+ times.append(new Time(this, fname, getNewTimeId()));
+ return times[getTimeCount() - 1];
}
Time* Pokemod::newTime(const Time& t)
{
- times.append(Time(this, t, getNewTimeId()));
- return &times[getTimeCount() - 1];
+ times.append(new Time(this, t, getNewTimeId()));
+ return times[getTimeCount() - 1];
}
void Pokemod::deleteTime(const int i) throw(IndexException)
{
if (getTimeCount() <= i)
throw(IndexException(className));
+ delete times[i];
times.removeAt(i);
}
@@ -2149,14 +2220,14 @@ const Type* Pokemod::getType(const int i) const throw(IndexException)
{
if (getTypeCount() <= i)
throw(IndexException(className));
- return &types.at(i);
+ return types.at(i);
}
Type* Pokemod::getType(const int i) throw(IndexException)
{
if (getTypeCount() <= i)
throw(IndexException(className));
- return &types[i];
+ return types[i];
}
const Type* Pokemod::getTypeByID(const int i) const throw(IndexException)
@@ -2173,7 +2244,7 @@ int Pokemod::getTypeIndex(const int _id) const
{
for (int i = 0; i < getTypeCount(); ++i)
{
- if (types[i].getId() == _id)
+ if (types[i]->getId() == _id)
return i;
}
return -1;
@@ -2187,36 +2258,38 @@ int Pokemod::getTypeCount() const
Type* Pokemod::newType()
{
int i;
- types.append(Type(this, i = getNewTypeId()));
+ types.append(new Type(this, i = getNewTypeId()));
typeChart.addCol(Frac(1, 1));
typeChart.addRow(Frac(1, 1));
- return &types[getTypeCount() - 1];
+ return types[getTypeCount() - 1];
}
Type* Pokemod::newType(const QString& fname)
{
int i;
- types.append(Type(this, fname, i = getNewTypeId()));
+ types.append(new Type(this, fname, i = getNewTypeId()));
typeChart.addCol(Frac(1, 1));
typeChart.addRow(Frac(1, 1));
- return &types[getTypeCount() - 1];
+ return types[getTypeCount() - 1];
}
Type* Pokemod::newType(const Type& t)
{
int i;
- types.append(Type(this, t, i = getNewTypeId()));
+ types.append(new Type(this, t, i = getNewTypeId()));
typeChart.addCol(Frac(1, 1));
typeChart.addRow(Frac(1, 1));
- return &types[getTypeCount() - 1];
+ return types[getTypeCount() - 1];
}
void Pokemod::deleteType(const int i) throw(IndexException)
{
if (getTypeCount() <= i)
throw(IndexException(className));
+ delete types[i];
typeChart.deleteCol(i);
typeChart.deleteRow(i);
+ types.removeAt(i);
}
Pokemod& Pokemod::operator=(const Pokemod& rhs)
@@ -2234,51 +2307,51 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs)
rules = rhs.rules;
abilities.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- abilities.append(Ability(this, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
+ abilities.append(new Ability(this, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
authors.clear();
for (int i = 0; i < rhs.getAuthorCount(); ++i)
- authors.append(Author(this, *rhs.getAuthor(i), rhs.getAuthor(i)->getId()));
+ authors.append(new Author(this, *rhs.getAuthor(i), rhs.getAuthor(i)->getId()));
badges.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- badges.append(Badge(this, *rhs.getBadge(i), rhs.getBadge(i)->getId()));
+ badges.append(new Badge(this, *rhs.getBadge(i), rhs.getBadge(i)->getId()));
coinLists.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- coinLists.append(CoinList(this, *rhs.getCoinList(i), rhs.getCoinList(i)->getId()));
+ coinLists.append(new CoinList(this, *rhs.getCoinList(i), rhs.getCoinList(i)->getId()));
dialogs.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- dialogs.append(Dialog(this, *rhs.getDialog(i), rhs.getDialog(i)->getId()));
+ dialogs.append(new Dialog(this, *rhs.getDialog(i), rhs.getDialog(i)->getId()));
eggGroups.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- eggGroups.append(EggGroup(this, *rhs.getEggGroup(i), rhs.getEggGroup(i)->getId()));
+ eggGroups.append(new EggGroup(this, *rhs.getEggGroup(i), rhs.getEggGroup(i)->getId()));
items.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- items.append(Item(this, *rhs.getItem(i), rhs.getItem(i)->getId()));
+ items.append(new Item(this, *rhs.getItem(i), rhs.getItem(i)->getId()));
itemTypes.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- itemTypes.append(ItemType(this, *rhs.getItemType(i), rhs.getItemType(i)->getId()));
+ itemTypes.append(new ItemType(this, *rhs.getItemType(i), rhs.getItemType(i)->getId()));
maps.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- maps.append(Map(this, *rhs.getMap(i), rhs.getMap(i)->getId()));
+ maps.append(new Map(this, *rhs.getMap(i), rhs.getMap(i)->getId()));
moves.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- moves.append(Move(this, *rhs.getMove(i), rhs.getMove(i)->getId()));
+ moves.append(new Move(this, *rhs.getMove(i), rhs.getMove(i)->getId()));
natures.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- natures.append(Nature(this, *rhs.getNature(i), rhs.getNature(i)->getId()));
+ natures.append(new Nature(this, *rhs.getNature(i), rhs.getNature(i)->getId()));
species.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- species.append(Species(this, *rhs.getSpecies(i), rhs.getSpecies(i)->getId()));
+ species.append(new Species(this, *rhs.getSpecies(i), rhs.getSpecies(i)->getId()));
stores.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- stores.append(Store(this, *rhs.getStore(i), rhs.getStore(i)->getId()));
+ stores.append(new Store(this, *rhs.getStore(i), rhs.getStore(i)->getId()));
tiles.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- tiles.append(Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId()));
+ tiles.append(new Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId()));
times.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- times.append(Time(this, *rhs.getTime(i), rhs.getTime(i)->getId()));
+ times.append(new Time(this, *rhs.getTime(i), rhs.getTime(i)->getId()));
types.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- types.append(Type(this, *rhs.getType(i), rhs.getType(i)->getId()));
+ types.append(new Type(this, *rhs.getType(i), rhs.getType(i)->getId()));
return *this;
}
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index 7bd2a97f..2fa4c62a 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -33,23 +33,24 @@
#include <Point.h>
#include "Object.h"
-#include "Ability.h"
-#include "Author.h"
-#include "Badge.h"
-#include "CoinList.h"
-#include "Dialog.h"
-#include "EggGroup.h"
-#include "Item.h"
-#include "ItemType.h"
-#include "Map.h"
-#include "Move.h"
-#include "Nature.h"
#include "Rules.h"
-#include "Species.h"
-#include "Store.h"
-#include "Tile.h"
-#include "Time.h"
-#include "Type.h"
+
+class Ability;
+class Author;
+class Badge;
+class CoinList;
+class Dialog;
+class EggGroup;
+class Item;
+class ItemType;
+class Map;
+class Move;
+class Nature;
+class Species;
+class Store;
+class Tile;
+class Time;
+class Type;
class Pokemod : public Object
{
@@ -63,9 +64,106 @@ class Pokemod : public Object
};
static const QStringList ValidationStr;
+ enum Stat
+ {
+ ST_HP = 0,
+ ST_Attack = 1,
+ ST_Defense = 2,
+ ST_Speed = 3,
+ ST_Special = 4,
+ ST_End_RBY = 5,
+ ST_SpecialAttack = 4,
+ ST_SpecialDefense = 5,
+ ST_End_GSC = 6,
+ ST_Accuracy = 6,
+ ST_Evasion = 7,
+ ST_End_Battle = 8,
+ };
+ static const QStringList StatRBYStr;
+ static const QStringList StatGSCStr;
+
+ enum BattleMember
+ {
+ BM_Player = 0,
+ BM_Enemy = 1,
+ BM_End = 2
+ };
+ static const QStringList BattleMemberStr;
+
+ enum Weather
+ {
+ W_Ice = 0,
+ W_Rain = 1,
+ W_Sun = 2,
+ W_Sand = 3,
+ W_End_Real = 4,
+ W_All = 4,
+ W_End_All = 5
+ };
+ static const QStringList WeatherStr;
+
+ enum Direction
+ {
+ D_Up = 0,
+ D_Down = 1,
+ D_Left = 2,
+ D_Right = 3,
+ D_End = 4,
+ D_None = 4,
+ D_End_None = 5
+ };
+ static const QStringList DirectionStr;
+
+ enum Relative
+ {
+ REL_Less = 0,
+ REL_LessOrEqual = 1,
+ REL_GreaterOrEqual = 2,
+ REL_Greater = 3,
+ REL_Equal = 4,
+ REL_NotEqual = 5,
+ REL_End = 6
+ };
+ static const QStringList RelativeStr;
+
+ enum Status
+ {
+ STS_Freeze = 0,
+ STS_Paralyze = 1,
+ STS_Sleep = 2,
+ STS_Poison = 3,
+ STS_ToxicPoison = 4,
+ STS_Burn = 5,
+ STS_Any = 6,
+ STS_End = 7
+ };
+ static const QStringList StatusStr;
+
+ enum HMMove
+ {
+ HM_Cut = 0,
+ HM_Fly = 1,
+ HM_Surf = 2,
+ HM_Strength = 3,
+ HM_Whirlpool = 4,
+ HM_Waterfall = 5,
+ HM_Dive = 6,
+ HM_Headbutt = 7,
+ HM_RockSmash = 8,
+ HM_RockClimb = 9,
+ HM_End = 10,
+ HM_Defog = 10,
+ HM_Flash = 11,
+ HM_Heal = 12,
+ HM_Escape = 13,
+ HM_End_All = 14
+ };
+ static const QStringList HMStr;
+
Pokemod();
Pokemod(const Pokemod& p);
Pokemod(const QString& fpath);
+ ~Pokemod();
void load(const QString& fpath, const int = 0) throw(Exception);
void save() const throw(Exception);
@@ -324,22 +422,22 @@ class Pokemod : public Object
Matrix<Frac> typeChart;
Rules rules;
- QList<Ability> abilities;
- QList<Author> authors;
- QList<Badge> badges;
- QList<CoinList> coinLists;
- QList<Dialog> dialogs;
- QList<EggGroup> eggGroups;
- QList<Item> items;
- QList<ItemType> itemTypes;
- QList<Map> maps;
- QList<Move> moves;
- QList<Nature> natures;
- QList<Species> species;
- QList<Store> stores;
- QList<Tile> tiles;
- QList<Time> times;
- QList<Type> types;
+ QList<Ability*> abilities;
+ QList<Author*> authors;
+ QList<Badge*> badges;
+ QList<CoinList*> coinLists;
+ QList<Dialog*> dialogs;
+ QList<EggGroup*> eggGroups;
+ QList<Item*> items;
+ QList<ItemType*> itemTypes;
+ QList<Map*> maps;
+ QList<Move*> moves;
+ QList<Nature*> natures;
+ QList<Species*> species;
+ QList<Store*> stores;
+ QList<Tile*> tiles;
+ QList<Time*> times;
+ QList<Type*> types;
QString path;
};
diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp
index 50a33679..5388a2d4 100644
--- a/pokemod/Species.cpp
+++ b/pokemod/Species.cpp
@@ -27,6 +27,10 @@
#include <QStringListIterator>
#include "Pokemod.h"
+#include "SpeciesAbility.h"
+#include "SpeciesEvolution.h"
+#include "SpeciesItem.h"
+#include "SpeciesMove.h"
#include "Species.h"
const QStringList Species::StyleStr = QStringList() << "Fluctuating" << "Fading" << "Slow" << "Normal" << "Fast" << "Erratic";
@@ -48,7 +52,7 @@ Species::Species(const Pokemod* par, const int _id) :
eggSteps(0),
nidoranGroup(-1)
{
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
{
baseStats[i] = 0;
effortValues[i] = 0;
@@ -67,6 +71,18 @@ Species::Species(const Pokemod* par, const QString& fname, const int _id) :
load(fname, _id);
}
+Species::~Species()
+{
+ for (QListIterator<SpeciesAbility*> i(abilities); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<SpeciesEvolution*> i(evolutions); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<SpeciesItem*> i(items); i.hasNext(); )
+ delete i.next();
+ for (QListIterator<SpeciesMove*> i(moves); i.hasNext(); )
+ delete i.next();
+}
+
bool Species::validate() const
{
bool valid = true;
@@ -76,7 +92,7 @@ bool Species::validate() const
pokemod->validationMsg("Name is not defined");
valid = false;
}
- for (int i = 0; i < (pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY); ++i)
+ for (int i = 0; i < (pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY); ++i)
{
if (!baseStats[i])
{
@@ -178,12 +194,12 @@ bool Species::validate() const
{
if (!getAbilityCount())
pokemod->validationMsg("There are no abilities", Pokemod::V_Warn);
- for (QListIterator<SpeciesAbility> i(abilities); i.hasNext(); i.next())
+ for (QListIterator<SpeciesAbility*> i(abilities); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getAbility()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getAbility()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -206,17 +222,17 @@ bool Species::validate() const
}
if (!getEvolutionCount())
pokemod->validationMsg("There are no evolutions", Pokemod::V_Warn);
- for (QListIterator<SpeciesEvolution> i(evolutions); i.hasNext(); i.next())
+ for (QListIterator<SpeciesEvolution*> i(evolutions); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- if (i.peekNext().getSpecies() == id)
+ if (i.peekNext()->getSpecies() == id)
{
pokemod->validationMsg("Evolution is of the same species");
valid = false;
}
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getSpecies()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getSpecies()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -230,7 +246,7 @@ bool Species::validate() const
{
if (1 < i.value())
{
- pokemod->validationMsg(QString("There are %1 evolutions with the speices %2").arg(i.value()).arg(i.key()));
+ pokemod->validationMsg(QString("There are %1 evolutions with the species %2").arg(i.value()).arg(i.key()));
valid = false;
}
}
@@ -240,12 +256,12 @@ bool Species::validate() const
{
if (!getItemCount())
pokemod->validationMsg("There are no items", Pokemod::V_Warn);
- for (QListIterator<SpeciesItem> i(items); i.hasNext(); i.next())
+ for (QListIterator<SpeciesItem*> i(items); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getItem()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getItem()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -271,12 +287,12 @@ bool Species::validate() const
pokemod->validationMsg("There are no moves");
valid = false;
}
- for (QListIterator<SpeciesMove> i(moves); i.hasNext(); i.next())
+ for (QListIterator<SpeciesMove*> i(moves); i.hasNext(); i.next())
{
- if (!i.peekNext().isValid())
+ if (!i.peekNext()->isValid())
valid = false;
- ++idChecker[i.peekNext().getId()];
- ++nameChecker[i.peekNext().getMove()];
+ ++idChecker[i.peekNext()->getId()];
+ ++nameChecker[i.peekNext()->getMove()];
}
for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next())
{
@@ -341,9 +357,9 @@ void Species::load(const QString& fname, const int _id) throw(Exception)
int i;
int j;
ini.getValue("name", name);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
ini.getValue(QString("baseStats-%d").arg(i), baseStats[i], 0);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
ini.getValue(QString("effortValues-%1").arg(i), effortValues[i], 0);
ini.getValue("growth", growth);
ini.getValue("experienceValue", experienceValue, 0);
@@ -416,9 +432,9 @@ void Species::save() const throw(Exception)
Ini ini;
ini.addField("id", id);
ini.addField("name", name);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
ini.addField(QString("baseStats-%1").arg(i), baseStats[i]);
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
ini.addField(QString("effortValues-%1").arg(i), effortValues[i]);
ini.addField("growth", growth);
ini.addField("experienceValue", experienceValue);
@@ -444,14 +460,14 @@ void Species::save() const throw(Exception)
for (int i = 0; i < eggGroups.size(); ++i)
ini.addField(QString("eggGroup-%1").arg(i), eggGroups[i]);
ini.save(QString("%1/species/%2/data.pini").arg(pokemod->getPath()).arg(name));
- for (QListIterator<SpeciesAbility> i(abilities); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<SpeciesEvolution> i(evolutions); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<SpeciesItem> i(items); i.hasNext(); )
- i.next().save(name);
- for (QListIterator<SpeciesMove> i(moves); i.hasNext(); )
- i.next().save(name);
+ for (QListIterator<SpeciesAbility*> i(abilities); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<SpeciesEvolution*> i(evolutions); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<SpeciesItem*> i(items); i.hasNext(); )
+ i.next()->save(name);
+ for (QListIterator<SpeciesMove*> i(moves); i.hasNext(); )
+ i.next()->save(name);
}
void Species::setName(const QString& n)
@@ -461,7 +477,7 @@ void Species::setName(const QString& n)
void Species::setBaseStat(const int s, const int b) throw(BoundsException)
{
- if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_End_RBY <= s) || ((s == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "stat"));
baseStats[s] = b;
}
@@ -472,7 +488,7 @@ void Species::setEffortValue(const int s, const int e) throw(Exception)
throw(Exception(className, "effortValues not allowed"));
if (pokemod->getRules()->getMaxEVPerStat() < e)
throw(BoundsException(className, "effortValue"));
- if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_End_RBY <= s) || ((s == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "stat"));
effortValues[s] = e;
}
@@ -677,14 +693,14 @@ QString Species::getName() const
int Species::getBaseStat(const int s) const throw(BoundsException)
{
- if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_End_RBY <= s) || ((s == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "stat"));
return baseStats[s];
}
int Species::getEffortValue(const int s) const throw(BoundsException)
{
- if ((ST_End_RBY <= s) || ((s == ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
+ if ((Pokemod::ST_End_RBY <= s) || ((s == Pokemod::ST_SpecialDefense) && !pokemod->getRules()->getSpecialSplit()))
throw(BoundsException(className, "stat"));
return effortValues[s];
}
@@ -808,14 +824,14 @@ const SpeciesAbility* Species::getAbility(const int i) const throw(IndexExceptio
{
if (getAbilityCount() <= i)
throw(IndexException(className));
- return &abilities.at(i);
+ return abilities.at(i);
}
SpeciesAbility* Species::getAbility(const int i) throw(IndexException)
{
if (getAbilityCount() <= i)
throw(IndexException(className));
- return &abilities[i];
+ return abilities[i];
}
const SpeciesAbility* Species::getAbilityByID(const int i) const throw(IndexException)
@@ -832,7 +848,7 @@ int Species::getAbilityIndex(const int _id) const
{
for (int i = 0; i < getAbilityCount(); ++i)
{
- if (abilities[i].getId() == _id)
+ if (abilities[i]->getId() == _id)
return i;
}
return -1;
@@ -845,26 +861,27 @@ int Species::getAbilityCount() const
SpeciesAbility* Species::newAbility()
{
- abilities.append(SpeciesAbility(pokemod, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new SpeciesAbility(pokemod, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
SpeciesAbility* Species::newAbility(const QString& fname)
{
- abilities.append(SpeciesAbility(pokemod, fname, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new SpeciesAbility(pokemod, fname, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
SpeciesAbility* Species::newAbility(const SpeciesAbility& a)
{
- abilities.append(SpeciesAbility(pokemod, a, getNewAbilityId()));
- return &abilities[getAbilityCount() - 1];
+ abilities.append(new SpeciesAbility(pokemod, a, getNewAbilityId()));
+ return abilities[getAbilityCount() - 1];
}
void Species::deleteAbility(const int i) throw(IndexException)
{
if (getAbilityCount() <= i)
throw(IndexException(className));
+ delete abilities[i];
abilities.removeAt(i);
}
@@ -872,14 +889,14 @@ const SpeciesEvolution* Species::getEvolution(const int i) const throw(IndexExce
{
if (getEvolutionCount() <= i)
throw(IndexException(className));
- return &evolutions.at(i);
+ return evolutions.at(i);
}
SpeciesEvolution* Species::getEvolution(const int i) throw(IndexException)
{
if (getEvolutionCount() <= i)
throw(IndexException(className));
- return &evolutions[i];
+ return evolutions[i];
}
const SpeciesEvolution* Species::getEvolutionByID(const int i) const throw(IndexException)
@@ -896,7 +913,7 @@ int Species::getEvolutionIndex(const int _id) const
{
for (int i = 0; i < getEvolutionCount(); ++i)
{
- if (evolutions[i].getId() == _id)
+ if (evolutions[i]->getId() == _id)
return i;
}
return -1;
@@ -909,26 +926,27 @@ int Species::getEvolutionCount() const
SpeciesEvolution* Species::newEvolution()
{
- evolutions.append(SpeciesEvolution(pokemod, getNewEvolutionId()));
- return &evolutions[getEvolutionCount() - 1];
+ evolutions.append(new SpeciesEvolution(pokemod, getNewEvolutionId()));
+ return evolutions[getEvolutionCount() - 1];
}
SpeciesEvolution* Species::newEvolution(const QString& fname)
{
- evolutions.append(SpeciesEvolution(pokemod, fname, getNewEvolutionId()));
- return &evolutions[getEvolutionCount() - 1];
+ evolutions.append(new SpeciesEvolution(pokemod, fname, getNewEvolutionId()));
+ return evolutions[getEvolutionCount() - 1];
}
SpeciesEvolution* Species::newEvolution(const SpeciesEvolution& e)
{
- evolutions.append(SpeciesEvolution(pokemod, e, getNewEvolutionId()));
- return &evolutions[getEvolutionCount() - 1];
+ evolutions.append(new SpeciesEvolution(pokemod, e, getNewEvolutionId()));
+ return evolutions[getEvolutionCount() - 1];
}
void Species::deleteEvolution(const int i) throw(IndexException)
{
if (getEvolutionCount() <= i)
throw(IndexException(className));
+ delete evolutions[i];
evolutions.removeAt(i);
}
@@ -936,14 +954,14 @@ const SpeciesItem* Species::getItem(const int i) const throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items.at(i);
+ return items.at(i);
}
SpeciesItem* Species::getItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
- return &items[i];
+ return items[i];
}
const SpeciesItem* Species::getItemByID(const int i) const throw(IndexException)
@@ -960,7 +978,7 @@ int Species::getItemIndex(const int _id) const
{
for (int i = 0; i < getItemCount(); ++i)
{
- if (items[i].getId() == _id)
+ if (items[i]->getId() == _id)
return i;
}
return -1;
@@ -973,26 +991,27 @@ int Species::getItemCount() const
SpeciesItem* Species::newItem()
{
- items.append(SpeciesItem(pokemod, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new SpeciesItem(pokemod, getNewItemId()));
+ return items[getItemCount() - 1];
}
SpeciesItem* Species::newItem(const QString& fname)
{
- items.append(SpeciesItem(pokemod, fname, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new SpeciesItem(pokemod, fname, getNewItemId()));
+ return items[getItemCount() - 1];
}
SpeciesItem* Species::newItem(const SpeciesItem& i)
{
- items.append(SpeciesItem(pokemod, i, getNewItemId()));
- return &items[getItemCount() - 1];
+ items.append(new SpeciesItem(pokemod, i, getNewItemId()));
+ return items[getItemCount() - 1];
}
void Species::deleteItem(const int i) throw(IndexException)
{
if (getItemCount() <= i)
throw(IndexException(className));
+ delete items[i];
items.removeAt(i);
}
@@ -1000,14 +1019,14 @@ const SpeciesMove* Species::getMove(const int i) const throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
- return &moves.at(i);
+ return moves.at(i);
}
SpeciesMove* Species::getMove(const int i) throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
- return &moves[i];
+ return moves[i];
}
const SpeciesMove* Species::getMoveByID(const int i) const throw(IndexException)
@@ -1024,7 +1043,7 @@ int Species::getMoveIndex(const int _id) const
{
for (int i = 0; i < getMoveCount(); ++i)
{
- if (moves[i].getId() == _id)
+ if (moves[i]->getId() == _id)
return i;
}
return -1;
@@ -1037,26 +1056,27 @@ int Species::getMoveCount() const
SpeciesMove* Species::newMove()
{
- moves.append(SpeciesMove(pokemod, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new SpeciesMove(pokemod, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
SpeciesMove* Species::newMove(const QString& fname)
{
- moves.append(SpeciesMove(pokemod, fname, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new SpeciesMove(pokemod, fname, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
SpeciesMove* Species::newMove(const SpeciesMove& m)
{
- moves.append(SpeciesMove(pokemod, m, getNewMoveId()));
- return &moves[getMoveCount() - 1];
+ moves.append(new SpeciesMove(pokemod, m, getNewMoveId()));
+ return moves[getMoveCount() - 1];
}
void Species::deleteMove(const int i) throw(IndexException)
{
if (getMoveCount() <= i)
throw(IndexException(className));
+ delete moves[i];
moves.removeAt(i);
}
@@ -1065,7 +1085,7 @@ Species& Species::operator=(const Species& rhs)
if (this == &rhs)
return *this;
name = rhs.name;
- for (int i = 0; i < ST_End_GSC; ++i)
+ for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
{
baseStats[i] = rhs.baseStats[i];
effortValues[i] = rhs.effortValues[i];
@@ -1088,15 +1108,15 @@ Species& Species::operator=(const Species& rhs)
eggGroups = rhs.eggGroups;
abilities.clear();
for (int i = 0; i < rhs.getAbilityCount(); ++i)
- abilities.append(SpeciesAbility(pokemod, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
+ abilities.append(new SpeciesAbility(pokemod, *rhs.getAbility(i), rhs.getAbility(i)->getId()));
evolutions.clear();
for (int i = 0; i < rhs.getEvolutionCount(); ++i)
- evolutions.append(SpeciesEvolution(pokemod, *rhs.getEvolution(i), rhs.getEvolution(i)->getId()));
+ evolutions.append(new SpeciesEvolution(pokemod, *rhs.getEvolution(i), rhs.getEvolution(i)->getId()));
items.clear();
for (int i = 0; i < rhs.getItemCount(); ++i)
- items.append(SpeciesItem(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId()));
+ items.append(new SpeciesItem(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId()));
moves.clear();
for (int i = 0; i < rhs.getMoveCount(); ++i)
- moves.append(SpeciesMove(pokemod, *rhs.getMove(i), rhs.getMove(i)->getId()));
+ moves.append(new SpeciesMove(pokemod, *rhs.getMove(i), rhs.getMove(i)->getId()));
return *this;
}
diff --git a/pokemod/Species.h b/pokemod/Species.h
index 11410b9e..5cb1d98d 100644
--- a/pokemod/Species.h
+++ b/pokemod/Species.h
@@ -29,14 +29,13 @@
#include <Exception.h>
#include <Frac.h>
-#include <Ref.h>
#include "Object.h"
-#include "SpeciesAbility.h"
-#include "SpeciesEvolution.h"
-#include "SpeciesItem.h"
-#include "SpeciesMove.h"
+class SpeciesAbility;
+class SpeciesEvolution;
+class SpeciesItem;
+class SpeciesMove;
class Pokemod;
class Species : public Object
@@ -57,6 +56,7 @@ class Species : public Object
Species(const Pokemod* par, const int _id);
Species(const Pokemod* par, const Species& s, const int _id);
Species(const Pokemod* par, const QString& fname, const int _id = -1);
+ ~Species();
void load(const QString& fname, const int _id = -1) throw(Exception);
void save() const throw(Exception);
@@ -170,8 +170,8 @@ class Species : public Object
int getNewMoveId() const;
QString name;
- bool baseStats[ST_End_GSC];
- bool effortValues[ST_End_GSC];
+ bool baseStats[Pokemod::ST_End_GSC];
+ bool effortValues[Pokemod::ST_End_GSC];
int growth;
int experienceValue;
unsigned char catchValue;
@@ -189,10 +189,10 @@ class Species : public Object
QList<int> types;
QList<int> eggGroups;
- QList<SpeciesAbility> abilities;
- QList<SpeciesEvolution> evolutions;
- QList<SpeciesItem> items;
- QList<SpeciesMove> moves;
+ QList<SpeciesAbility*> abilities;
+ QList<SpeciesEvolution*> evolutions;
+ QList<SpeciesItem*> items;
+ QList<SpeciesMove*> moves;
};
#endif
diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp
index feba5543..bd251a88 100644
--- a/pokemod/SpeciesEvolution.cpp
+++ b/pokemod/SpeciesEvolution.cpp
@@ -20,8 +20,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include <Ref.h>
-
#include "Pokemod.h"
#include "Item.h"
#include "ItemEffect.h"
@@ -70,7 +68,7 @@ bool SpeciesEvolution::validate() const
case S_Happiness:
case S_Stat:
case S_Personality:
- if (REL_End <= val1)
+ if (Pokemod::REL_End <= val1)
ok = false;
break;
case S_Item:
@@ -93,7 +91,7 @@ bool SpeciesEvolution::validate() const
switch (style)
{
case S_Stat:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= val2)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= val2)
ok = false;
case S_Item:
if ((G_End <= val2) || ((val2 == G_Hold) && !pokemod->getRules()->getHoldItems()))
@@ -170,7 +168,7 @@ void SpeciesEvolution::setVal1(const int v1) throw(Exception)
case S_Happiness:
case S_Stat:
case S_Personality:
- if (REL_End <= v1)
+ if (Pokemod::REL_End <= v1)
throw(BoundsException(className, "val1"));
break;
case S_Item:
@@ -194,7 +192,7 @@ void SpeciesEvolution::setVal2(const int v2) throw(Exception)
switch (style)
{
case S_Stat:
- if ((pokemod->getRules()->getSpecialSplit() ? ST_End_GSC : ST_End_RBY) <= v2)
+ if ((pokemod->getRules()->getSpecialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= v2)
throw(BoundsException(className, "val2"));
case S_Item:
if ((G_End <= v2) || ((v2 == G_Hold) && !pokemod->getRules()->getHoldItems()))
diff --git a/pokemod/TODO b/pokemod/TODO
index e57c349d..3a4dfbbe 100644
--- a/pokemod/TODO
+++ b/pokemod/TODO
@@ -1,22 +1,3 @@
-=================
-Urgent
-=================
+MoveEffects (Validation, GSC+)
----------------
-Effect Switches
----------------
-MoveEffects
-
-------------------
-PokéMod comparison
-------------------
Figure out what makes 2 PokéMods incompatable
-
-=================
-Showstopper
-=================
-
-----------
-Validation
-----------
-MoveEffect
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index 11043882..2ef974b8 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -34,7 +34,7 @@ Tile::Tile(const Pokemod* par, const int _id) :
forceType(-1),
forceDirection(-1)
{
- for (int i = 0; i < D_End; ++i)
+ for (int i = 0; i < Pokemod::D_End; ++i)
from[i] = false;
}
@@ -64,29 +64,29 @@ bool Tile::validate() const
pokemod->validationMsg("Cannot find tile image");
valid = false;
}
- if ((hmType == HM_Waterfall) && (!from[D_Up] || !from[D_Down]))
+ if ((hmType == Pokemod::HM_Waterfall) && (!from[Pokemod::D_Up] || !from[Pokemod::D_Down]))
{
pokemod->validationMsg("A waterfall tile must be accessible from above and below");
valid = false;
}
- else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != HM_Surf) || (pokemod->getTileByID(under)->getHMType() != HM_Dive)))
+ else if ((hmType == Pokemod::HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_Surf) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_Dive)))
{
pokemod->validationMsg("Invalid under tile");
valid = false;
}
- else if ((hmType == HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != HM_End)))
+ else if ((hmType == Pokemod::HM_Whirlpool) && ((under == id) || (pokemod->getTileIndex(under) == -1) || (pokemod->getTileByID(under)->getHMType() != Pokemod::HM_End)))
{
pokemod->validationMsg("Invalid under tile");
valid = false;
}
- else if ((hmType == HM_RockClimb) && (!from[D_Up] || !from[D_Down]))
+ else if ((hmType == Pokemod::HM_RockClimb) && (!from[Pokemod::D_Up] || !from[Pokemod::D_Down]))
{
pokemod->validationMsg("A rock climb tile must be accessible from above and below");
valid = false;
}
if (forceType < End)
{
- if (((forceType == Slip) || (forceType == Force) || (forceType == Push)) && (D_End <= forceDirection))
+ if (((forceType == Slip) || (forceType == Force) || (forceType == Push)) && (Pokemod::D_End <= forceDirection))
{
pokemod->validationMsg("Invalid force direction");
valid = false;
@@ -110,10 +110,10 @@ void Tile::load(const QString& fname, const int _id) throw(Exception)
int i;
int j;
ini.getValue("name", name);
- ini.getValue("from-up", from[D_Up], false);
- ini.getValue("from-down", from[D_Down], false);
- ini.getValue("from-left", from[D_Left], false);
- ini.getValue("from-right", from[D_Right], false);
+ ini.getValue("from-up", from[Pokemod::D_Up], false);
+ ini.getValue("from-down", from[Pokemod::D_Down], false);
+ ini.getValue("from-left", from[Pokemod::D_Left], false);
+ ini.getValue("from-right", from[Pokemod::D_Right], false);
ini.getValue("wildChance-n", i, 1);
ini.getValue("wildChance-d", j, 1);
wildChance.set(i, j);
@@ -128,10 +128,10 @@ void Tile::save() const throw(Exception)
Ini ini;
ini.addField("id", id);
ini.addField("name", name);
- ini.addField("from-up", from[D_Up]);
- ini.addField("from-down", from[D_Down]);
- ini.addField("from-left", from[D_Left]);
- ini.addField("from-right", from[D_Right]);
+ ini.addField("from-up", from[Pokemod::D_Up]);
+ ini.addField("from-down", from[Pokemod::D_Down]);
+ ini.addField("from-left", from[Pokemod::D_Left]);
+ ini.addField("from-right", from[Pokemod::D_Right]);
ini.addField("wildChance-n", wildChance.getNum());
ini.addField("wildChance-d", wildChance.getDenom());
ini.addField("hmType", hmType);
@@ -157,7 +157,7 @@ void Tile::setPic(const QString& fname) throw(Exception)
void Tile::setFrom(const int d, const bool f) throw(BoundsException)
{
- if (D_End <= d)
+ if (Pokemod::D_End <= d)
throw(BoundsException(className, "direction"));
from[d] = f;
}
@@ -179,7 +179,7 @@ void Tile::setWildChanceDenom(const int d) throw(Exception)
void Tile::setHMType(const int h) throw(BoundsException)
{
- if (HM_End <= h)
+ if (Pokemod::HM_End <= h)
throw(BoundsException(className, "hmType"));
hmType = h;
under = -1;
@@ -189,7 +189,7 @@ void Tile::setUnder(const int u) throw(Exception)
{
if (hmType != -1)
{
- if ((hmType != HM_Whirlpool) || (hmType != HM_Cut) || (hmType != HM_RockSmash))
+ if ((hmType != Pokemod::HM_Whirlpool) || (hmType != Pokemod::HM_Cut) || (hmType != Pokemod::HM_RockSmash))
throw(UnusedException(className, "under"));
if ((u == id) || (pokemod->getTileIndex(u) == -1))
throw(BoundsException(className, "under"));
@@ -210,7 +210,7 @@ void Tile::setForceDirection(const int f) throw(Exception)
{
if (forceType == Stop)
throw(UnusedException(className, "forceDirection"));
- if (D_End <= f)
+ if (Pokemod::D_End <= f)
throw(BoundsException(className, "forceDirection"));
}
forceDirection = f;
@@ -228,7 +228,7 @@ QString Tile::getPic() const
bool Tile::getFrom(const int d) const throw(BoundsException)
{
- if (D_End <= d)
+ if (Pokemod::D_End <= d)
throw(BoundsException(className, "direction"));
return from[d];
}
@@ -263,7 +263,7 @@ Tile& Tile::operator=(const Tile& rhs)
if (this == &rhs)
return *this;
name = rhs.name;
- for (int i = 0; i < D_End; ++i)
+ for (int i = 0; i < Pokemod::D_End; ++i)
from[i] = rhs.from[i];
wildChance = rhs.wildChance;
hmType = rhs.hmType;
diff --git a/pokemod/Tile.h b/pokemod/Tile.h
index 32441e92..d8d52fa1 100644
--- a/pokemod/Tile.h
+++ b/pokemod/Tile.h
@@ -28,7 +28,6 @@
#include <Exception.h>
#include <Frac.h>
-#include <Ref.h>
#include "Object.h"
@@ -79,7 +78,7 @@ class Tile : public Object
bool validate() const;
QString name;
- bool from[D_End];
+ bool from[Pokemod::D_End];
Frac wildChance;
int hmType;
int under;
diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp
index c407b737..d180ffa7 100644
--- a/pokemodr/BadgeUI.cpp
+++ b/pokemodr/BadgeUI.cpp
@@ -26,7 +26,6 @@
#include <BugCatcher.h>
#include <Exception.h>
#include <ImageCache.h>
-#include <Ref.h>
#include <Pokemod.h>
@@ -42,9 +41,9 @@ BadgeUI::BadgeUI(Badge* b, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(badge, badge_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
- varHMs->addItems(HMStr);
+ varHMs->addItems(Pokemod::HMStr);
const bool isSplit = badge->getPokemod()->getRules()->getSpecialSplit();
- varStat->addItems((isSplit ? StatGSCStr : StatRBYStr).mid(0, isSplit ? ST_End_GSC : ST_End_RBY));
+ varStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
setGui();
}
@@ -78,7 +77,7 @@ void BadgeUI::setGui()
varMultiplierDenom->setValue(badge_mod->getStat(varStat->currentIndex()).getDenom());
varMultiplierNum->setMaximum(badge_mod->getStat(varStat->currentIndex()).getDenom());
varMultiplier->setText(QString::number(badge_mod->getStat(varStat->currentIndex()), 'g', DBL_PREC));
- for (unsigned i = 0; i < HM_End_All; ++i)
+ for (int i = 0; i < varHMs->count(); ++i)
varHMs->item(i)->setSelected(badge_mod->getHm(i));
}
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index 1518ed1b..846176b8 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -25,11 +25,10 @@
#include <BugCatcher.h>
#include <Exception.h>
-#include <Ref.h>
#include <Dialog.h>
-#include <Map.h>
#include <Pokemod.h>
+#include <Map.h>
#include "MapWarpUI.h"
@@ -42,7 +41,7 @@ MapWarpUI::MapWarpUI(MapWarp* w, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(mapWarp, mapWarp_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
- varActivation->addItems(DirectionStr.mid(0, D_End));
+ varActivation->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End));
varType->addItems(MapWarp::TypeStr);
for (int i = 0; i < mapWarp->getPokemod()->getMapCount(); ++i)
{
@@ -70,7 +69,7 @@ void MapWarpUI::setGui()
varName->setText(mapWarp_mod->getName());
varCoordinateX->setValue(mapWarp_mod->getCoordinate().getX());
varCoordinateY->setValue(mapWarp_mod->getCoordinate().getY());
- for (unsigned i = 0; i < D_End; ++i)
+ for (int i = 0; i < varActivation->count(); ++i)
varActivation->item(i)->setSelected(mapWarp_mod->getFrom(i));
varDirectionOut->setCurrentIndex(mapWarp_mod->getDirectionOut());
varType->setCurrentIndex(mapWarp_mod->getWarpType());
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp
index b194d108..d1dc4f78 100644
--- a/pokemodr/NatureUI.cpp
+++ b/pokemodr/NatureUI.cpp
@@ -25,7 +25,6 @@
#include <BugCatcher.h>
#include <Exception.h>
-#include <Ref.h>
#include <Pokemod.h>
@@ -41,7 +40,7 @@ NatureUI::NatureUI(Nature* n, QWidget* parent) :
setObjects(nature, nature_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
const bool isSplit = nature->getPokemod()->getRules()->getSpecialSplit();
- varStat->addItems((isSplit ? StatRBYStr : StatGSCStr).mid(0, isSplit ? ST_End_RBY : ST_End_GSC));
+ varStat->addItems((isSplit ? Pokemod::StatRBYStr : Pokemod::StatGSCStr).mid(0, isSplit ? Pokemod::ST_End_RBY : Pokemod::ST_End_GSC));
setGui();
}
diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp
index b1130634..368f1249 100644
--- a/pokemodr/PokeModr.cpp
+++ b/pokemodr/PokeModr.cpp
@@ -35,7 +35,7 @@
int main(int argc, char* argv[])
{
- KAboutData about("pokemodr", "pokemodr", ki18n("PokéModr"), VERSION_STRING, ki18n(""), KAboutData::License_Unknown, ki18n("©2007-2008 Ben Boeckel and Nerdy Productions"), ki18n("This program allows for an easy interface so that PokéMods can be easily created."), "http://sourceforge.net/projects/pokegen");
+ KAboutData about("pokemodr", "pokemodr", ki18n("PokéModr"), VERSION_STRING, ki18n(""), KAboutData::License_Unknown, ki18n("©2007-2008 Ben Boeckel and Nerdy Productions"), ki18n("This program offers an easy interface so that PokéMods can be easily created."), "http://sourceforge.net/projects/pokegen");
about.setLicenseTextFile("LICENSE");
about.setProgramName(ki18n("PokéModr"));
about.addAuthor(ki18n("Ben Boeckel"), ki18n("Lead Programmer"), "MathStuf@gmail.com", "http://nerdyproductions.sobertillnoon.com");
@@ -49,19 +49,20 @@ int main(int argc, char* argv[])
KConfig cfg("~/.kde/share/config/pokegenrc");
+ int ret = 0;
try
{
PokeModrUI mainWindow(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
ImageDialog::init(&mainWindow);
mainWindow.show();
app.exec();
- ImageDialog::cleanUp();
}
catch (Exception& e)
{
BugCatcher::report(e);
BugCatcher::report(Exception("PokeModr", "Uncaught exception"));
- return -1;
+ ret = 1;
}
- return 0;
+ ImageDialog::cleanUp();
+ return ret;
}
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp
index 377dd59e..3b945164 100644
--- a/pokemodr/SpeciesEvolutionUI.cpp
+++ b/pokemodr/SpeciesEvolutionUI.cpp
@@ -25,8 +25,9 @@
#include <BugCatcher.h>
#include <Exception.h>
-#include <Ref.h>
+#include <Item.h>
+#include <ItemEffect.h>
#include <Pokemod.h>
#include <Species.h>
#include <SpeciesEvolution.h>
@@ -78,7 +79,7 @@ void SpeciesEvolutionUI::setGui()
case SpeciesEvolution::S_Stat:
case SpeciesEvolution::S_Personality:
varVal1->setEnabled(true);
- varVal1->addItems(RelativeStr);
+ varVal1->addItems(Pokemod::RelativeStr);
break;
case SpeciesEvolution::S_Item:
case SpeciesEvolution::S_TradeItem:
@@ -102,7 +103,7 @@ void SpeciesEvolutionUI::setGui()
{
case SpeciesEvolution::S_Stat:
varVal2->setEnabled(true);
- varVal2->addItems((isSplit ? StatGSCStr : StatRBYStr).mid(0, isSplit ? ST_End_GSC : ST_End_RBY));
+ varVal2->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
break;
case SpeciesEvolution::S_Item:
varVal2->setEnabled(true);
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index 26ff7e31..be3a81f2 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -26,7 +26,6 @@
#include <BugCatcher.h>
#include <Exception.h>
#include <ImageCache.h>
-#include <Ref.h>
#include <EggGroup.h>
#include <Pokemod.h>
@@ -46,9 +45,9 @@ SpeciesUI::SpeciesUI(Species* s, QWidget* parent) :
setObjects(species, species_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
const bool isSplit = species->getPokemod()->getRules()->getSpecialSplit();
- varBaseStat->addItems((isSplit ? StatGSCStr : StatRBYStr).mid(0, isSplit ? ST_End_GSC : ST_End_RBY));
+ varBaseStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
if (species->getPokemod()->getRules()->getEffortValuesAllowed())
- varEVStat->addItems((isSplit ? StatGSCStr : StatRBYStr).mid(0, isSplit ? ST_End_GSC : ST_End_RBY));
+ varEVStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
else
boxEffortValues->setEnabled(false);
if (!species->getPokemod()->getRules()->getHoldItems())
diff --git a/pokemodr/TODO b/pokemodr/TODO
index 479fa5c8..2519245d 100644
--- a/pokemodr/TODO
+++ b/pokemodr/TODO
@@ -5,5 +5,4 @@ MapEffect
MapTrainer
MoveEffect
-Tree Handling
Toolbar loading
diff --git a/pokemodr/TileUI.cpp b/pokemodr/TileUI.cpp
index 5e747675..fe8e4c58 100644
--- a/pokemodr/TileUI.cpp
+++ b/pokemodr/TileUI.cpp
@@ -28,7 +28,6 @@
#include <BugCatcher.h>
#include <Exception.h>
#include <ImageCache.h>
-#include <Ref.h>
#include <Pokemod.h>
@@ -44,8 +43,8 @@ TileUI::TileUI(Tile* t, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(tile, tile_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
- varAccessibility->addItems(DirectionStr.mid(0, 4));
- varHMType->addItems(HMStr);
+ varAccessibility->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End));
+ varHMType->addItems(Pokemod::HMStr);
for (int i = 0; i < tile->getPokemod()->getTileCount(); ++i)
{
const Tile* tl = tile->getPokemod()->getTile(i);
@@ -56,7 +55,7 @@ TileUI::TileUI(Tile* t, QWidget* parent) :
}
}
varForce->addItems(Tile::ForceStr);
- varDirection->addItems(DirectionStr.mid(0, 4));
+ varDirection->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End));
setGui();
}
@@ -76,7 +75,7 @@ void TileUI::setGui()
{
BugCatcher::report(e);
}
- for (unsigned i = 0; i < D_End; ++i)
+ for (int i = 0; i < varAccessibility->count(); ++i)
varAccessibility->item(i)->setSelected(tile_mod->getFrom(i));
varWildNum->setValue(tile_mod->getWildChance().getNum());
varWildDenom->setValue(tile_mod->getWildChance().getDenom());
@@ -85,7 +84,7 @@ void TileUI::setGui()
boxHMs->setChecked((tile_mod->getHMType() == -1) ? Qt::Unchecked : Qt::Checked);
varHMType->setCurrentIndex(tile_mod->getHMType());
varHMUnder->setCurrentIndex(varHMUnder->findData(tile_mod->getUnder()));
- varHMUnder->setEnabled((tile_mod->getHMType() == HM_Whirlpool) || (tile_mod->getHMType() == HM_Cut) || (tile_mod->getHMType() == HM_RockSmash));
+ varHMUnder->setEnabled((tile_mod->getHMType() == Pokemod::HM_Whirlpool) || (tile_mod->getHMType() == Pokemod::HM_Cut) || (tile_mod->getHMType() == Pokemod::HM_RockSmash));
boxForces->setChecked((tile_mod->getForceType() == -1) ? Qt::Unchecked : Qt::Checked);
varForce->setCurrentIndex(tile_mod->getForceType());
varDirection->setCurrentIndex(tile_mod->getForceDirection());
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui
index 45f5915e..c6f9edd1 100644
--- a/pokemodr/gui/pokemod.ui
+++ b/pokemodr/gui/pokemod.ui
@@ -43,7 +43,7 @@
</widget>
</item>
<item>
- <widget class="QTabWidget" name="notebookPokemod" >
+ <widget class="KTabWidget" name="notebookPokemod" >
<property name="currentIndex" >
<number>2</number>
</property>
@@ -607,6 +607,11 @@
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
+ <customwidget>
+ <class>KTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>ktabwidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/rules.ui b/pokemodr/gui/rules.ui
index 71352716..ffbb88b7 100644
--- a/pokemodr/gui/rules.ui
+++ b/pokemodr/gui/rules.ui
@@ -43,7 +43,7 @@
</widget>
</item>
<item>
- <widget class="QTabWidget" name="notebookRules" >
+ <widget class="KTabWidget" name="notebookRules" >
<property name="currentIndex" >
<number>0</number>
</property>
@@ -598,6 +598,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>KTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>ktabwidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui
index fe0f5c5b..1ea6f588 100644
--- a/pokemodr/gui/species.ui
+++ b/pokemodr/gui/species.ui
@@ -53,7 +53,7 @@
</widget>
</item>
<item>
- <widget class="QTabWidget" name="notebookSpecies" >
+ <widget class="KTabWidget" name="notebookSpecies" >
<property name="currentIndex" >
<number>0</number>
</property>
@@ -850,6 +850,11 @@
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
+ <customwidget>
+ <class>KTabWidget</class>
+ <extends>QTabWidget</extends>
+ <header>ktabwidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>