From fe31331e2807634ae659e372358bac5781de9130 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 19 Apr 2008 18:12:17 +0000 Subject: [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 --- pokemod/Rules.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'pokemod/Rules.cpp') 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("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("maxFight"); m_maxFight = maxFight; } void Rules::setMaxPlayers(const int maxPlayers) throw(BoundsException) { if (!maxPlayers) - throw(BoundsException(className(), "maxPlayers")); + error("maxPlayers"); m_maxPlayers = maxPlayers; } void Rules::setMaxMoves(const int maxMoves) throw(BoundsException) { if (!maxMoves) - throw(BoundsException(className(), "maxMoves")); + error("maxMoves"); m_maxMoves = maxMoves; } void Rules::setMaxLevel(const int maxLevel) throw(BoundsException) { if (!maxLevel) - throw(BoundsException(className(), "maxLevel")); + error("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("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("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("maxEVPerStat"); m_maxEVPerStat = maxEVPerStat; } -- cgit