summaryrefslogtreecommitdiffstats
path: root/pokemod/Nature.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-27 15:15:17 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-27 15:15:17 +0000
commit807071d35159de0660f9df31c48d5bf895ca3622 (patch)
treea1e9dbdc1e58b91cd2e4a5e472597b0204ccb41d /pokemod/Nature.cpp
parentf444f5a45e9325644a360f656176d47d7f540f52 (diff)
[FIX] Pokemod objects now know about parents
[FIX] Project includes are now relative [FIX] Headers included for better detection of invalid headers [FIX] Validation code commented out so it can be done better git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@111 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Nature.cpp')
-rw-r--r--pokemod/Nature.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 873d720c..62e14267 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -15,20 +15,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Pokemod includes
-#include "Pokemod.h"
-
// Header include
#include "Nature.h"
+// Pokemod includes
+#include "Pokemod.h"
+
Nature::Nature(const Nature& nature) :
- Object("Nature", nature.pokemod(), nature.id())
+ Object("Nature", nature.parent(), nature.id())
{
*this = nature;
}
-Nature::Nature(const Pokemod* pokemod, const int id) :
- Object("Nature", pokemod, id),
+Nature::Nature(const Object* parent, const int id) :
+ Object("Nature", parent, id),
m_name(""),
m_weight(1)
{
@@ -36,33 +36,34 @@ Nature::Nature(const Pokemod* pokemod, const int id) :
m_stat[i].set(1, 1);
}
-Nature::Nature(const Nature& nature, const Pokemod* pokemod, const int id) :
- Object("Nature", pokemod, id)
+Nature::Nature(const Nature& nature, const Object* parent, const int id) :
+ Object("Nature", parent, id)
{
*this = nature;
}
-Nature::Nature(const QDomElement& xml, const Pokemod* pokemod, const int id) :
- Object("Nature", pokemod, id)
+Nature::Nature(const QDomElement& xml, const Object* parent, const int id) :
+ Object("Nature", parent, id)
{
load(xml, id);
}
bool Nature::validate() const
{
- bool valid = true;
- pokemod()->validationMsg(QString("---Nature \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg);
- if (m_name == "")
- {
- pokemod()->validationMsg("Name is not defined");
- valid = false;
- }
- if (!m_weight)
- {
- pokemod()->validationMsg("Weight is not valid");
- valid = false;
- }
- return valid;
+ // TODO: validate
+// bool valid = true;
+// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("---Nature \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg);
+// if (m_name == "")
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Name is not defined");
+// valid = false;
+// }
+// if (!m_weight)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Weight is not valid");
+// valid = false;
+// }
+// return valid;
}
void Nature::load(const QDomElement& xml, int id)
@@ -89,7 +90,7 @@ void Nature::setName(const QString& name)
void Nature::setStat(const int stat, const Fraction& multiplier) throw(BoundsException)
{
- if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
+ if ((static_cast<const Pokemod*>(pokemod())->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
error<BoundsException>("stat");
m_stat[stat] = multiplier;
}