summaryrefslogtreecommitdiffstats
path: root/pokescripting
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-08-26 19:03:35 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-08-26 19:03:35 +0000
commit31601349dff4b78a03bda0912d8d79b43eae42b0 (patch)
treed81b20394a8b2a13728c22cf5e75ae77e747144d /pokescripting
parent940e5d4b55bbd1261bf0ccb3a915b79cf2a240c8 (diff)
downloadsigen-31601349dff4b78a03bda0912d8d79b43eae42b0.tar.gz
sigen-31601349dff4b78a03bda0912d8d79b43eae42b0.tar.xz
sigen-31601349dff4b78a03bda0912d8d79b43eae42b0.zip
[FIX] Enumerations now have access from scripts (name->value)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@245 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokescripting')
-rw-r--r--pokescripting/CoinListObjectWrapper.cpp9
-rw-r--r--pokescripting/CoinListObjectWrapper.h2
-rw-r--r--pokescripting/ItemTypeWrapper.cpp9
-rw-r--r--pokescripting/ItemTypeWrapper.h2
-rw-r--r--pokescripting/MapWarpWrapper.cpp13
-rw-r--r--pokescripting/MapWarpWrapper.h2
-rw-r--r--pokescripting/MapWrapper.cpp11
-rw-r--r--pokescripting/MapWrapper.h2
-rw-r--r--pokescripting/PokemodWrapper.cpp4
-rw-r--r--pokescripting/SoundWrapper.cpp9
-rw-r--r--pokescripting/SoundWrapper.h2
-rw-r--r--pokescripting/SpeciesWrapper.cpp17
-rw-r--r--pokescripting/SpeciesWrapper.h2
-rw-r--r--pokescripting/TrainerWrapper.cpp13
-rw-r--r--pokescripting/TrainerWrapper.h2
15 files changed, 97 insertions, 2 deletions
diff --git a/pokescripting/CoinListObjectWrapper.cpp b/pokescripting/CoinListObjectWrapper.cpp
index fc33444d..9ebff168 100644
--- a/pokescripting/CoinListObjectWrapper.cpp
+++ b/pokescripting/CoinListObjectWrapper.cpp
@@ -35,6 +35,15 @@ Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinL
{
}
+Pokemod::CoinListObject::Type Pokescripting::CoinListObjectWrapper::type(const QString& name) const
+{
+ if (name == "Item")
+ return Pokemod::CoinListObject::Item;
+ else if (name == "Species")
+ return Pokemod::CoinListObject::Species;
+ return QVariant(-1).value<Pokemod::CoinListObject::Type>();
+}
+
Pokemod::CoinListObject::Type Pokescripting::CoinListObjectWrapper::type() const
{
return m_object->type();
diff --git a/pokescripting/CoinListObjectWrapper.h b/pokescripting/CoinListObjectWrapper.h
index 9b507b32..57a2330d 100644
--- a/pokescripting/CoinListObjectWrapper.h
+++ b/pokescripting/CoinListObjectWrapper.h
@@ -38,6 +38,8 @@ class POKESCRIPTING_EXPORT CoinListObjectWrapper : public ObjectWrapper
public:
static CoinListObjectWrapper* create(const Pokemod::CoinListObject* object, CoinListWrapper* parent);
+ Q_SCRIPTABLE Pokemod::CoinListObject::Type type(const QString& name) const;
+
Q_SCRIPTABLE Pokemod::CoinListObject::Type type() const;
Q_SCRIPTABLE ItemWrapper* itemObject();
Q_SCRIPTABLE SpeciesWrapper* speciesObject();
diff --git a/pokescripting/ItemTypeWrapper.cpp b/pokescripting/ItemTypeWrapper.cpp
index f7014d0d..f9111db2 100644
--- a/pokescripting/ItemTypeWrapper.cpp
+++ b/pokescripting/ItemTypeWrapper.cpp
@@ -34,6 +34,15 @@ Pokescripting::ItemTypeWrapper::ItemTypeWrapper(const Pokemod::ItemType* itemTyp
{
}
+Pokemod::ItemType::Count Pokescripting::ItemTypeWrapper::count(const QString& name) const
+{
+ if (name == "Distinct")
+ return Pokemod::ItemType::Distinct;
+ else if (name == "Total")
+ return Pokemod::ItemType::Total;
+ return QVariant(-1).value<Pokemod::ItemType::Count>();
+}
+
QString Pokescripting::ItemTypeWrapper::name() const
{
return m_itemType->name();
diff --git a/pokescripting/ItemTypeWrapper.h b/pokescripting/ItemTypeWrapper.h
index 7b699508..f9e61ccc 100644
--- a/pokescripting/ItemTypeWrapper.h
+++ b/pokescripting/ItemTypeWrapper.h
@@ -33,6 +33,8 @@ class POKESCRIPTING_EXPORT ItemTypeWrapper : public ObjectWrapper
public:
static ItemTypeWrapper* create(const Pokemod::ItemType* itemType, PokemodWrapper* parent);
+ Q_SCRIPTABLE Pokemod::ItemType::Count count(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE int computer() const;
Q_SCRIPTABLE int player() const;
diff --git a/pokescripting/MapWarpWrapper.cpp b/pokescripting/MapWarpWrapper.cpp
index 476c934d..370ad6f5 100644
--- a/pokescripting/MapWarpWrapper.cpp
+++ b/pokescripting/MapWarpWrapper.cpp
@@ -35,6 +35,19 @@ Pokescripting::MapWarpWrapper::MapWarpWrapper(const Pokemod::MapWarp* warp, MapW
{
}
+Pokemod::MapWarp::Type Pokescripting::MapWarpWrapper::type(const QString& name) const
+{
+ if (name == "Door")
+ return Pokemod::MapWarp::Door;
+ else if (name == "Warp")
+ return Pokemod::MapWarp::Warp;
+ else if (name == "Hole")
+ return Pokemod::MapWarp::Hole;
+ else if (name == "Boundary")
+ return Pokemod::MapWarp::Boundary;
+ return QVariant(-1).value<Pokemod::MapWarp::Type>();
+}
+
QString Pokescripting::MapWarpWrapper::name() const
{
return m_warp->name();
diff --git a/pokescripting/MapWarpWrapper.h b/pokescripting/MapWarpWrapper.h
index e787d9f6..ac894b04 100644
--- a/pokescripting/MapWarpWrapper.h
+++ b/pokescripting/MapWarpWrapper.h
@@ -36,6 +36,8 @@ class POKESCRIPTING_EXPORT MapWarpWrapper : public ObjectWrapper
public:
static MapWarpWrapper* create(const Pokemod::MapWarp* warp, MapWrapper* parent);
+ Q_SCRIPTABLE Pokemod::MapWarp::Type type(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE QPoint coordinate() const;
Q_SCRIPTABLE Pokemod::MapWarp::Type type() const;
diff --git a/pokescripting/MapWrapper.cpp b/pokescripting/MapWrapper.cpp
index 9564a995..ebd37ceb 100644
--- a/pokescripting/MapWrapper.cpp
+++ b/pokescripting/MapWrapper.cpp
@@ -58,6 +58,17 @@ Pokescripting::MapWildListWrapper* Pokescripting::MapWrapper::wildList(const int
return MapWildListWrapper::create(m_map->wildListById(id), this);
}
+Pokemod::Map::Type Pokescripting::MapWrapper::type(const QString& name) const
+{
+ if (name == "Outdoor")
+ return Pokemod::Map::Outdoor;
+ else if (name == "Dungeon")
+ return Pokemod::Map::Dungeon;
+ else if (name == "Building")
+ return Pokemod::Map::Building;
+ return QVariant(-1).value<Pokemod::Map::Type>();
+}
+
QString Pokescripting::MapWrapper::name() const
{
return m_map->name();
diff --git a/pokescripting/MapWrapper.h b/pokescripting/MapWrapper.h
index 518f614b..f0f8980f 100644
--- a/pokescripting/MapWrapper.h
+++ b/pokescripting/MapWrapper.h
@@ -45,6 +45,8 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper
MapWarpWrapper* warp(const int id);
MapWildListWrapper* wildList(const int id);
+ Q_SCRIPTABLE Pokemod::Map::Type type(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE MapWarpWrapper* flyWarp();
Q_SCRIPTABLE Pokemod::Map::Type type() const;
diff --git a/pokescripting/PokemodWrapper.cpp b/pokescripting/PokemodWrapper.cpp
index 149cd283..247fb409 100644
--- a/pokescripting/PokemodWrapper.cpp
+++ b/pokescripting/PokemodWrapper.cpp
@@ -191,7 +191,7 @@ Pokemod::Stat Pokescripting::PokemodWrapper::stat(const QString& name) const
return Pokemod::ST_Accuracy;
else if (name == "Evasion")
return Pokemod::ST_Evasion;
- return Pokemod::ST_Invalid;
+ return QVariant(-1).value<Pokemod::Stat>();
}
Pokemod::Direction Pokescripting::PokemodWrapper::direction(const QString& name) const
@@ -206,7 +206,7 @@ Pokemod::Direction Pokescripting::PokemodWrapper::direction(const QString& name)
return Pokemod::D_Right;
else if (name == "None")
return Pokemod::D_None;
- return Pokemod::D_Invalid;
+ return QVariant(-1).value<Pokemod::Direction>();
}
QString Pokescripting::PokemodWrapper::title() const
diff --git a/pokescripting/SoundWrapper.cpp b/pokescripting/SoundWrapper.cpp
index 4075f387..7754048d 100644
--- a/pokescripting/SoundWrapper.cpp
+++ b/pokescripting/SoundWrapper.cpp
@@ -41,6 +41,15 @@ Pokescripting::SoundWrapper::SoundWrapper(const Pokemod::Sound* sound, PokemodWr
{
}
+Pokemod::Sound::Type Pokescripting::SoundWrapper::type(const QString& name) const
+{
+ if (name == "Sound Effect")
+ return Pokemod::Sound::SoundEffect;
+ else if (name == "Music")
+ return Pokemod::Sound::Music;
+ return QVariant(-1).value<Pokemod::Sound::Type>();
+}
+
QString Pokescripting::SoundWrapper::name() const
{
return m_sound->name();
diff --git a/pokescripting/SoundWrapper.h b/pokescripting/SoundWrapper.h
index bb57c1c7..b6209d96 100644
--- a/pokescripting/SoundWrapper.h
+++ b/pokescripting/SoundWrapper.h
@@ -39,6 +39,8 @@ class POKESCRIPTING_EXPORT SoundWrapper : public ObjectWrapper
public:
static SoundWrapper* create(const Pokemod::Sound* sound, PokemodWrapper* parent);
+ Q_SCRIPTABLE Pokemod::Sound::Type type(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE Pokemod::Sound::Type type() const;
Q_SCRIPTABLE Phonon::MediaObject* data();
diff --git a/pokescripting/SpeciesWrapper.cpp b/pokescripting/SpeciesWrapper.cpp
index 23f76082..e80c364d 100644
--- a/pokescripting/SpeciesWrapper.cpp
+++ b/pokescripting/SpeciesWrapper.cpp
@@ -53,6 +53,23 @@ Pokemod::Hat<Pokescripting::ItemWrapper*> Pokescripting::SpeciesWrapper::itemHat
return hat;
}
+Pokemod::Species::Style Pokescripting::SpeciesWrapper::growth(const QString& name) const
+{
+ if (name == "Fluctuating")
+ return Pokemod::Species::Fluctuating;
+ else if (name == "Fading")
+ return Pokemod::Species::Fading;
+ else if (name == "Slow")
+ return Pokemod::Species::Slow;
+ else if (name == "Normal")
+ return Pokemod::Species::Normal;
+ else if (name == "Fast")
+ return Pokemod::Species::Fast;
+ else if (name == "Erratic")
+ return Pokemod::Species::Erratic;
+ return QVariant(-1).value<Pokemod::Species::Style>();
+}
+
QString Pokescripting::SpeciesWrapper::name() const
{
return m_species->name();
diff --git a/pokescripting/SpeciesWrapper.h b/pokescripting/SpeciesWrapper.h
index 6d9e9400..f42e628d 100644
--- a/pokescripting/SpeciesWrapper.h
+++ b/pokescripting/SpeciesWrapper.h
@@ -48,6 +48,8 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
Pokemod::Hat<AbilityWrapper*> abilityHat();
Pokemod::Hat<ItemWrapper*> itemHat();
+ Q_SCRIPTABLE Pokemod::Species::Style growth(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE int baseStat(const Pokemod::Stat stat) const;
Q_SCRIPTABLE int effortValue(const Pokemod::Stat stat) const;
diff --git a/pokescripting/TrainerWrapper.cpp b/pokescripting/TrainerWrapper.cpp
index 7f19bfb1..d552070b 100644
--- a/pokescripting/TrainerWrapper.cpp
+++ b/pokescripting/TrainerWrapper.cpp
@@ -34,6 +34,19 @@ Pokescripting::TrainerWrapper::TrainerWrapper(const Pokemod::Trainer* trainer, P
{
}
+Pokemod::Trainer::Intelligence Pokescripting::TrainerWrapper::intelligence(const QString& name) const
+{
+ if (name == "Ignorant")
+ return Pokemod::Trainer::Ignorant;
+ else if (name == "Determine")
+ return Pokemod::Trainer::Determine;
+ else if (name == "Remember")
+ return Pokemod::Trainer::Remember;
+ else if (name == "Cheating")
+ return Pokemod::Trainer::Cheating;
+ return QVariant(-1).value<Pokemod::Trainer::Intelligence>();
+}
+
QString Pokescripting::TrainerWrapper::TrainerWrapper::name() const
{
return m_trainer->name();
diff --git a/pokescripting/TrainerWrapper.h b/pokescripting/TrainerWrapper.h
index 726ebe50..c8ae6e85 100644
--- a/pokescripting/TrainerWrapper.h
+++ b/pokescripting/TrainerWrapper.h
@@ -36,6 +36,8 @@ class POKESCRIPTING_EXPORT TrainerWrapper : public ObjectWrapper
public:
static TrainerWrapper* create(const Pokemod::Trainer* trainer, PokemodWrapper* parent);
+ Q_SCRIPTABLE Pokemod::Trainer::Intelligence intelligence(const QString& name) const;
+
Q_SCRIPTABLE QString name() const;
Q_SCRIPTABLE int moneyFactor() const;
Q_SCRIPTABLE SkinWrapper* skin();