summaryrefslogtreecommitdiffstats
path: root/pokemod/Rules.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-01-25 02:21:09 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-01-25 02:21:09 +0000
commit081bd53cf22ca40a6e436bc46eb62ad469909d6f (patch)
tree2b20a84df93e418ab0261231cf4b993ec57b2ca2 /pokemod/Rules.cpp
parent095c93a62b0be0893063748d67051e35810a7f48 (diff)
downloadsigen-081bd53cf22ca40a6e436bc46eb62ad469909d6f.tar.gz
sigen-081bd53cf22ca40a6e436bc46eb62ad469909d6f.tar.xz
sigen-081bd53cf22ca40a6e436bc46eb62ad469909d6f.zip
[FIX] Frac returns a double (not an unsigned typcast to double, making 0 all the time)
[FIX] maxDV now works on 0 and 1 rather than 16 and 32 [FIX] Stuff ignored (due to other options) can't throw Exceptions in Rules anymore [FIX] UI logic fixed git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@45 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Rules.cpp')
-rw-r--r--pokemod/Rules.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index 7f031eb6..6bf47102 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -43,7 +43,7 @@ Rules::Rules(const Pokemod& par) :
hardCash(false),
specialSplit(false),
specialDVSplit(false),
- maxDVValue(16),
+ maxDVValue(0),
happiness(false),
happyFaintLoss(0),
happyLevelGain(0),
@@ -95,7 +95,7 @@ bool Rules::validate() const
}
if (!maxMoney)
pokemod.validationMsg("Player cannot carry any money", Pokemod::V_Warn);
- if ((maxDVValue != 16) && (maxDVValue != 32))
+ if (1 < maxDVValue)
{
pokemod.validationMsg("Invalid maximum DV value");
valid = false;
@@ -182,14 +182,10 @@ void Rules::save() const throw(Exception)
void Rules::setGenderAllowed(const bool g)
{
genderAllowed = g;
- if (!genderAllowed)
- breedingAllowed = false;
}
-void Rules::setBreedingAllowed(const bool b) throw(Exception)
+void Rules::setBreedingAllowed(const bool b)
{
- if (b && !genderAllowed)
- throw(Exception(className, "cannot breed without genders"));
breedingAllowed = b;
}
@@ -228,6 +224,8 @@ void Rules::setMaxParty(const unsigned m) throw(BoundsException)
if (!m)
throw(BoundsException(className, "maxParty"));
maxParty = m;
+ if (maxFight < m)
+ setMaxFight(m);
}
void Rules::setMaxFight(const unsigned m) throw(BoundsException)
@@ -264,6 +262,8 @@ void Rules::setHardCash(const bool h)
void Rules::setSpecialSplit(const bool s)
{
specialSplit = s;
+ if (!s)
+ setSpecialDVSplit(false);
}
void Rules::setSpecialDVSplit(const bool s)
@@ -273,7 +273,7 @@ void Rules::setSpecialDVSplit(const bool s)
void Rules::setMaxDVValue(const unsigned char m) throw(BoundsException)
{
- if ((m != 16) && (m != 32))
+ if (1 < m)
throw(BoundsException(className, "maxDVValue"));
maxDVValue = m;
}
@@ -303,18 +303,18 @@ void Rules::setEffortValuesAllowed(const bool e)
effortValuesAllowed = e;
}
-void Rules::setMaxTotalEV(const unsigned m) throw(Exception)
+void Rules::setMaxTotalEV(const unsigned m) throw(BoundsException)
{
- if (!effortValuesAllowed)
- throw(Exception(className, "no effort values"));
+ if (!m)
+ throw(BoundsException(className, "maxTotalEV"));
maxTotalEV = m;
+ if (m < maxEVPerStat)
+ setMaxEVPerStat(m);
}
-void Rules::setMaxEVPerStat(const unsigned m) throw(Exception)
+void Rules::setMaxEVPerStat(const unsigned m) throw(BoundsException)
{
- if (!effortValuesAllowed)
- throw(Exception(className, "no effort values"));
- if (maxTotalEV < m)
+ if (!m || (maxTotalEV < m))
throw(BoundsException(className, "maxEVPerStat"));
maxEVPerStat = m;
}