summaryrefslogtreecommitdiffstats
path: root/pokemod/CoinListObject.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-27 15:15:17 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-27 15:15:17 +0000
commit807071d35159de0660f9df31c48d5bf895ca3622 (patch)
treea1e9dbdc1e58b91cd2e4a5e472597b0204ccb41d /pokemod/CoinListObject.cpp
parentf444f5a45e9325644a360f656176d47d7f540f52 (diff)
[FIX] Pokemod objects now know about parents
[FIX] Project includes are now relative [FIX] Headers included for better detection of invalid headers [FIX] Validation code commented out so it can be done better git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@111 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/CoinListObject.cpp')
-rw-r--r--pokemod/CoinListObject.cpp75
1 files changed, 38 insertions, 37 deletions
diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp
index bdc170fa..499427a5 100644
--- a/pokemod/CoinListObject.cpp
+++ b/pokemod/CoinListObject.cpp
@@ -21,13 +21,13 @@
const QStringList CoinListObject::TypeStr = QStringList() << "Item" << "Pokémon";
CoinListObject::CoinListObject(const CoinListObject& object) :
- Object("CoinListObject", object.pokemod(), object.id())
+ Object("CoinListObject", object.parent(), object.id())
{
*this = object;
}
-CoinListObject::CoinListObject(const Pokemod* pokemod, const int id) :
- Object("CoinListObject", pokemod, id),
+CoinListObject::CoinListObject(const Object* parent, const int id) :
+ Object("CoinListObject", parent, id),
m_type(Item),
m_object(INT_MAX),
m_amount(1),
@@ -35,49 +35,50 @@ CoinListObject::CoinListObject(const Pokemod* pokemod, const int id) :
{
}
-CoinListObject::CoinListObject(const CoinListObject& object, const Pokemod* pokemod, const int id) :
- Object("CoinListObject", pokemod, id)
+CoinListObject::CoinListObject(const CoinListObject& object, const Object* parent, const int id) :
+ Object("CoinListObject", parent, id)
{
*this = object;
}
-CoinListObject::CoinListObject(const QDomElement& xml, const Pokemod* pokemod, const int id) :
- Object("CoinListObject", pokemod, id)
+CoinListObject::CoinListObject(const QDomElement& xml, const Object* parent, const int id) :
+ Object("CoinListObject", parent, id)
{
load(xml, id);
}
bool CoinListObject::validate() const
{
- bool valid = true;
- pokemod()->validationMsg(QString("------Object with id %1---").arg(id()), Pokemod::V_Msg);
- if (Item == m_type)
- {
- if (pokemod()->itemIndex(m_object) == INT_MAX)
- {
- pokemod()->validationMsg("Invalid item");
- valid = false;
- }
- }
- else if (Species == m_type)
- {
- if (pokemod()->speciesIndex(m_object) == INT_MAX)
- {
- pokemod()->validationMsg("Invalid Species");
- valid = false;
- }
- }
- else
- {
- pokemod()->validationMsg("Invalid type");
- valid = false;
- }
- if (!m_amount || ((1 < m_amount) && (Species == m_type)))
- {
- pokemod()->validationMsg("Invalid amount");
- valid = false;
- }
- return valid;
+ // TODO: validate
+// bool valid = true;
+// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("------Object with id %1---").arg(id()), Pokemod::V_Msg);
+// if (Item == m_type)
+// {
+// if (static_cast<const Pokemod*>(pokemod())->itemIndex(m_object) == INT_MAX)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid item");
+// valid = false;
+// }
+// }
+// else if (Species == m_type)
+// {
+// if (static_cast<const Pokemod*>(pokemod())->speciesIndex(m_object) == INT_MAX)
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid Species");
+// valid = false;
+// }
+// }
+// else
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid type");
+// valid = false;
+// }
+// if (!m_amount || ((1 < m_amount) && (Species == m_type)))
+// {
+// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid amount");
+// valid = false;
+// }
+// return valid;
}
void CoinListObject::load(const QDomElement& xml, int id)
@@ -109,7 +110,7 @@ void CoinListObject::setType(const int type) throw(BoundsException)
void CoinListObject::setObject(const int object) throw(BoundsException)
{
- if (((Item == m_type) && (pokemod()->itemIndex(object) == INT_MAX)) || ((Species == m_type) && (pokemod()->speciesIndex(object) == INT_MAX)))
+ if (((Item == m_type) && (static_cast<const Pokemod*>(pokemod())->itemIndex(object) == INT_MAX)) || ((Species == m_type) && (static_cast<const Pokemod*>(pokemod())->speciesIndex(object) == INT_MAX)))
error<BoundsException>("object");
m_object = object;
}