diff options
Diffstat (limited to 'pokemod/Store.cpp')
| -rw-r--r-- | pokemod/Store.cpp | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp index 1edbca32..e8f1af69 100644 --- a/pokemod/Store.cpp +++ b/pokemod/Store.cpp @@ -15,66 +15,67 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -// Qt includes -#include <QMap> +// Header include +#include "Store.h" // Pokemod includes #include "Pokemod.h" -// Header include -#include "Store.h" +// Qt includes +#include <QMap> Store::Store(const Store& store) : - Object("Store", store.pokemod(), store.id()) + Object("Store", store.parent(), store.id()) { *this = store; } -Store::Store(const Pokemod* pokemod, const int id) : - Object("Store", pokemod, id), +Store::Store(const Object* parent, const int id) : + Object("Store", parent, id), m_name("") { } -Store::Store(const Store& store, const Pokemod* pokemod, const int id) : - Object("Store", pokemod, id) +Store::Store(const Store& store, const Object* parent, const int id) : + Object("Store", parent, id) { *this = store; } -Store::Store(const QDomElement& xml, const Pokemod* pokemod, const int id) : - Object("Store", pokemod, id) +Store::Store(const QDomElement& xml, const Object* parent, const int id) : + Object("Store", parent, id) { load(xml, id); } bool Store::validate() const { - bool valid = true; - pokemod()->validationMsg(QString("---Store \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg); - if (m_name == "") - { - pokemod()->validationMsg("Name is noe defiend"); - valid = false; - } - if (!m_items.size()) - { - pokemod()->validationMsg("There are no items"); - valid = false; - } - QMap<int, bool> valueChecker; - foreach (int item, m_items) - { - if (pokemod()->itemIndex(item) == INT_MAX) - { - pokemod()->validationMsg("Invalid item"); - valid = false; - } - if (valueChecker[item]) - pokemod()->validationMsg(QString("Duplicate of item %1").arg(item)); - valueChecker[item] = true; - } - return valid; + // TODO: validate +// bool valid = true; +// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("---Store \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg); +// if (m_name == "") +// { +// static_cast<const Pokemod*>(pokemod())->validationMsg("Name is noe defiend"); +// valid = false; +// } +// if (!m_items.size()) +// { +// static_cast<const Pokemod*>(pokemod())->validationMsg("There are no items"); +// valid = false; +// } +// QMap<int, bool> valueChecker; +// foreach (int item, m_items) +// { +// if (static_cast<const Pokemod*>(pokemod())->itemIndex(item) == INT_MAX) +// { +// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid item"); +// valid = false; +// } +// if (valueChecker[item]) +// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("Duplicate of item %1").arg(item)); +// valueChecker[item] = true; +// } +// return valid; } void Store::load(const QDomElement& xml, int id) @@ -97,7 +98,7 @@ void Store::setName(const QString& name) void Store::setItem(const int item, const bool state) throw(BoundsException) { - if (pokemod()->itemIndex(item) == INT_MAX) + if (static_cast<const Pokemod*>(pokemod())->itemIndex(item) == INT_MAX) error<BoundsException>("item"); if (state) { |
