summaryrefslogtreecommitdiffstats
path: root/pokemod/Rules.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-19 18:12:17 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-19 18:12:17 +0000
commitfe31331e2807634ae659e372358bac5781de9130 (patch)
tree6b208974e3f141e9b22152526e2d42e967bfd4ec /pokemod/Rules.cpp
parent6679f5cffa9d35a23b76605ddfbf3257f882b6ee (diff)
[FIX] IndexException is more explicit
[FIX] Added SizeException for image validation [FIX] QPixmaps are now verified [FIX] Classes now use error and warning rather than throwing [FIX] Deleted Object.cpp git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@100 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Rules.cpp')
-rw-r--r--pokemod/Rules.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index dfc940c9..ab4b465e 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -156,8 +156,7 @@ void Rules::load(const QDomElement& xml, const int) throw(Exception)
QDomElement Rules::save() const
{
- QDomElement xml;
- xml.setTagName(className());
+ QDomElement xml = QDomDocument().createElement(className());
SAVE(bool, genderAllowed);
SAVE(bool, breedingAllowed);
SAVE(int, holdItems);
@@ -230,7 +229,7 @@ void Rules::setBoxSize(const int boxSize)
void Rules::setMaxParty(const int maxParty) throw(BoundsException)
{
if (!maxParty)
- throw(BoundsException(className(), "maxParty"));
+ error<BoundsException>("maxParty");
m_maxParty = maxParty;
if (maxParty < m_maxFight)
setMaxFight(maxParty);
@@ -239,28 +238,28 @@ void Rules::setMaxParty(const int maxParty) throw(BoundsException)
void Rules::setMaxFight(const int maxFight) throw(BoundsException)
{
if (m_maxParty < maxFight)
- throw(BoundsException(className(), "maxFight"));
+ error<BoundsException>("maxFight");
m_maxFight = maxFight;
}
void Rules::setMaxPlayers(const int maxPlayers) throw(BoundsException)
{
if (!maxPlayers)
- throw(BoundsException(className(), "maxPlayers"));
+ error<BoundsException>("maxPlayers");
m_maxPlayers = maxPlayers;
}
void Rules::setMaxMoves(const int maxMoves) throw(BoundsException)
{
if (!maxMoves)
- throw(BoundsException(className(), "maxMoves"));
+ error<BoundsException>("maxMoves");
m_maxMoves = maxMoves;
}
void Rules::setMaxLevel(const int maxLevel) throw(BoundsException)
{
if (!maxLevel)
- throw(BoundsException(className(), "maxLevel"));
+ error<BoundsException>("maxLevel");
m_maxLevel = maxLevel;
}
@@ -289,7 +288,7 @@ void Rules::setSpecialDVSplit(const bool specialDVSplit)
void Rules::setMaxDVValue(const unsigned char maxDVValue) throw(BoundsException)
{
if (1 < maxDVValue)
- throw(BoundsException(className(), "maxDVValue"));
+ error<BoundsException>("maxDVValue");
m_maxDVValue = maxDVValue;
}
@@ -321,7 +320,7 @@ void Rules::setEffortValuesAllowed(const bool effortValuesAllowed)
void Rules::setMaxTotalEV(const int maxTotalEV) throw(BoundsException)
{
if (!maxTotalEV)
- throw(BoundsException(className(), "maxTotalEV"));
+ error<BoundsException>("maxTotalEV");
m_maxTotalEV = maxTotalEV;
if (maxTotalEV < m_maxEVPerStat)
setMaxEVPerStat(maxTotalEV);
@@ -330,7 +329,7 @@ void Rules::setMaxTotalEV(const int maxTotalEV) throw(BoundsException)
void Rules::setMaxEVPerStat(const int maxEVPerStat) throw(BoundsException)
{
if (!maxEVPerStat || (m_maxTotalEV < maxEVPerStat))
- throw(BoundsException(className(), "maxEVPerStat"));
+ error<BoundsException>("maxEVPerStat");
m_maxEVPerStat = maxEVPerStat;
}