diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-04 03:27:13 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-04 03:27:13 +0000 |
| commit | 373e686bf4ecaaabcf80544e74f017eebe05213f (patch) | |
| tree | cddf7a223f16944b0380386e568f2606f634c366 /pokemod/Trainer.cpp | |
| parent | 63417b1c5057d22bd853e92cd3a25aa812b8d917 (diff) | |
| download | sigen-373e686bf4ecaaabcf80544e74f017eebe05213f.tar.gz sigen-373e686bf4ecaaabcf80544e74f017eebe05213f.tar.xz sigen-373e686bf4ecaaabcf80544e74f017eebe05213f.zip | |
[FIX] Cleaned up the RC file
[FIX] Script editing is getting there (still a little weird...)
[FIX] Cleaned up the main file a bit
[FIX] Added the Skin class
[FIX] All sprites and skins are internally linked now
[FIX] No more image restraints (tiles are still enforced so that map editing works)
[FIX] Cleaned up checking for valid values when setting in pokemod
[FIX] Removed FileDialog files
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@233 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Trainer.cpp')
| -rw-r--r-- | pokemod/Trainer.cpp | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp index 303dfac3..4c61ccc0 100644 --- a/pokemod/Trainer.cpp +++ b/pokemod/Trainer.cpp @@ -34,7 +34,7 @@ Pokemod::Trainer::Trainer(const Pokemod* parent, const int id) : Object(parent, id), m_name(""), m_moneyFactor(0), - m_skin(192, 128), + m_skin(-1), m_depth(0), m_teamIntel(Remember), m_moveIntel(Remember), @@ -77,7 +77,7 @@ void Pokemod::Trainer::load(const QDomElement& xml) LOAD_BEGIN(); LOAD(QString, name); LOAD(int, moneyFactor); - LOAD(QPixmap, skin); + LOAD(int, skin); LOAD(int, depth); LOAD(int, teamIntel); LOAD(int, moveIntel); @@ -91,7 +91,7 @@ QDomElement Pokemod::Trainer::save() const SAVE_CREATE(); SAVE(QString, name); SAVE(int, moneyFactor); - SAVE(QPixmap, skin); + SAVE(int, skin); SAVE(int, depth); SAVE(int, teamIntel); SAVE(int, moveIntel); @@ -109,22 +109,17 @@ void Pokemod::Trainer::setName(const QString& name) void Pokemod::Trainer::setMoneyFactor(const int moneyFactor) { if (moneyFactor < 0) - { emit(error(bounds("moneyFactor"))); - return; - } - CHECK(moneyFactor); + else + CHECK(moneyFactor); } -void Pokemod::Trainer::setSkin(const QPixmap& skin) +void Pokemod::Trainer::setSkin(const int skin) { - if (skin.size() != QSize(192, 128)) - { - emit(error(size("skin"))); - return; - } - m_skin = skin; - emit(changed()); + if (qobject_cast<const Pokemod*>(pokemod())->skinIndex(skin) == INT_MAX) + emit(error(bounds("skin"))); + else + CHECK(skin); } void Pokemod::Trainer::setDepth(const int depth) @@ -135,51 +130,41 @@ void Pokemod::Trainer::setDepth(const int depth) void Pokemod::Trainer::setTeamIntel(const int teamIntel) { if (End <= teamIntel) - { emit(error(bounds("teamIntel"))); - return; - } - CHECK(teamIntel); + else + CHECK(teamIntel); } void Pokemod::Trainer::setMoveIntel(const int moveIntel) { if (End <= moveIntel) - { emit(error(bounds("moveIntel"))); - return; - } - CHECK(moveIntel); + else + CHECK(moveIntel); } void Pokemod::Trainer::setItemIntel(const int itemIntel) { if (End <= itemIntel) - { emit(error(bounds("itemIntel"))); - return; - } - CHECK(itemIntel); + else + CHECK(itemIntel); } void Pokemod::Trainer::setAbilityIntel(const int abilityIntel) { if (End <= abilityIntel) - { emit(error(bounds("abilityIntel"))); - return; - } - CHECK(abilityIntel); + else + CHECK(abilityIntel); } void Pokemod::Trainer::setStatIntel(const int statIntel) { if (End <= statIntel) - { emit(error(bounds("statIntel"))); - return; - } - CHECK(statIntel); + else + CHECK(statIntel); } QString Pokemod::Trainer::name() const @@ -192,7 +177,7 @@ int Pokemod::Trainer::moneyFactor() const return m_moneyFactor; } -QPixmap Pokemod::Trainer::skin() const +int Pokemod::Trainer::skin() const { return m_skin; } |
