diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-26 18:23:31 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-26 18:23:31 +0000 |
| commit | 940e5d4b55bbd1261bf0ccb3a915b79cf2a240c8 (patch) | |
| tree | 68d3ebfe3f0763d4dbcd7e642b065f6cde73fb8c /pokescripting | |
| parent | aa5ecfc2ac5c1b9c250159d01f1e83799e88eb45 (diff) | |
| download | sigen-940e5d4b55bbd1261bf0ccb3a915b79cf2a240c8.tar.gz sigen-940e5d4b55bbd1261bf0ccb3a915b79cf2a240c8.tar.xz sigen-940e5d4b55bbd1261bf0ccb3a915b79cf2a240c8.zip | |
[FIX] Fixed some minor typos
[FIX] Abstracted validation out to ValidationDialog
[FIX] Added stat and Direction getters for Pokemod
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@244 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokescripting')
| -rw-r--r-- | pokescripting/PokemodWrapper.cpp | 38 | ||||
| -rw-r--r-- | pokescripting/PokemodWrapper.h | 3 | ||||
| -rw-r--r-- | pokescripting/TileWrapper.cpp | 5 |
3 files changed, 45 insertions, 1 deletions
diff --git a/pokescripting/PokemodWrapper.cpp b/pokescripting/PokemodWrapper.cpp index 65befc51..149cd283 100644 --- a/pokescripting/PokemodWrapper.cpp +++ b/pokescripting/PokemodWrapper.cpp @@ -171,6 +171,44 @@ Pokescripting::WeatherWrapper* Pokescripting::PokemodWrapper::weather(const int return WeatherWrapper::create(m_pokemod->weatherById(id), this); } +Pokemod::Stat Pokescripting::PokemodWrapper::stat(const QString& name) const +{ + if (name == "HP") + return Pokemod::ST_HP; + else if (name == "Attack") + return Pokemod::ST_Attack; + else if (name == "Defense") + return Pokemod::ST_Defense; + else if (name == "Speed") + return Pokemod::ST_Speed; + else if (name == "Special") + return Pokemod::ST_Special; + else if (name == "Special Attack") + return Pokemod::ST_SpecialAttack; + else if (name == "Special Defense") + return Pokemod::ST_SpecialAttack; + else if (name == "Accuracy") + return Pokemod::ST_Accuracy; + else if (name == "Evasion") + return Pokemod::ST_Evasion; + return Pokemod::ST_Invalid; +} + +Pokemod::Direction Pokescripting::PokemodWrapper::direction(const QString& name) const +{ + if (name == "Up") + return Pokemod::D_Up; + else if (name == "Down") + return Pokemod::D_Down; + else if (name == "Left") + return Pokemod::D_Left; + else if (name == "Right") + return Pokemod::D_Right; + else if (name == "None") + return Pokemod::D_None; + return Pokemod::D_Invalid; +} + QString Pokescripting::PokemodWrapper::title() const { return m_pokemod->title(); diff --git a/pokescripting/PokemodWrapper.h b/pokescripting/PokemodWrapper.h index f782fdb5..cf97c60c 100644 --- a/pokescripting/PokemodWrapper.h +++ b/pokescripting/PokemodWrapper.h @@ -85,6 +85,9 @@ class POKESCRIPTING_EXPORT PokemodWrapper : public ObjectWrapper TypeWrapper* type(const int id); WeatherWrapper* weather(const int id); + Q_SCRIPTABLE Pokemod::Stat stat(const QString& name) const; + Q_SCRIPTABLE Pokemod::Direction direction(const QString& direction) const; + Q_SCRIPTABLE QString title() const; Q_SCRIPTABLE QString version() const; Q_SCRIPTABLE QString description() const; diff --git a/pokescripting/TileWrapper.cpp b/pokescripting/TileWrapper.cpp index 8cec95f5..648bd39d 100644 --- a/pokescripting/TileWrapper.cpp +++ b/pokescripting/TileWrapper.cpp @@ -20,6 +20,7 @@ // Pokescripting includes #include "PokemodWrapper.h" +#include "SpriteWrapper.h" Pokescripting::TileWrapper* Pokescripting::TileWrapper::create(const Pokemod::Tile* tile, PokemodWrapper* parent) { @@ -43,7 +44,9 @@ Pokescripting::SpriteWrapper* Pokescripting::TileWrapper::sprite() { if (value("sprite").canConvert<QString>()) { - // TODO: Check sprite dimensions + SpriteWrapper* sprite = pokemod()->sprite(value("sprite").toString()); + if (sprite && sprite->sprite().size() == QSize(64, 64)) + return sprite; } return pokemod()->sprite(m_tile->sprite()); } |
