summaryrefslogtreecommitdiffstats
path: root/pokemod/Rules.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/Rules.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/Rules.cpp')
-rw-r--r--pokemod/Rules.cpp115
1 files changed, 58 insertions, 57 deletions
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 <http://www.gnu.org/licenses/>.
*/
-// 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<const Pokemod*>(pokemod())->validationMsg("---Rules", Pokemod::V_Msg);
+// if (!m_numBoxes)
+// static_cast<const Pokemod*>(pokemod())->validationMsg("No box storage", Pokemod::V_Warn);
+// else if (!m_boxSize)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid box size");
+// valid = false;
+// }
+// if (!m_maxParty)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid party size");
+// valid = false;
+// }
+// if (!m_maxParty || (m_maxParty < m_maxFight))
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Larger active than party");
+// valid = false;
+// }
+// if (m_maxPlayers < 2)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Cannot have battles without at least two players");
+// valid = false;
+// }
+// if (!m_maxMoves)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("No moves can be learned");
+// valid = false;
+// }
+// if (!m_maxMoney)
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Player cannot carry any money", Pokemod::V_Warn);
+// if (1 < m_maxDVValue)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid maximum DV value");
+// valid = false;
+// }
+// if (m_effortValuesAllowed)
+// {
+// if (m_maxTotalEV < m_maxEVPerStat)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("More EV points are allowed on a stat than allowed overall");
+// valid = false;
+// }
+// }
+// if (.005 < m_pokerusChance)
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Pokérus chance is unusually high", Pokemod::V_Warn);
+// return valid;
}
void Rules::load(const QDomElement& xml, const int) throw(Exception)