diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 07:53:09 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-25 07:53:09 -0500 |
| commit | f3b3f21d3ba0fd48bc265684817cb38a70adf84b (patch) | |
| tree | ccffe66f71e3ee15166080cda2aca7d842f547a2 /sigmod/Rules.cpp | |
| parent | e88f1843d61fd0d4c02fa85c3444c786f8c8fd8d (diff) | |
| download | sigen-f3b3f21d3ba0fd48bc265684817cb38a70adf84b.tar.gz sigen-f3b3f21d3ba0fd48bc265684817cb38a70adf84b.tar.xz sigen-f3b3f21d3ba0fd48bc265684817cb38a70adf84b.zip | |
Bounds errors are verbose now and some unchecked conditions fixed as well
Diffstat (limited to 'sigmod/Rules.cpp')
| -rw-r--r-- | sigmod/Rules.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sigmod/Rules.cpp b/sigmod/Rules.cpp index 20fe5a95..0e3c260e 100644 --- a/sigmod/Rules.cpp +++ b/sigmod/Rules.cpp @@ -158,7 +158,7 @@ void Sigmod::Rules::setGenderAllowed(const bool genderAllowed) void Sigmod::Rules::setBreedingAllowed(const bool breedingAllowed) { if (!m_genderAllowed && breedingAllowed) - emit(error(bounds("breedingAllowed"))); + emit(error(bounds("breedingAllowed", breedingAllowed))); else CHECK(breedingAllowed); } @@ -176,7 +176,7 @@ void Sigmod::Rules::setUseTurns(const bool useTurns) void Sigmod::Rules::setPausedATB(const bool pausedATB) { if (m_useTurns && pausedATB) - emit(error(bounds("pausedATB"))); + emit(error(bounds("pausedATB", pausedATB))); else CHECK(pausedATB); } @@ -188,24 +188,24 @@ void Sigmod::Rules::setNumBoxes(const int numBoxes) void Sigmod::Rules::setBoxSize(const int boxSize) { - if (m_numBoxes && !boxSize) - emit(error(bounds("boxSize"))); + if (m_numBoxes && (boxSize <= 0)) + emit(error(bounds("boxSize", 1, INT_MAX, boxSize))); else CHECK(boxSize); } void Sigmod::Rules::setMaxParty(const int maxParty) { - if (!maxParty) - emit(error(bounds("maxParty"))); + if (maxParty <= 0) + emit(error(bounds("maxParty", 1, INT_MAX, maxParty))); else CHECK(maxParty); } void Sigmod::Rules::setMaxFight(const int maxFight) { - if (m_maxParty < maxFight) - emit(error(bounds("maxFight"))); + if ((maxFight <= 0) || (m_maxParty < maxFight)) + emit(error(bounds("maxFight", 1, m_maxParty, maxFight))); else CHECK(maxFight); } @@ -213,7 +213,7 @@ void Sigmod::Rules::setMaxFight(const int maxFight) void Sigmod::Rules::setMaxPlayers(const int maxPlayers) { if (maxPlayers < 2) - emit(error(bounds("maxPlayers"))); + emit(error(bounds("maxPlayers", 2, INT_MAX, maxPlayers))); else CHECK(maxPlayers); } @@ -235,16 +235,16 @@ void Sigmod::Rules::setMaxNatures(const int maxNatures) void Sigmod::Rules::setMaxMoves(const int maxMoves) { - if (!maxMoves) - emit(error(bounds("maxMoves"))); + if (maxMoves <= 0) + emit(error(bounds("maxMoves", 1, INT_MAX, maxMoves))); else CHECK(maxMoves); } void Sigmod::Rules::setMaxLevel(const int maxLevel) { - if (!maxLevel) - emit(error(bounds("maxLevel"))); + if (maxLevel <= 0) + emit(error(bounds("maxLevel", 1, INT_MAX, maxLevel))); else CHECK(maxLevel); } @@ -277,7 +277,7 @@ void Sigmod::Rules::setSpecialSplit(const bool specialSplit) void Sigmod::Rules::setSpecialDVSplit(const bool specialDVSplit) { if (!specialDVSplit && m_specialSplit) - emit(error(bounds("specialDVSplit"))); + emit(error(bounds("specialDVSplit", specialDVSplit))); else CHECK(specialDVSplit); } @@ -289,16 +289,16 @@ void Sigmod::Rules::setEffortValuesAllowed(const bool effortValuesAllowed) void Sigmod::Rules::setMaxTotalEV(const int maxTotalEV) { - if (!maxTotalEV) - emit(error(bounds("maxTotalEV"))); + if (maxTotalEV <= 0) + emit(error(bounds("maxTotalEV", maxTotalEV))); else CHECK(maxTotalEV); } void Sigmod::Rules::setMaxEVPerStat(const int maxEVPerStat) { - if ((!maxEVPerStat && m_maxTotalEV) || (m_maxTotalEV < maxEVPerStat)) - emit(error(bounds("maxEVPerStat"))); + if ((m_maxTotalEV && (maxEVPerStat <= 0)) || (m_maxTotalEV < maxEVPerStat)) + emit(error(bounds("maxEVPerStat", 1, m_maxTotalEV, maxEVPerStat))); else CHECK(maxEVPerStat); } |
