summaryrefslogtreecommitdiffstats
path: root/sigmod/Trainer.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-29 10:57:12 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-29 10:57:12 -0500
commitfac9e51b6ec4e41d777c176e9bb1fadc0f9bc906 (patch)
tree4a140cfd55b2883ee9a69f5dc4a0a6876845aaa2 /sigmod/Trainer.cpp
parent0f2a0fe8bcbeefa62d0fd4fae89f0de6610fe993 (diff)
downloadsigen-fac9e51b6ec4e41d777c176e9bb1fadc0f9bc906.tar.gz
sigen-fac9e51b6ec4e41d777c176e9bb1fadc0f9bc906.tar.xz
sigen-fac9e51b6ec4e41d777c176e9bb1fadc0f9bc906.zip
Finished up converting classes to use CHECK macros
Diffstat (limited to 'sigmod/Trainer.cpp')
-rw-r--r--sigmod/Trainer.cpp129
1 files changed, 32 insertions, 97 deletions
diff --git a/sigmod/Trainer.cpp b/sigmod/Trainer.cpp
index 702c6f5e..d7a08618 100644
--- a/sigmod/Trainer.cpp
+++ b/sigmod/Trainer.cpp
@@ -62,8 +62,9 @@ void Sigmod::Trainer::validate()
TEST_BEGIN();
if (m_name.isEmpty())
emit(error("Name is empty"));
- TEST(setMoneyFactor, moneyFactor);
- TEST(setSkin, skin);
+ TEST(moneyFactor);
+ TEST(skin);
+ TEST(depth);
TEST_END();
}
@@ -96,101 +97,35 @@ QDomElement Sigmod::Trainer::save() const
return xml;
}
-void Sigmod::Trainer::setName(const QString& name)
-{
- CHECK(name);
-}
-
-void Sigmod::Trainer::setMoneyFactor(const int moneyFactor)
-{
- if (moneyFactor < 0)
- emit(error(bounds("moneyFactor", 0, INT_MAX, moneyFactor)));
- else
- CHECK(moneyFactor);
-}
-
-void Sigmod::Trainer::setSkin(const int skin)
-{
- if (!sigmod()->skinById(skin))
- emit(error(bounds("skin", skin)));
- else
- CHECK(skin);
-}
-
-void Sigmod::Trainer::setDepth(const int depth)
-{
- CHECK(depth);
-}
-
-void Sigmod::Trainer::setTeamIntel(const Intelligence teamIntel)
-{
- CHECK(teamIntel);
-}
-
-void Sigmod::Trainer::setMoveIntel(const Intelligence moveIntel)
-{
- CHECK(moveIntel);
-}
-
-void Sigmod::Trainer::setItemIntel(const Intelligence itemIntel)
-{
- CHECK(itemIntel);
-}
-
-void Sigmod::Trainer::setAbilityIntel(const Intelligence abilityIntel)
-{
- CHECK(abilityIntel);
-}
-
-void Sigmod::Trainer::setStatIntel(const Intelligence statIntel)
-{
- CHECK(statIntel);
-}
-
-QString Sigmod::Trainer::name() const
-{
- return m_name;
-}
-
-int Sigmod::Trainer::moneyFactor() const
-{
- return m_moneyFactor;
-}
-
-int Sigmod::Trainer::skin() const
-{
- return m_skin;
-}
-
-int Sigmod::Trainer::depth() const
-{
- return m_depth;
-}
-
-Sigmod::Trainer::Intelligence Sigmod::Trainer::teamIntel() const
-{
- return m_teamIntel;
-}
-
-Sigmod::Trainer::Intelligence Sigmod::Trainer::moveIntel() const
-{
- return m_moveIntel;
-}
-
-Sigmod::Trainer::Intelligence Sigmod::Trainer::itemIntel() const
-{
- return m_itemIntel;
-}
-
-Sigmod::Trainer::Intelligence Sigmod::Trainer::abilityIntel() const
-{
- return m_abilityIntel;
-}
-
-Sigmod::Trainer::Intelligence Sigmod::Trainer::statIntel() const
-{
- return m_statIntel;
-}
+SETTER(Trainer, QString&, Name, name)
+SETTER(Trainer, int, MoneyFactor, moneyFactor)
+SETTER(Trainer, int, Skin, skin)
+SETTER(Trainer, int, Depth, depth)
+SETTER(Trainer, Intelligence, TeamIntel, teamIntel)
+SETTER(Trainer, Intelligence, MoveIntel, moveIntel)
+SETTER(Trainer, Intelligence, ItemIntel, itemIntel)
+SETTER(Trainer, Intelligence, AbilityIntel, abilityIntel)
+SETTER(Trainer, Intelligence, StatIntel, statIntel)
+
+GETTER(Trainer, QString, name)
+GETTER(Trainer, int, moneyFactor)
+GETTER(Trainer, int, skin)
+GETTER(Trainer, int, depth)
+GETTER(Trainer, Sigmod::Trainer::Intelligence, teamIntel)
+GETTER(Trainer, Sigmod::Trainer::Intelligence, moveIntel)
+GETTER(Trainer, Sigmod::Trainer::Intelligence, itemIntel)
+GETTER(Trainer, Sigmod::Trainer::Intelligence, abilityIntel)
+GETTER(Trainer, Sigmod::Trainer::Intelligence, statIntel)
+
+CHECK(Trainer, QString&, name)
+CHECK_BOUNDS(Trainer, int, moneyFactor, 0, INT_MAX)
+CHECK_INDEX(Trainer, int, skin, sigmod(), skin)
+CHECK_BOUNDS(Trainer, int, depth, 0, INT_MAX)
+CHECK(Trainer, Intelligence, teamIntel)
+CHECK(Trainer, Intelligence, moveIntel)
+CHECK(Trainer, Intelligence, itemIntel)
+CHECK(Trainer, Intelligence, abilityIntel)
+CHECK(Trainer, Intelligence, statIntel)
Sigmod::Trainer& Sigmod::Trainer::operator=(const Trainer& rhs)
{