summaryrefslogtreecommitdiffstats
path: root/sigmod/Rules.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmod/Rules.cpp')
-rw-r--r--sigmod/Rules.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/sigmod/Rules.cpp b/sigmod/Rules.cpp
index 0e3c260e..90f176b9 100644
--- a/sigmod/Rules.cpp
+++ b/sigmod/Rules.cpp
@@ -82,8 +82,12 @@ void Sigmod::Rules::validate()
TEST(setMaxPlayers, maxPlayers);
TEST(setMaxMoves, maxMoves);
TEST(setMaxLevel, maxLevel);
+ TEST(setMaxStages, maxStages);
if (!m_maxMoney)
emit(warning("Player cannot carry any money"));
+ else
+ TEST(setMaxMoney, maxMoney);
+ TEST(setMaxTotalWeight, maxTotalWeight);
if (m_effortValuesAllowed)
{
TEST(setMaxEVPerStat, maxEVPerStat);
@@ -251,17 +255,26 @@ void Sigmod::Rules::setMaxLevel(const int maxLevel)
void Sigmod::Rules::setMaxStages(const int maxStages)
{
- CHECK(maxStages);
+ if (maxStages < 0)
+ emit(error(bounds("maxStages", 0, INT_MAX, maxStages)));
+ else
+ CHECK(maxStages);
}
void Sigmod::Rules::setMaxMoney(const int maxMoney)
{
- CHECK(maxMoney);
+ if (maxMoney < 0)
+ emit(error(bounds("maxMoney", 0, INT_MAX, maxMoney)));
+ else
+ CHECK(maxMoney);
}
void Sigmod::Rules::setMaxTotalWeight(const int maxTotalWeight)
{
- CHECK(maxTotalWeight);
+ if (maxTotalWeight < 0)
+ emit(error(bounds("maxTotalWeight", 0, INT_MAX, maxTotalWeight)));
+ else
+ CHECK(maxTotalWeight);
}
void Sigmod::Rules::setAllowSwitchStyle(const bool allowSwitchStyle)