summaryrefslogtreecommitdiffstats
path: root/pokemod/Pokemod.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-09 22:10:24 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-09 22:10:24 +0000
commit3d877ca28bcb7c70945ff408bd0273e176472969 (patch)
treeb7789493be9b11856ea9068ddcf514d22a0ec56b /pokemod/Pokemod.cpp
parent32a23089b9e2dfe59b3e70be814d8eee9ed9fb61 (diff)
downloadsigen-3d877ca28bcb7c70945ff408bd0273e176472969.tar.gz
sigen-3d877ca28bcb7c70945ff408bd0273e176472969.tar.xz
sigen-3d877ca28bcb7c70945ff408bd0273e176472969.zip
[FIX] More test code for the tree bug
[FIX] Rules now a pointer in Pokemod git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@123 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Pokemod.cpp')
-rw-r--r--pokemod/Pokemod.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 63429c70..90c064bf 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -66,20 +66,20 @@ Pokemod::Pokemod() :
m_superPCUname(""),
m_superPCPasswd(""),
m_typeChart(0, 0),
- m_rules(this)
+ m_rules(new Rules(this))
{
}
Pokemod::Pokemod(const Pokemod& pokemod) :
Object("Pokemod", NULL, 0),
- m_rules(this)
+ m_rules(new Rules(this))
{
*this = pokemod;
}
Pokemod::Pokemod(const QDomElement& xml) :
Object("Pokemod", NULL, 0),
- m_rules(this)
+ m_rules(new Rules(this))
{
load(xml);
}
@@ -110,11 +110,11 @@ void Pokemod::validate()
emit(warning("Super PC password not defined"));
if ((m_typeChart.width() != typeCount()) || (m_typeChart.height() != typeCount()))
emit(error("Type chart is invalid"));
- m_rules.validate();
+ m_rules->validate();
QSet<int> idChecker;
QSet<QString> nameChecker;
QSet<int> timeChecker;
- if (m_rules.abilityAllowed())
+ if (m_rules->abilityAllowed())
{
if (!abilityCount())
emit(error("There are no abilities"));
@@ -183,7 +183,7 @@ void Pokemod::validate()
idChecker.insert(dialog->id());
}
idChecker.clear();
- if (m_rules.breedingAllowed())
+ if (m_rules->breedingAllowed())
{
if (!eggGroupCount())
emit(error("There are no egg groups"));
@@ -256,7 +256,7 @@ void Pokemod::validate()
}
idChecker.clear();
nameChecker.clear();
- if (m_rules.natureAllowed())
+ if (m_rules->natureAllowed())
{
if (!natureCount())
emit(error("There are no natures"));
@@ -410,7 +410,7 @@ QDomElement Pokemod::save() const
SAVE(QPixmap, surfFishSkin);
SAVE(QString, superPCUname);
SAVE(QString, superPCPasswd);
- xml.appendChild(m_rules.save());
+ xml.appendChild(m_rules->save());
SAVE_MATRIX(Fraction, typeChart);
SAVE_SUB(Ability, abilities);
SAVE_SUB(Author, authors);
@@ -554,12 +554,12 @@ void Pokemod::setTypeChart(const int attack, const int defense, const Fraction&
void Pokemod::setRules(const Rules& rules)
{
- m_rules = rules;
+ *m_rules = rules;
}
void Pokemod::setRules(const QDomElement& xml)
{
- m_rules.load(xml);
+ m_rules->load(xml);
}
QString Pokemod::title() const
@@ -644,12 +644,12 @@ Fraction Pokemod::typeChart(const int attack, const int defense) const
const Rules* Pokemod::rules() const
{
- return &m_rules;
+ return m_rules;
}
Rules* Pokemod::rules()
{
- return &m_rules;
+ return m_rules;
}
const Ability* Pokemod::ability(const int index) const
@@ -2056,7 +2056,7 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs)
COPY(superPCUname);
COPY(superPCPasswd);
COPY(typeChart);
- COPY(rules);
+ COPY_RULES();
COPY_SUB(Ability, abilities);
COPY_SUB(Author, authors);
COPY_SUB(Badge, badges);
@@ -2079,6 +2079,7 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs)
void Pokemod::clear()
{
+ delete m_rules;
while (abilityCount())
deleteAbility(0);
while (authorCount())