diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 15:15:17 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 15:15:17 +0000 |
| commit | 807071d35159de0660f9df31c48d5bf895ca3622 (patch) | |
| tree | a1e9dbdc1e58b91cd2e4a5e472597b0204ccb41d /pokemod/Trainer.cpp | |
| parent | f444f5a45e9325644a360f656176d47d7f540f52 (diff) | |
| download | sigen-807071d35159de0660f9df31c48d5bf895ca3622.tar.gz sigen-807071d35159de0660f9df31c48d5bf895ca3622.tar.xz sigen-807071d35159de0660f9df31c48d5bf895ca3622.zip | |
[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/Trainer.cpp')
| -rw-r--r-- | pokemod/Trainer.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp index 94a989fd..270df528 100644 --- a/pokemod/Trainer.cpp +++ b/pokemod/Trainer.cpp @@ -15,56 +15,57 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -// Qt includes -#include <QBuffer> +// Header include +#include "Trainer.h" // Pokemod includes #include "Pokemod.h" -// Header include -#include "Trainer.h" +// Qt includes +#include <QBuffer> Trainer::Trainer(const Trainer& trainer) : - Object("Trainer", trainer.pokemod(), trainer.id()) + Object("Trainer", trainer.parent(), trainer.id()) { *this = trainer; } -Trainer::Trainer(const Pokemod* pokemod, const int id) : - Object("Trainer", pokemod, id), +Trainer::Trainer(const Object* parent, const int id) : + Object("Trainer", parent, id), m_name(""), m_moneyFactor(0), m_skin(192, 128) { } -Trainer::Trainer(const Trainer& trainer, const Pokemod* pokemod, const int id) : - Object("Trainer", pokemod, id) +Trainer::Trainer(const Trainer& trainer, const Object* parent, const int id) : + Object("Trainer", parent, id) { *this = trainer; } -Trainer::Trainer(const QDomElement& xml, const Pokemod* pokemod, const int id) : - Object("Trainer", pokemod, id) +Trainer::Trainer(const QDomElement& xml, const Object* parent, const int id) : + Object("Trainer", parent, id) { load(xml, id); } bool Trainer::validate() const { - bool valid = true; - pokemod()->validationMsg(QString("---Trainer \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg); - if (m_name == "") - { - pokemod()->validationMsg("Name not defined"); - valid = false; - } - if (m_moneyFactor < 0) - { - pokemod()->validationMsg("Invalid money factor"); - valid = false; - } - return valid; + // TODO: validate +// bool valid = true; +// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("---Trainer \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg); +// if (m_name == "") +// { +// static_cast<const Pokemod*>(pokemod())->validationMsg("Name not defined"); +// valid = false; +// } +// if (m_moneyFactor < 0) +// { +// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid money factor"); +// valid = false; +// } +// return valid; } void Trainer::load(const QDomElement& xml, int id) @@ -129,7 +130,7 @@ QPixmap Trainer::skin() const // QString Trainer::ai() const // { -// return QString("%1/trainer/%2/ai.pai").arg(pokemod()->path()).arg(m_name); +// return QString("%1/trainer/%2/ai.pai").arg(static_cast<const Pokemod*>(pokemod())->path()).arg(m_name); // } Trainer& Trainer::operator=(const Trainer& rhs) |
