From dec252e25fc63fe1bb321dd87772181fc76e998f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 24 May 2008 15:30:48 +0000 Subject: [ADD] More documentation [ADD] Abilities now hav a description field [FIX] Fixed up a few minor things in pokemodr git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@172 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemod/Ability.cpp | 14 ++++++++++++++ pokemod/Ability.h | 3 +++ pokemod/Badge.cpp | 26 -------------------------- pokemod/Badge.h | 3 --- 4 files changed, 17 insertions(+), 29 deletions(-) (limited to 'pokemod') diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp index 279cb5bf..dc07ce48 100644 --- a/pokemod/Ability.cpp +++ b/pokemod/Ability.cpp @@ -31,6 +31,7 @@ Ability::Ability(const Ability& ability) : Ability::Ability(const Pokemod* parent, const int id) : Object("Ability", parent, id), m_name(""), + m_description(""), m_script("", "") { } @@ -61,6 +62,7 @@ void Ability::load(const QDomElement& xml, int id) { LOAD_ID(); LOAD(QString, name); + LOAD(QString, description); LOAD(Script, script); } @@ -68,6 +70,7 @@ QDomElement Ability::save() const { SAVE_CREATE(); SAVE(QString, name); + SAVE(QString, description); SAVE(Script, script); return xml; } @@ -77,6 +80,11 @@ void Ability::setName(const QString& name) CHECK(name); } +void Ability::setDescription(const QString& description) +{ + CHECK(description); +} + void Ability::setScript(const Script& script) { CHECK(script); @@ -87,6 +95,11 @@ QString Ability::name() const return m_name; } +QString Ability::description() const +{ + return m_description; +} + Script Ability::script() const { return m_script; @@ -97,6 +110,7 @@ Ability& Ability::operator=(const Ability& rhs) if (this == &rhs) return *this; COPY(name); + COPY(description); COPY(script); return *this; } diff --git a/pokemod/Ability.h b/pokemod/Ability.h index edadc074..9b80bf17 100644 --- a/pokemod/Ability.h +++ b/pokemod/Ability.h @@ -42,14 +42,17 @@ class Ability : public Object QDomElement save() const; void setName(const QString& name); + void setDescription(const QString& description); void setScript(const Script& script); QString name() const; + QString description() const; Script script() const; Ability& operator=(const Ability& rhs); private: QString m_name; + QString m_description; Script m_script; }; diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp index fe77cfc3..0b747e84 100644 --- a/pokemod/Badge.cpp +++ b/pokemod/Badge.cpp @@ -37,8 +37,6 @@ Badge::Badge(const Pokemod* parent, const int id) : { for (int i = 0; i < Pokemod::ST_End_GSC; ++i) m_stat[i].set(1, 1); - for (int i = 0; i < Pokemod::HM_End_All; ++i) - m_hm[i] = false; } Badge::Badge(const Badge& badge, const Pokemod* parent, const int id) : @@ -61,7 +59,6 @@ void Badge::validate() TEST(setBadge, badge); TEST(setObey, obey); TEST_ARRAY(setStat, stat, (static_cast(pokemod())->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY)); - TEST_ARRAY(setHm, hm, Pokemod::HM_End_All); } void Badge::load(const QDomElement& xml, int id) @@ -72,7 +69,6 @@ void Badge::load(const QDomElement& xml, int id) LOAD(QPixmap, badge); LOAD(int, obey); LOAD_ARRAY(Fraction, stat, (static_cast(pokemod())->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY)); - LOAD_ARRAY(bool, hm, Pokemod::HM_End_All); } QDomElement Badge::save() const @@ -83,7 +79,6 @@ QDomElement Badge::save() const SAVE(QPixmap, badge); SAVE(int, obey); SAVE_ARRAY(Fraction, stat, (static_cast(pokemod())->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY)); - SAVE_ARRAY(bool, hm, Pokemod::HM_End_All); return xml; } @@ -139,16 +134,6 @@ void Badge::setStat(const int stat, const Fraction& multiplier) CHECK_ARRAY(stat[stat], multiplier); } -void Badge::setHm(const int hm, const bool hmAllowed) -{ - if (Pokemod::HM_End_All <= hm) - { - emit(error(bounds("hm"))); - return; - } - CHECK_ARRAY(hm[hm], hmAllowed); -} - QString Badge::name() const { return m_name; @@ -179,16 +164,6 @@ Fraction Badge::stat(const int stat) const return m_stat[stat]; } -bool Badge::hm(const int hm) const -{ - if (Pokemod::HM_End_All <= hm) - { - emit(warning(bounds("hm"))); - return false; - } - return m_hm[hm]; -} - Badge& Badge::operator=(const Badge& rhs) { if (this == &rhs) @@ -198,6 +173,5 @@ Badge& Badge::operator=(const Badge& rhs) COPY(badge); COPY(obey); COPY_ARRAY(stat, Pokemod::ST_End_GSC); - COPY_ARRAY(hm, Pokemod::HM_End_All); return *this; } diff --git a/pokemod/Badge.h b/pokemod/Badge.h index 988fea9a..861c8ac8 100644 --- a/pokemod/Badge.h +++ b/pokemod/Badge.h @@ -46,14 +46,12 @@ class Badge : public Object void setBadge(const QPixmap& badge); void setObey(const int obey); void setStat(const int stat, const Fraction& multiplier); - void setHm(const int hm, const bool hmAllowed); QString name() const; QPixmap face() const; QPixmap badge() const; int obey() const; Fraction stat(const int stat) const; - bool hm(const int hm) const; Badge& operator=(const Badge& rhs); private: @@ -62,7 +60,6 @@ class Badge : public Object QPixmap m_badge; int m_obey; Fraction m_stat[Pokemod::ST_End_GSC]; - bool m_hm[Pokemod::HM_End_All]; }; #endif -- cgit