From 807071d35159de0660f9df31c48d5bf895ca3622 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 27 Apr 2008 15:15:17 +0000 Subject: [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 --- pokemod/Rules.cpp | 115 +++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 57 deletions(-) (limited to 'pokemod/Rules.cpp') diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp index 1f9b804d..6c113e88 100644 --- a/pokemod/Rules.cpp +++ b/pokemod/Rules.cpp @@ -15,22 +15,22 @@ * with this program. If not, see . */ -// Pokemod includes -#include "Pokemod.h" - // Header include #include "Rules.h" +// Pokemod includes +#include "Pokemod.h" + const QStringList Rules::DVStr = QStringList() << "16" << "32"; Rules::Rules(const Rules& rules) : - Object("Rules", rules.pokemod(), 0) + Object("Rules", rules.parent(), 0) { *this = rules; } -Rules::Rules(const Pokemod* pokemod) : - Object("Rules", pokemod, 0), +Rules::Rules(const Object* parent) : + Object("Rules", parent, 0), m_genderAllowed(false), m_breedingAllowed(false), m_holdItems(0), @@ -60,67 +60,68 @@ Rules::Rules(const Pokemod* pokemod) : { } -Rules::Rules(const Rules& rules, const Pokemod* pokemod) : - Object("Rules", pokemod, 0) +Rules::Rules(const Rules& rules, const Object* parent) : + Object("Rules", parent, 0) { *this = rules; } -Rules::Rules(const QDomElement& xml, const Pokemod* pokemod) : - Object("Rules", pokemod, 0) +Rules::Rules(const QDomElement& xml, const Object* parent) : + Object("Rules", parent, 0) { load(xml); } bool Rules::validate() const { - bool valid = true; - pokemod()->validationMsg("---Rules", Pokemod::V_Msg); - if (!m_numBoxes) - pokemod()->validationMsg("No box storage", Pokemod::V_Warn); - else if (!m_boxSize) - { - pokemod()->validationMsg("Invalid box size"); - valid = false; - } - if (!m_maxParty) - { - pokemod()->validationMsg("Invalid party size"); - valid = false; - } - if (!m_maxParty || (m_maxParty < m_maxFight)) - { - pokemod()->validationMsg("Larger active than party"); - valid = false; - } - if (m_maxPlayers < 2) - { - pokemod()->validationMsg("Cannot have battles without at least two players"); - valid = false; - } - if (!m_maxMoves) - { - pokemod()->validationMsg("No moves can be learned"); - valid = false; - } - if (!m_maxMoney) - pokemod()->validationMsg("Player cannot carry any money", Pokemod::V_Warn); - if (1 < m_maxDVValue) - { - pokemod()->validationMsg("Invalid maximum DV value"); - valid = false; - } - if (m_effortValuesAllowed) - { - if (m_maxTotalEV < m_maxEVPerStat) - { - pokemod()->validationMsg("More EV points are allowed on a stat than allowed overall"); - valid = false; - } - } - if (.005 < m_pokerusChance) - pokemod()->validationMsg("Pokérus chance is unusually high", Pokemod::V_Warn); - return valid; + // TODO: validate +// bool valid = true; +// static_cast(pokemod())->validationMsg("---Rules", Pokemod::V_Msg); +// if (!m_numBoxes) +// static_cast(pokemod())->validationMsg("No box storage", Pokemod::V_Warn); +// else if (!m_boxSize) +// { +// static_cast(pokemod())->validationMsg("Invalid box size"); +// valid = false; +// } +// if (!m_maxParty) +// { +// static_cast(pokemod())->validationMsg("Invalid party size"); +// valid = false; +// } +// if (!m_maxParty || (m_maxParty < m_maxFight)) +// { +// static_cast(pokemod())->validationMsg("Larger active than party"); +// valid = false; +// } +// if (m_maxPlayers < 2) +// { +// static_cast(pokemod())->validationMsg("Cannot have battles without at least two players"); +// valid = false; +// } +// if (!m_maxMoves) +// { +// static_cast(pokemod())->validationMsg("No moves can be learned"); +// valid = false; +// } +// if (!m_maxMoney) +// static_cast(pokemod())->validationMsg("Player cannot carry any money", Pokemod::V_Warn); +// if (1 < m_maxDVValue) +// { +// static_cast(pokemod())->validationMsg("Invalid maximum DV value"); +// valid = false; +// } +// if (m_effortValuesAllowed) +// { +// if (m_maxTotalEV < m_maxEVPerStat) +// { +// static_cast(pokemod())->validationMsg("More EV points are allowed on a stat than allowed overall"); +// valid = false; +// } +// } +// if (.005 < m_pokerusChance) +// static_cast(pokemod())->validationMsg("Pokérus chance is unusually high", Pokemod::V_Warn); +// return valid; } void Rules::load(const QDomElement& xml, const int) throw(Exception) -- cgit