diff options
Diffstat (limited to 'pokemod/CoinListObject.cpp')
| -rw-r--r-- | pokemod/CoinListObject.cpp | 75 |
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; } |
