diff options
Diffstat (limited to 'pokescripting')
37 files changed, 77 insertions, 8 deletions
diff --git a/pokescripting/AbilityWrapper.h b/pokescripting/AbilityWrapper.h index 88279ab7..1b1f040b 100644 --- a/pokescripting/AbilityWrapper.h +++ b/pokescripting/AbilityWrapper.h @@ -45,5 +45,6 @@ class POKESCRIPTING_EXPORT AbilityWrapper : public ObjectWrapper const Pokemod::Ability* m_ability; }; } +Q_DECLARE_METATYPE(Pokescripting::AbilityWrapper*) #endif diff --git a/pokescripting/AuthorWrapper.h b/pokescripting/AuthorWrapper.h index 41ef6015..706f2d07 100644 --- a/pokescripting/AuthorWrapper.h +++ b/pokescripting/AuthorWrapper.h @@ -43,5 +43,6 @@ class POKESCRIPTING_EXPORT AuthorWrapper : public ObjectWrapper const Pokemod::Author* m_author; }; } +Q_DECLARE_METATYPE(Pokescripting::AuthorWrapper*) #endif diff --git a/pokescripting/BadgeWrapper.h b/pokescripting/BadgeWrapper.h index 6aafd808..1feeb6e9 100644 --- a/pokescripting/BadgeWrapper.h +++ b/pokescripting/BadgeWrapper.h @@ -48,5 +48,6 @@ class POKESCRIPTING_EXPORT BadgeWrapper : public ObjectWrapper const Pokemod::Badge* m_badge; }; } +Q_DECLARE_METATYPE(Pokescripting::BadgeWrapper*) #endif diff --git a/pokescripting/CoinListObjectWrapper.h b/pokescripting/CoinListObjectWrapper.h index f8de0489..9b507b32 100644 --- a/pokescripting/CoinListObjectWrapper.h +++ b/pokescripting/CoinListObjectWrapper.h @@ -50,5 +50,6 @@ class POKESCRIPTING_EXPORT CoinListObjectWrapper : public ObjectWrapper const Pokemod::CoinListObject* m_object; }; } +Q_DECLARE_METATYPE(Pokescripting::CoinListObjectWrapper*) #endif diff --git a/pokescripting/CoinListWrapper.h b/pokescripting/CoinListWrapper.h index d702d585..819a817e 100644 --- a/pokescripting/CoinListWrapper.h +++ b/pokescripting/CoinListWrapper.h @@ -49,5 +49,6 @@ class POKESCRIPTING_EXPORT CoinListWrapper : public ObjectWrapper const Pokemod::CoinList* m_coinList; }; } +Q_DECLARE_METATYPE(Pokescripting::CoinListWrapper*) #endif diff --git a/pokescripting/Config.cpp b/pokescripting/Config.cpp index 3e2e3adc..a0739591 100644 --- a/pokescripting/Config.cpp +++ b/pokescripting/Config.cpp @@ -23,20 +23,34 @@ Pokescripting::Config::Config(QObject* parent) : { } -void Pokescripting::Config::addValue(const QString& name, const QVariant& value) +void Pokescripting::Config::addValue(const QString& name, const QVariant& value, const bool temporary) { if (!m_values.contains(name)) - m_values[name] = value; + { + setValue(name, value, temporary); + emit(valueAdded(name, value)); + } } -void Pokescripting::Config::setValue(const QString& name, const QVariant& value) +void Pokescripting::Config::setValue(const QString& name, const QVariant& value, const bool temporary) { + const QVariant& oldValue = m_values[name]; m_values[name] = value; + if (temporary) + { + if (m_temporaries.contains(name)) + m_temporaries.append(name); + } + else + m_temporaries.removeAll(name); + emit(valueChanged(name, oldValue, value)); } void Pokescripting::Config::removeValue(const QString& name) { m_values.remove(name); + m_temporaries.removeAll(name); + emit(valueRemoved(name)); } QVariant Pokescripting::Config::value(const QString& name, const bool recursive) const @@ -65,6 +79,12 @@ bool Pokescripting::Config::hasValue(const QString& name, const bool recursive) return false; } +void Pokescripting::Config::clearTemporary() +{ + while (m_temporaries.size()) + removeValue(m_temporaries[0]); +} + void Pokescripting::Config::writeBack() { } diff --git a/pokescripting/Config.h b/pokescripting/Config.h index 7d66807b..16be5ade 100644 --- a/pokescripting/Config.h +++ b/pokescripting/Config.h @@ -22,6 +22,7 @@ #include "Global.h" // Qt includes +#include <QtCore/QList> #include <QtCore/QMap> #include <QtCore/QObject> #include <QtCore/QString> @@ -44,15 +45,23 @@ class POKESCRIPTING_EXPORT Config : public QObject Q_SCRIPTABLE QVariant value(const QString& name, const bool recursive = true) const; Q_SCRIPTABLE bool hasValue(const QString& name, const bool recursive = false) const; + signals: + void valueAdded(const QString& name, const QVariant& value); + void valueChanged(const QString& name, const QVariant& oldValue, const QVariant& newValue); + void valueRemoved(const QString& name); public slots: - void addValue(const QString& name, const QVariant& value); - void setValue(const QString& name, const QVariant& value); + void addValue(const QString& name, const QVariant& value, const bool temporary = false); + void setValue(const QString& name, const QVariant& value, const bool temporary = false); void removeValue(const QString& name); + void clearTemporary(); + virtual void writeBack(); private: QMap<QString, QVariant> m_values; + QList<QString> m_temporaries; }; } +Q_DECLARE_METATYPE(Pokescripting::Config*) #endif diff --git a/pokescripting/EggGroupWrapper.h b/pokescripting/EggGroupWrapper.h index c0552b35..6c139c1e 100644 --- a/pokescripting/EggGroupWrapper.h +++ b/pokescripting/EggGroupWrapper.h @@ -41,5 +41,6 @@ class POKESCRIPTING_EXPORT EggGroupWrapper : public ObjectWrapper const Pokemod::EggGroup* m_eggGroup; }; } +Q_DECLARE_METATYPE(Pokescripting::EggGroupWrapper*) #endif diff --git a/pokescripting/GlobalScriptWrapper.h b/pokescripting/GlobalScriptWrapper.h index 739cc60b..dd5f3e36 100644 --- a/pokescripting/GlobalScriptWrapper.h +++ b/pokescripting/GlobalScriptWrapper.h @@ -42,5 +42,6 @@ class POKESCRIPTING_EXPORT GlobalScriptWrapper : public ObjectWrapper const Pokemod::GlobalScript* m_globalScript; }; } +Q_DECLARE_METATYPE(Pokescripting::GlobalScriptWrapper*) #endif diff --git a/pokescripting/ItemTypeWrapper.h b/pokescripting/ItemTypeWrapper.h index 2570b098..7b699508 100644 --- a/pokescripting/ItemTypeWrapper.h +++ b/pokescripting/ItemTypeWrapper.h @@ -44,5 +44,6 @@ class POKESCRIPTING_EXPORT ItemTypeWrapper : public ObjectWrapper const Pokemod::ItemType* m_itemType; }; } +Q_DECLARE_METATYPE(Pokescripting::ItemTypeWrapper*) #endif diff --git a/pokescripting/ItemWrapper.h b/pokescripting/ItemWrapper.h index c650ff9b..1550c2f9 100644 --- a/pokescripting/ItemWrapper.h +++ b/pokescripting/ItemWrapper.h @@ -49,5 +49,6 @@ class POKESCRIPTING_EXPORT ItemWrapper : public ObjectWrapper const Pokemod::Item* m_item; }; } +Q_DECLARE_METATYPE(Pokescripting::ItemWrapper*) #endif diff --git a/pokescripting/MapEffectWrapper.h b/pokescripting/MapEffectWrapper.h index 1a686bb0..8ccb2781 100644 --- a/pokescripting/MapEffectWrapper.h +++ b/pokescripting/MapEffectWrapper.h @@ -49,5 +49,6 @@ class POKESCRIPTING_EXPORT MapEffectWrapper : public ObjectWrapper const Pokemod::MapEffect* m_effect; }; } +Q_DECLARE_METATYPE(Pokescripting::MapEffectWrapper*) #endif diff --git a/pokescripting/MapTrainerTeamMemberWrapper.h b/pokescripting/MapTrainerTeamMemberWrapper.h index 0e9e3ea7..313fe3f2 100644 --- a/pokescripting/MapTrainerTeamMemberWrapper.h +++ b/pokescripting/MapTrainerTeamMemberWrapper.h @@ -54,5 +54,6 @@ class POKESCRIPTING_EXPORT MapTrainerTeamMemberWrapper : public ObjectWrapper const Pokemod::MapTrainerTeamMember* m_teamMember; }; } +Q_DECLARE_METATYPE(Pokescripting::MapTrainerTeamMemberWrapper*) #endif diff --git a/pokescripting/MapTrainerWrapper.h b/pokescripting/MapTrainerWrapper.h index 9d74709e..0c65b186 100644 --- a/pokescripting/MapTrainerWrapper.h +++ b/pokescripting/MapTrainerWrapper.h @@ -53,5 +53,6 @@ class POKESCRIPTING_EXPORT MapTrainerWrapper : public ObjectWrapper const Pokemod::MapTrainer* m_trainer; }; } +Q_DECLARE_METATYPE(Pokescripting::MapTrainerWrapper*) #endif diff --git a/pokescripting/MapWarpWrapper.h b/pokescripting/MapWarpWrapper.h index 02988a39..e787d9f6 100644 --- a/pokescripting/MapWarpWrapper.h +++ b/pokescripting/MapWarpWrapper.h @@ -48,5 +48,6 @@ class POKESCRIPTING_EXPORT MapWarpWrapper : public ObjectWrapper const Pokemod::MapWarp* m_warp; }; } +Q_DECLARE_METATYPE(Pokescripting::MapWarpWrapper*) #endif diff --git a/pokescripting/MapWildListEncounterWrapper.h b/pokescripting/MapWildListEncounterWrapper.h index fb760bc2..c9459430 100644 --- a/pokescripting/MapWildListEncounterWrapper.h +++ b/pokescripting/MapWildListEncounterWrapper.h @@ -47,5 +47,6 @@ class POKESCRIPTING_EXPORT MapWildListEncounterWrapper : public ObjectWrapper const Pokemod::MapWildListEncounter* m_encounter; }; } +Q_DECLARE_METATYPE(Pokescripting::MapWildListEncounterWrapper*) #endif diff --git a/pokescripting/MapWildListWrapper.h b/pokescripting/MapWildListWrapper.h index a7bd74f5..661a3ef7 100644 --- a/pokescripting/MapWildListWrapper.h +++ b/pokescripting/MapWildListWrapper.h @@ -51,5 +51,6 @@ class POKESCRIPTING_EXPORT MapWildListWrapper : public ObjectWrapper const Pokemod::MapWildList* m_wildList; }; } +Q_DECLARE_METATYPE(Pokescripting::MapWildListWrapper*) #endif diff --git a/pokescripting/MapWrapper.h b/pokescripting/MapWrapper.h index 71b55270..518f614b 100644 --- a/pokescripting/MapWrapper.h +++ b/pokescripting/MapWrapper.h @@ -62,5 +62,6 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper const Pokemod::Map* m_map; }; } +Q_DECLARE_METATYPE(Pokescripting::MapWrapper*) #endif diff --git a/pokescripting/MoveWrapper.h b/pokescripting/MoveWrapper.h index c17ff555..37a7192f 100644 --- a/pokescripting/MoveWrapper.h +++ b/pokescripting/MoveWrapper.h @@ -53,5 +53,6 @@ class POKESCRIPTING_EXPORT MoveWrapper : public ObjectWrapper const Pokemod::Move* m_move; }; } +Q_DECLARE_METATYPE(Pokescripting::MoveWrapper*) #endif diff --git a/pokescripting/NatureWrapper.h b/pokescripting/NatureWrapper.h index 9fa71fe6..037a014c 100644 --- a/pokescripting/NatureWrapper.h +++ b/pokescripting/NatureWrapper.h @@ -43,5 +43,6 @@ class POKESCRIPTING_EXPORT NatureWrapper : public ObjectWrapper const Pokemod::Nature* m_nature; }; } +Q_DECLARE_METATYPE(Pokescripting::NatureWrapper*) #endif diff --git a/pokescripting/PokemodWrapper.h b/pokescripting/PokemodWrapper.h index 27dc56e0..f782fdb5 100644 --- a/pokescripting/PokemodWrapper.h +++ b/pokescripting/PokemodWrapper.h @@ -120,5 +120,6 @@ class POKESCRIPTING_EXPORT PokemodWrapper : public ObjectWrapper const Pokemod::Pokemod* m_pokemod; }; } +Q_DECLARE_METATYPE(Pokescripting::PokemodWrapper*) #endif diff --git a/pokescripting/RulesWrapper.h b/pokescripting/RulesWrapper.h index 56af49a3..a4492022 100644 --- a/pokescripting/RulesWrapper.h +++ b/pokescripting/RulesWrapper.h @@ -63,5 +63,6 @@ class POKESCRIPTING_EXPORT RulesWrapper : public ObjectWrapper const Pokemod::Rules* m_rules; }; } +Q_DECLARE_METATYPE(Pokescripting::RulesWrapper*) #endif diff --git a/pokescripting/SkinWrapper.h b/pokescripting/SkinWrapper.h index f1274791..1604d3f4 100644 --- a/pokescripting/SkinWrapper.h +++ b/pokescripting/SkinWrapper.h @@ -42,5 +42,6 @@ class POKESCRIPTING_EXPORT SkinWrapper : public ObjectWrapper const Pokemod::Skin* m_skin; }; } +Q_DECLARE_METATYPE(Pokescripting::SkinWrapper*) #endif diff --git a/pokescripting/SoundWrapper.h b/pokescripting/SoundWrapper.h index 3af17f0c..bb57c1c7 100644 --- a/pokescripting/SoundWrapper.h +++ b/pokescripting/SoundWrapper.h @@ -49,5 +49,6 @@ class POKESCRIPTING_EXPORT SoundWrapper : public ObjectWrapper const Pokemod::Sound* m_sound; }; } +Q_DECLARE_METATYPE(Pokescripting::SoundWrapper*) #endif diff --git a/pokescripting/SpeciesAbilityWrapper.h b/pokescripting/SpeciesAbilityWrapper.h index 62b0ee71..dafe9dbe 100644 --- a/pokescripting/SpeciesAbilityWrapper.h +++ b/pokescripting/SpeciesAbilityWrapper.h @@ -46,5 +46,6 @@ class POKESCRIPTING_EXPORT SpeciesAbilityWrapper : public ObjectWrapper const Pokemod::SpeciesAbility* m_ability; }; } +Q_DECLARE_METATYPE(Pokescripting::SpeciesAbilityWrapper*) #endif diff --git a/pokescripting/SpeciesItemWrapper.h b/pokescripting/SpeciesItemWrapper.h index 713c48bb..b172b32f 100644 --- a/pokescripting/SpeciesItemWrapper.h +++ b/pokescripting/SpeciesItemWrapper.h @@ -46,5 +46,6 @@ class POKESCRIPTING_EXPORT SpeciesItemWrapper : public ObjectWrapper const Pokemod::SpeciesItem* m_item; }; } +Q_DECLARE_METATYPE(Pokescripting::SpeciesItemWrapper*) #endif diff --git a/pokescripting/SpeciesMoveWrapper.h b/pokescripting/SpeciesMoveWrapper.h index 08094ee0..6d575fda 100644 --- a/pokescripting/SpeciesMoveWrapper.h +++ b/pokescripting/SpeciesMoveWrapper.h @@ -47,5 +47,6 @@ class POKESCRIPTING_EXPORT SpeciesMoveWrapper : public ObjectWrapper const Pokemod::SpeciesMove* m_move; }; } +Q_DECLARE_METATYPE(Pokescripting::SpeciesMoveWrapper*) #endif diff --git a/pokescripting/SpeciesWrapper.h b/pokescripting/SpeciesWrapper.h index f7837d3b..6d9e9400 100644 --- a/pokescripting/SpeciesWrapper.h +++ b/pokescripting/SpeciesWrapper.h @@ -88,5 +88,6 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper const Pokemod::Species* m_species; }; } +Q_DECLARE_METATYPE(Pokescripting::SpeciesWrapper*) #endif diff --git a/pokescripting/SpriteWrapper.h b/pokescripting/SpriteWrapper.h index 87b101d5..cae7ae1f 100644 --- a/pokescripting/SpriteWrapper.h +++ b/pokescripting/SpriteWrapper.h @@ -42,5 +42,6 @@ class POKESCRIPTING_EXPORT SpriteWrapper : public ObjectWrapper const Pokemod::Sprite* m_sprite; }; } +Q_DECLARE_METATYPE(Pokescripting::SpriteWrapper*) #endif diff --git a/pokescripting/StatusWrapper.cpp b/pokescripting/StatusWrapper.cpp index 0b662efe..4c5191ad 100644 --- a/pokescripting/StatusWrapper.cpp +++ b/pokescripting/StatusWrapper.cpp @@ -39,7 +39,12 @@ QString Pokescripting::StatusWrapper::name() const return m_status->name(); } -Pokemod::Script Pokescripting::StatusWrapper::script() const +Pokemod::Script Pokescripting::StatusWrapper::battleScript() const { - return m_status->script(); + return m_status->battleScript(); +} + +Pokemod::Script Pokescripting::StatusWrapper::worldScript() const +{ + return m_status->worldScript(); } diff --git a/pokescripting/StatusWrapper.h b/pokescripting/StatusWrapper.h index 2b6bafba..1a84e0a4 100644 --- a/pokescripting/StatusWrapper.h +++ b/pokescripting/StatusWrapper.h @@ -34,7 +34,8 @@ class POKESCRIPTING_EXPORT StatusWrapper : public ObjectWrapper static StatusWrapper* create(const Pokemod::Status* status, PokemodWrapper* parent); Q_SCRIPTABLE QString name() const; - Q_SCRIPTABLE Pokemod::Script script() const; + Q_SCRIPTABLE Pokemod::Script battleScript() const; + Q_SCRIPTABLE Pokemod::Script worldScript() const; private: StatusWrapper(const Pokemod::Status* status, PokemodWrapper* parent); StatusWrapper& operator=(const StatusWrapper& rhs); @@ -42,5 +43,6 @@ class POKESCRIPTING_EXPORT StatusWrapper : public ObjectWrapper const Pokemod::Status* m_status; }; } +Q_DECLARE_METATYPE(Pokescripting::StatusWrapper*) #endif diff --git a/pokescripting/StoreWrapper.h b/pokescripting/StoreWrapper.h index caf458b3..18892e8f 100644 --- a/pokescripting/StoreWrapper.h +++ b/pokescripting/StoreWrapper.h @@ -45,5 +45,6 @@ class POKESCRIPTING_EXPORT StoreWrapper : public ObjectWrapper const Pokemod::Store* m_store; }; } +Q_DECLARE_METATYPE(Pokescripting::StoreWrapper*) #endif diff --git a/pokescripting/TileWrapper.h b/pokescripting/TileWrapper.h index 0075b965..a32d3594 100644 --- a/pokescripting/TileWrapper.h +++ b/pokescripting/TileWrapper.h @@ -47,5 +47,6 @@ class POKESCRIPTING_EXPORT TileWrapper : public ObjectWrapper const Pokemod::Tile* m_tile; }; } +Q_DECLARE_METATYPE(Pokescripting::TileWrapper*) #endif diff --git a/pokescripting/TimeWrapper.h b/pokescripting/TimeWrapper.h index d234d9f5..e7326cfb 100644 --- a/pokescripting/TimeWrapper.h +++ b/pokescripting/TimeWrapper.h @@ -43,5 +43,6 @@ class POKESCRIPTING_EXPORT TimeWrapper : public ObjectWrapper const Pokemod::Time* m_time; }; } +Q_DECLARE_METATYPE(Pokescripting::TimeWrapper*) #endif diff --git a/pokescripting/TrainerWrapper.h b/pokescripting/TrainerWrapper.h index da84fdbb..726ebe50 100644 --- a/pokescripting/TrainerWrapper.h +++ b/pokescripting/TrainerWrapper.h @@ -52,5 +52,6 @@ class POKESCRIPTING_EXPORT TrainerWrapper : public ObjectWrapper const Pokemod::Trainer* m_trainer; }; } +Q_DECLARE_METATYPE(Pokescripting::TrainerWrapper*) #endif diff --git a/pokescripting/TypeWrapper.h b/pokescripting/TypeWrapper.h index 2c55de63..02dba293 100644 --- a/pokescripting/TypeWrapper.h +++ b/pokescripting/TypeWrapper.h @@ -42,5 +42,6 @@ class POKESCRIPTING_EXPORT TypeWrapper : public ObjectWrapper const Pokemod::Type* m_type; }; } +Q_DECLARE_METATYPE(Pokescripting::TypeWrapper*) #endif diff --git a/pokescripting/WeatherWrapper.h b/pokescripting/WeatherWrapper.h index 75140120..4a915af2 100644 --- a/pokescripting/WeatherWrapper.h +++ b/pokescripting/WeatherWrapper.h @@ -42,5 +42,6 @@ class POKESCRIPTING_EXPORT WeatherWrapper : public ObjectWrapper const Pokemod::Weather* m_weather; }; } +Q_DECLARE_METATYPE(Pokescripting::WeatherWrapper*) #endif |
