diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 23:40:50 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 23:40:50 +0000 |
| commit | b99070118a3cedc4fcc7514ba95fce2646d649c4 (patch) | |
| tree | 186d30a5ace8bd07e252c67804622d3d38f96fb4 | |
| parent | 91a1658e4f949dc9c06f594956fa2c3d9b73b423 (diff) | |
[FIX] TeamMember now allows shadowing of values
[FIX] TeamMember no longer uses pokemod internally (all is accessed through wrappers)
[FIX] Status now has the script split between Battle and World
[FIX] Script classes now able to be passed via QVariant
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@241 6ecfd1a5-f3ed-3746-8530-beee90d26b22
49 files changed, 351 insertions, 149 deletions
@@ -1,4 +1,14 @@ ----------------- +Rev: 241 +Date: 18 August 2008 +User: MathStuf +----------------- +[FIX] TeamMember now allows shadowing of values +[FIX] TeamMember no longer uses pokemod internally (all is accessed through wrappers) +[FIX] Status now has the script split between Battle and World +[FIX] Script classes now able to be passed via QVariant + +----------------- Rev: 240 Date: 18 August 2008 User: MathStuf diff --git a/pokebattle/Containment.cpp b/pokebattle/Containment.cpp index 99ec7a1c..48b1d10e 100644 --- a/pokebattle/Containment.cpp +++ b/pokebattle/Containment.cpp @@ -32,3 +32,8 @@ QList<Pokebattle::TeamMember*> Pokebattle::Containment::members() const { return m_members; } + +Pokescripting::PokemodWrapper* Pokebattle::Containment::pokemod() const +{ + // TODO: return PokemodWrapper +} diff --git a/pokebattle/Containment.h b/pokebattle/Containment.h index 10245ec4..6ca1a17e 100644 --- a/pokebattle/Containment.h +++ b/pokebattle/Containment.h @@ -25,9 +25,9 @@ #include <QtCore/QObject> // Forward declarations -namespace Pokemod +namespace Pokescripting { -class Pokemod; +class PokemodWrapper; } namespace Pokebattle @@ -48,7 +48,7 @@ class POKEBATTLE_EXPORT Containment : public QObject virtual bool isMutable() const = 0; - const Pokemod::Pokemod* pokemod() const; + Pokescripting::PokemodWrapper* pokemod() const; signals: public slots: protected slots: diff --git a/pokebattle/TeamMember.cpp b/pokebattle/TeamMember.cpp index 79575048..cc5dc42c 100644 --- a/pokebattle/TeamMember.cpp +++ b/pokebattle/TeamMember.cpp @@ -52,10 +52,10 @@ Pokebattle::TeamMember::TeamMember(const int speciesId, const QString& name, con Pokescripting::Config(containment), m_containment(containment) { - setSpecies(speciesId); - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); + makeConnections(); + setSpecies(pokemod()->species(speciesId)); if (name.isEmpty()) - setName(species->name()); + setName(m_species->name()); else setName(name); setLevel(level); @@ -65,15 +65,15 @@ Pokebattle::TeamMember::TeamMember(const int speciesId, const QString& name, con initMoves(); initNatures(); initStats(); - if (species->genderFactor() <= 1) - m_gender = species->genderFactor().poll(); + if (m_species->genderFactor() <= 1) + m_gender = (m_species->genderFactor().poll() ? Male : Female); else - m_gender = -1; + m_gender = Genderless; for (int i = 0; i < Pokemod::ST_End_GSC; ++i) m_statExp[i] = 0; if (m_containment->isMutable()) { - const Pokemod::Script script = species->evolution(); + const Pokemod::Script script = m_species->evolution(); Kross::Action* evolution = new Kross::Action(Kross::Manager::self().actionCollection()->collection("evolutions"), QString("evolution-%1").arg(QUuid::createUuid().toString())); evolution->setInterpreter(script.interpreter()); evolution->setCode(script.script().toUtf8()); @@ -86,41 +86,37 @@ Pokebattle::TeamMember::TeamMember(Pokescripting::MapTrainerTeamMemberWrapper* t Pokescripting::Config(containment), m_containment(containment) { - setSpecies(teamMember->species()->id()); - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); - setName(species->name()); + makeConnections(); + setSpecies(teamMember->species()); + setName(m_species->name()); setLevel(teamMember->level()); - QList<Pokescripting::ItemWrapper*> items = teamMember->items(); - foreach (Pokescripting::ItemWrapper* item, items) - m_items.append(item->id()); - QList<Pokescripting::AbilityWrapper*> abilities = teamMember->abilities(); - foreach (Pokescripting::AbilityWrapper* ability, abilities) - m_abilities.append(ability->id()); + m_items = teamMember->items(); + m_abilities = teamMember->abilities(); initAbilities(); - QList<Pokescripting::MoveWrapper*> moves = teamMember->moves(); - foreach (Pokescripting::MoveWrapper* move, moves) - m_moves.append(move->id()); + m_moves = teamMember->moves(); initMoves(); - QList<Pokescripting::NatureWrapper*> natures = teamMember->natures(); - foreach (Pokescripting::NatureWrapper* nature, natures) - m_natures.append(nature->id()); + m_natures = teamMember->natures(); initNatures(); initStats(); - if (species->genderFactor() <= 1) - m_gender = species->genderFactor().poll(); + if (m_species->genderFactor() <= 1) + m_gender = (m_species->genderFactor().poll() ? Male : Female); else - m_gender = -1; + m_gender = Genderless; for (int i = 0; i < Pokemod::ST_End_GSC; ++i) m_statExp[i] = 0; } QString Pokebattle::TeamMember::name() const { + if (value("name").canConvert<QString>()) + return value("name").toString(); return m_name; } -int Pokebattle::TeamMember::species() const +Pokescripting::SpeciesWrapper* Pokebattle::TeamMember::species() const { + if (value("species").canConvert<Pokescripting::SpeciesWrapper*>()) + return value("species").value<Pokescripting::SpeciesWrapper*>(); return m_species; } @@ -129,26 +125,65 @@ int Pokebattle::TeamMember::level() const return m_level; } +Pokebattle::TeamMember::Gender Pokebattle::TeamMember::gender() const +{ + if (value("gender").canConvert<Gender>()) + return value("gender").value<Gender>(); + return m_gender; +} + +int Pokebattle::TeamMember::levelExperience() const +{ + if (value("levelExperience").canConvert<int>()) + return value("levelExperience").toInt(); + return m_levelExp; +} + +int Pokebattle::TeamMember::baseStat(const Pokemod::Stat stat) const +{ + if (value("overrideBaseStats").canConvert<bool>() && value("overrideBaseStats").toBool()) + return species()->baseStat(stat); + return m_species->baseStat(stat); +} + +int Pokebattle::TeamMember::statExperience(const Pokemod::Stat stat) const +{ + if (value(QString("statExperience-%1").arg((pokemod()->rules()->specialSplit() ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[stat])).canConvert<int>()) + return value(QString("statExperience-%1").arg((pokemod()->rules()->specialSplit() ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[stat])).toInt(); + return m_statExp[stat]; +} + +int Pokebattle::TeamMember::dv(const Pokemod::Stat stat) const +{ + if (value(QString("dv-%1").arg((pokemod()->rules()->specialSplit() ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[stat])).canConvert<int>()) + { + const int dv = value(QString("dv-%1").arg((pokemod()->rules()->specialSplit() ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[stat])).toInt(); + if (dv < (pokemod()->rules()->specialDVSplit() ? 32 : 16)) + return dv; + } + return m_dv[stat]; +} + int Pokebattle::TeamMember::statValue(const Pokemod::Stat stat, const int exp) const { int statValue; if (exp < 0) - statValue = m_statExp[stat]; + statValue = statExperience(stat); else statValue = exp; if (!pokemod()->rules()->effortValuesAllowed() && statValue) statValue = sqrt(statValue - 1) + 1; statValue >>= 2; - statValue += pokemod()->species(m_species)->baseStat(stat) << 1; + statValue += baseStat(stat) << 1; if (pokemod()->rules()->specialDVSplit()) { if (stat == Pokemod::ST_SpecialDefense) - statValue += m_dv[Pokemod::ST_Special] << 1; + statValue += dv(Pokemod::ST_Special) << 1; else - statValue += m_dv[stat] << 1; + statValue += dv(stat) << 1; } else - statValue += m_dv[stat]; + statValue += dv(stat); statValue *= double(m_level) / pokemod()->rules()->maxLevel(); if (stat == Pokemod::ST_HP) statValue += 10 + m_level; @@ -156,8 +191,8 @@ int Pokebattle::TeamMember::statValue(const Pokemod::Stat stat, const int exp) c { statValue += 5; Pokemod::Fraction multiplier; - foreach (int nature, m_natures) - multiplier *= pokemod()->nature(nature)->stat(stat); + foreach (Pokescripting::NatureWrapper* nature, m_natures) + multiplier *= nature->stat(stat); statValue *= multiplier; } return statValue; @@ -169,7 +204,7 @@ int Pokebattle::TeamMember::calcExp(int level) const level = m_level; const int square = level * level; const int cube = square * level; - switch (pokemod()->species(m_species)->growth()) + switch (m_species->growth()) { case Pokemod::Species::Fluctuating: if (level <= 15) @@ -212,12 +247,11 @@ int Pokebattle::TeamMember::calcExp(int level) const return -1; } -bool Pokebattle::TeamMember::canLearnMove(const int move) +bool Pokebattle::TeamMember::canLearnMove(Pokescripting::MoveWrapper* move) const { - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); - for (int i = 0; i < species->moveCount(); ++i) + for (int i = 0; i < m_species->moveCount(); ++i) { - if (move == species->move(i)->move()->id()) + if (move->id() == m_species->move(i)->move()->id()) return true; } return false; @@ -227,14 +261,18 @@ void Pokebattle::TeamMember::boostLevels(const int levels) { if ((m_level + levels) < pokemod()->rules()->maxLevel()) { - setLevel(m_level + levels); - emit(levelChanged(m_level)); + for (int i = 0; i < levels; ++i) + setLevel(m_level + 1); } } -void Pokebattle::TeamMember::evolveInto(const int newSpecies) +void Pokebattle::TeamMember::evolveInto(Pokescripting::SpeciesWrapper* newSpecies) { + emit(evolveStart()); + // TODO: calculate current stats setSpecies(newSpecies); + // TODO: recalculate stats and emit signals as needed + emit(evolveEnd()); } void Pokebattle::TeamMember::setName(const QString& name) @@ -247,21 +285,23 @@ void Pokebattle::TeamMember::setName(const QString& name) } } -void Pokebattle::TeamMember::cureStatus(const int status) +void Pokebattle::TeamMember::cureStatus(Pokescripting::StatusWrapper* status) { if (m_status.contains(status)) { m_status.removeAll(status); + // TODO: clean up status script emit(statusCured(status)); } } -void Pokebattle::TeamMember::giveStatus(const int status) +void Pokebattle::TeamMember::giveStatus(Pokescripting::StatusWrapper* status) { Q_ASSERT(pokemod()->statusIndex(status) != INT_MAX); if (!m_status.contains(status)) { m_status.append(status); + // TODO: initialize status script emit(statusInflicted(status)); } } @@ -280,7 +320,6 @@ void Pokebattle::TeamMember::giveLevelExp(const int exp) { setLevel(m_level + 1); emit(expGained(expNeeded)); - emit(levelChanged(m_level)); giveLevelExp(exp - expNeeded); } } @@ -315,19 +354,17 @@ void Pokebattle::TeamMember::giveStatExp(const Pokemod::Stat stat, const int exp emit(statChanged(stat, newStat)); } -void Pokebattle::TeamMember::takeItem(const int itemIndex) +void Pokebattle::TeamMember::takeItem(Pokescripting::ItemWrapper* item) { - if (itemIndex < m_items.size()) + if (m_items.contains(item)) { - const int item = m_items[itemIndex]; - m_items.removeAt(itemIndex); + m_items.removeAt(m_items.indexOf(item)); emit(itemTaken(item)); } } -void Pokebattle::TeamMember::giveItem(const int item) +void Pokebattle::TeamMember::giveItem(Pokescripting::ItemWrapper* item) { - Q_ASSERT(pokemod()->itemIndex(item) != INT_MAX); if (m_items.size() < pokemod()->rules()->maxHeldItems()) { m_items.append(item); @@ -335,24 +372,27 @@ void Pokebattle::TeamMember::giveItem(const int item) } } -void Pokebattle::TeamMember::forgetMove(const int moveIndex) +void Pokebattle::TeamMember::forgetMove(Pokescripting::MoveWrapper* move) { - if (moveIndex < m_moves.size()) + if (m_moves.contains(move)) { - const int move = m_moves[moveIndex]; - m_moves.removeAt(moveIndex); + m_moves.removeAll(move); emit(moveForgotten(move)); } } -void Pokebattle::TeamMember::teachMove(const int move) +void Pokebattle::TeamMember::teachMove(Pokescripting::MoveWrapper* move) { - Q_ASSERT(pokemod()->moveIndex(move) != INT_MAX); - if ((m_moves.size() < pokemod()->rules()->maxMoves()) && canLearnMove(move)) + if (canLearnMove(move)) { - m_moves.append(move); - emit(moveLearned(move)); + if (m_moves.size() < pokemod()->rules()->maxMoves()) + { + m_moves.append(move); + emit(moveLearned(move)); + } + // TODO: Handle when the move list is full } + // TODO: signal that the move is unlearnable } Pokebattle::TeamMember::Action Pokebattle::TeamMember::requestAction() const @@ -372,11 +412,10 @@ void Pokebattle::TeamMember::writeBack() Pokescripting::PokemodWrapper* Pokebattle::TeamMember::pokemod() const { - // TODO: get pokemod -// return m_team->pokemod(); + return m_containment->pokemod(); } -void Pokebattle::TeamMember::setSpecies(const int species) +void Pokebattle::TeamMember::setSpecies(Pokescripting::SpeciesWrapper* species) { m_species = species; emit(speciesChanged(m_species)); @@ -384,40 +423,43 @@ void Pokebattle::TeamMember::setSpecies(const int species) void Pokebattle::TeamMember::setLevel(const int level) { + emit(levelAboutToGrow()); m_level = level; + emit(levelGrown(level)); m_levelExp = calcExp(); } void Pokebattle::TeamMember::levelGrown() { - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); - for (int i = 0; i < species->moveCount(); ++i) + for (int i = 0; i < m_species->moveCount(); ++i) { - Pokescripting::SpeciesMoveWrapper* move = species->move(i); + Pokescripting::SpeciesMoveWrapper* move = m_species->move(i); if (move->level() == m_level) - teachMove(move->move()->id()); + teachMove(move->move()); } } +void Pokebattle::TeamMember::makeConnections() +{ + // TODO: make connections that are necessary (watching Config changes mainly) +} + void Pokebattle::TeamMember::initItems() { - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); - Pokemod::Hat<Pokescripting::ItemWrapper*> hat = species->itemHat(); - m_items.clear(); + Pokemod::Hat<Pokescripting::ItemWrapper*> hat = m_species->itemHat(); for (int i = 0; i < pokemod()->rules()->maxHeldItems(); ++i) { - if (species->itemChance().poll()) - m_items.append(hat.pick()->id()); + if (m_species->itemChance().poll()) + m_items.append(hat.pick()); } } void Pokebattle::TeamMember::initAbilities() { - Pokemod::Hat<Pokescripting::AbilityWrapper*> hat = pokemod()->species(m_species)->abilityHat(); - m_abilities.clear(); + Pokemod::Hat<Pokescripting::AbilityWrapper*> hat = m_species->abilityHat(); while (m_abilities.size() < pokemod()->rules()->maxAbilities()) { - int ability = hat.takeAndClear()->id(); + Pokescripting::AbilityWrapper* ability = hat.takeAndClear(); if (!m_abilities.contains(ability)) m_abilities.append(ability); } @@ -425,23 +467,20 @@ void Pokebattle::TeamMember::initAbilities() void Pokebattle::TeamMember::initMoves() { - Pokescripting::SpeciesWrapper* species = pokemod()->species(m_species); - m_moves.clear(); - for (int i = 0; (i < species->moveCount()) && (m_moves.size() < pokemod()->rules()->maxMoves()); ++i) + for (int i = 0; (i < m_species->moveCount()) && (m_moves.size() < pokemod()->rules()->maxMoves()); ++i) { - Pokescripting::SpeciesMoveWrapper* move = species->move(i); - if (!m_moves.contains(move->move()->id()) && (((move->level() < m_level) && move->level()) || (!m_containment->isMutable() && (move->wild() < m_level)))) - m_moves.append(move->move()->id()); + Pokescripting::SpeciesMoveWrapper* move = m_species->move(i); + if (!m_moves.contains(move->move()) && (((move->level() < m_level) && move->level()) || (!m_containment->isMutable() && (move->wild() < m_level)))) + m_moves.append(move->move()); } } void Pokebattle::TeamMember::initNatures() { Pokemod::Hat<Pokescripting::NatureWrapper*> hat = pokemod()->natureHat(); - m_natures.clear(); while (m_natures.size() < pokemod()->rules()->maxNatures()) { - int nature = hat.takeAndClear()->id(); + Pokescripting::NatureWrapper* nature = hat.takeAndClear(); if (!m_natures.contains(nature)) m_natures.append(nature); } diff --git a/pokebattle/TeamMember.h b/pokebattle/TeamMember.h index 89693ee5..504fe0e0 100644 --- a/pokebattle/TeamMember.h +++ b/pokebattle/TeamMember.h @@ -37,8 +37,14 @@ // Forward declarations namespace Pokescripting { +class AbilityWrapper; +class ItemWrapper; +class MoveWrapper; +class NatureWrapper; class MapTrainerTeamMemberWrapper; class PokemodWrapper; +class SpeciesWrapper; +class StatusWrapper; } namespace Pokebattle @@ -51,6 +57,13 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config Q_OBJECT public: + enum Gender + { + Male = 0, + Female = 1, + Genderless = 2 + }; + enum ActionType { Attack = 0, @@ -58,8 +71,7 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config Switch = 2, Run = 3, Skip = 4, - Timeout = 5, - End = 6 + Timeout = 5 }; typedef QPair<ActionType, QVariant> Action; @@ -69,43 +81,52 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config TeamMember(Pokescripting::MapTrainerTeamMemberWrapper* teamMember, Containment* containment); QString name() const; - int species() const; + Pokescripting::SpeciesWrapper* species() const; int level() const; + Gender gender() const; + int levelExperience() const; + int baseStat(const Pokemod::Stat stat) const; + int statExperience(const Pokemod::Stat stat) const; + int dv(const Pokemod::Stat stat) const; int statValue(const Pokemod::Stat stat, const int exp = -1) const; int calcExp(int level = -1) const; - bool canLearnMove(const int move); + bool canLearnMove(Pokescripting::MoveWrapper* move) const; signals: - void speciesChanged(const int species); + void speciesChanged(Pokescripting::SpeciesWrapper* species); + + void evolveStart(); + void evolveEnd(); void nameChanged(const QString& oldName, const QString& newName); void expGained(const int exp); - void statusCured(const int status); - void statusInflicted(const int status); - void levelChanged(int level); - void statChanged(Pokemod::Stat stat, int value); - void effortFull(int stat); + void statusCured(Pokescripting::StatusWrapper* status); + void statusInflicted(Pokescripting::StatusWrapper* status); + void levelAboutToGrow(); + void levelGrown(const int newLevel); + void statChanged(const Pokemod::Stat stat, const int value); + void effortFull(const int stat); void totalEffortFull(); - void itemTaken(const int item); - void itemGiven(const int item); - void moveForgotten(const int move); - void moveLearned(const int move); + void itemTaken(Pokescripting::ItemWrapper* item); + void itemGiven(Pokescripting::ItemWrapper* item); + void moveForgotten(Pokescripting::MoveWrapper* move); + void moveLearned(Pokescripting::MoveWrapper* move); void knockedOut(); public slots: void boostLevels(const int levels); - void evolveInto(const int newSpecies); + void evolveInto(Pokescripting::SpeciesWrapper* newSpecies); void setName(const QString& name); - void cureStatus(const int status); - void giveStatus(const int status); + void cureStatus(Pokescripting::StatusWrapper* status); + void giveStatus(Pokescripting::StatusWrapper* status); void giveLevelExp(const int exp); void giveStatExp(const Pokemod::Stat stat, const int exp); - void takeItem(const int itemIndex); - void giveItem(const int item); - void forgetMove(const int moveIndex); - void teachMove(const int move); + void takeItem(Pokescripting::ItemWrapper* item); + void giveItem(Pokescripting::ItemWrapper* item); + void forgetMove(Pokescripting::MoveWrapper* move); + void teachMove(Pokescripting::MoveWrapper* move); Action requestAction() const; @@ -113,7 +134,7 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config virtual void writeBack(); protected slots: - void setSpecies(const int species); + void setSpecies(Pokescripting::SpeciesWrapper* species); void setLevel(const int level); private slots: void levelGrown(); @@ -123,18 +144,20 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config Containment* m_containment; QString m_name; - int m_species; - int m_gender; + Pokescripting::SpeciesWrapper* m_species; + Gender m_gender; int m_levelExp; int m_level; int m_statExp[Pokemod::ST_End_GSC]; int m_dv[Pokemod::ST_End_GSC]; - QList<int> m_status; - QList<int> m_abilities; - QList<int> m_items; - QList<int> m_moves; - QList<int> m_natures; + QList<Pokescripting::StatusWrapper*> m_status; + QList<Pokescripting::AbilityWrapper*> m_abilities; + QList<Pokescripting::ItemWrapper*> m_items; + QList<Pokescripting::MoveWrapper*> m_moves; + QList<Pokescripting::NatureWrapper*> m_natures; private: + void makeConnections(); + void initItems(); void initAbilities(); void initMoves(); @@ -142,5 +165,10 @@ class POKEBATTLE_EXPORT TeamMember : public Pokescripting::Config void initStats(); }; } +Q_DECLARE_METATYPE(Pokebattle::TeamMember*) +Q_DECLARE_METATYPE(Pokebattle::TeamMember::Gender) +Q_DECLARE_METATYPE(Pokebattle::TeamMember::ActionType) +Q_DECLARE_METATYPE(Pokebattle::TeamMember::Action) +Q_DECLARE_METATYPE(Pokebattle::TeamMember::RequestedAction) #endif diff --git a/pokebattle/TurnArena.cpp b/pokebattle/TurnArena.cpp index f01c394e..6c279153 100644 --- a/pokebattle/TurnArena.cpp +++ b/pokebattle/TurnArena.cpp @@ -24,21 +24,25 @@ Pokebattle::TurnArena::TurnArena(QList<Player*> players, QObject* parent) : Arena(players, parent) { - connect(this, SIGNAL(roundStart()), SLOT(processRound())); setupBattle(); } void Pokebattle::TurnArena::processRound() { + emit(roundAboutToStart()); + emit(roundStart()); QFuture<TeamMember::RequestedAction> actions = QtConcurrent::mapped(active(), &Pokebattle::requestDecision); // TODO: timeout here? - // TODO: determine the (preliminary) order of attacks // TODO: wait for all actions (unless timeout) - // TODO: get order again - // TODO: act out actions (ignoring those that faint along the way) + // TODO: notify all attacks of what is going on (they can change priorities as needed) + // TODO: determine the order of attacks + // TODO: act out actions (ignoring those that affect fainting along the way) + emit(roundAboutToEnd()); emit(roundEnd()); - // TODO: If only one player left, battle is over - // TODO: restart round again + // if (teamCount <= 1) + // TODO: End Round + // else + processRound(); } void Pokebattle::TurnArena::setupBattle() diff --git a/pokebattle/TurnArena.h b/pokebattle/TurnArena.h index 18ade007..43623936 100644 --- a/pokebattle/TurnArena.h +++ b/pokebattle/TurnArena.h @@ -31,7 +31,9 @@ class POKEBATTLE_EXPORT TurnArena : public Arena public: TurnArena(QList<Player*> players, QObject* parent); signals: + void roundAboutToStart(); void roundStart(); + void roundAboutToEnd(); void roundEnd(); public slots: protected slots: diff --git a/pokemod/Status.cpp b/pokemod/Status.cpp index 41fbf680..04702d48 100644 --- a/pokemod/Status.cpp +++ b/pokemod/Status.cpp @@ -32,7 +32,8 @@ Pokemod::Status::Status(const Status& status) : Pokemod::Status::Status(const Pokemod* parent, const int id) : Object(parent, id), m_name(""), - m_script("", "") + m_battleScript("", ""), + m_worldScript("", "") { } @@ -65,14 +66,16 @@ void Pokemod::Status::load(const QDomElement& xml) { LOAD_BEGIN(); LOAD(name); - LOAD(script); + LOAD(battleScript); + LOAD(worldScript); } QDomElement Pokemod::Status::save() const { SAVE_CREATE(); SAVE(name); - SAVE(script); + SAVE(battleScript); + SAVE(worldScript); return xml; } @@ -81,9 +84,14 @@ void Pokemod::Status::setName(const QString& name) CHECK(name); } -void Pokemod::Status::setScript(const Script& script) +void Pokemod::Status::setBattleScript(const Script& battleScript) { - CHECK(script); + CHECK(battleScript); +} + +void Pokemod::Status::setWorldScript(const Script& worldScript) +{ + CHECK(worldScript); } QString Pokemod::Status::name() const @@ -91,9 +99,14 @@ QString Pokemod::Status::name() const return m_name; } -Pokemod::Script Pokemod::Status::script() const +Pokemod::Script Pokemod::Status::battleScript() const +{ + return m_battleScript; +} + +Pokemod::Script Pokemod::Status::worldScript() const { - return m_script; + return m_worldScript; } Pokemod::Status& Pokemod::Status::operator=(const Status& rhs) @@ -101,6 +114,7 @@ Pokemod::Status& Pokemod::Status::operator=(const Status& rhs) if (this == &rhs) return *this; COPY(name); - COPY(script); + COPY(battleScript); + COPY(worldScript); return *this; } diff --git a/pokemod/Status.h b/pokemod/Status.h index e891aa30..af801957 100644 --- a/pokemod/Status.h +++ b/pokemod/Status.h @@ -44,15 +44,18 @@ class POKEMOD_EXPORT Status : public Object QDomElement save() const; void setName(const QString& name); - void setScript(const Script& script); + void setBattleScript(const Script& battleScript); + void setWorldScript(const Script& worldScript); QString name() const; - Script script() const; + Script battleScript() const; + Script worldScript() const; Status& operator=(const Status& rhs); private: QString m_name; - Script m_script; + Script m_battleScript; + Script m_worldScript; }; } diff --git a/pokemodr/StatusUI.cpp b/pokemodr/StatusUI.cpp index 42618bb0..2f97daf4 100644 --- a/pokemodr/StatusUI.cpp +++ b/pokemodr/StatusUI.cpp @@ -35,7 +35,8 @@ Pokemodr::StatusUI::~StatusUI() void Pokemodr::StatusUI::setGui() { varName->setText(qobject_cast<Pokemod::Status*>(modified())->name()); - varScript->setValue(qobject_cast<Pokemod::Status*>(modified())->script()); + varBattleScript->setValue(qobject_cast<Pokemod::Status*>(modified())->battleScript()); + varWorldScript->setValue(qobject_cast<Pokemod::Status*>(modified())->worldScript()); } void Pokemodr::StatusUI::apply() @@ -58,7 +59,12 @@ void Pokemodr::StatusUI::on_varName_textChanged(const QString& name) varName->setCursorPosition(cursor); } -void Pokemodr::StatusUI::on_varScript_valueChanged(const Pokemod::Script& script) +void Pokemodr::StatusUI::on_varBattleScript_valueChanged(const Pokemod::Script& battleScript) { - qobject_cast<Pokemod::Status*>(modified())->setScript(script); + qobject_cast<Pokemod::Status*>(modified())->setBattleScript(battleScript); +} + +void Pokemodr::StatusUI::on_varWorldScript_valueChanged(const Pokemod::Script& worldScript) +{ + qobject_cast<Pokemod::Status*>(modified())->setWorldScript(worldScript); } diff --git a/pokemodr/StatusUI.h b/pokemodr/StatusUI.h index 632ca056..08c1c8a8 100644 --- a/pokemodr/StatusUI.h +++ b/pokemodr/StatusUI.h @@ -44,7 +44,8 @@ class StatusUI : public ObjectUI, private Ui::formStatus void discard(); protected slots: void on_varName_textChanged(const QString& name); - void on_varScript_valueChanged(const Pokemod::Script& script); + void on_varBattleScript_valueChanged(const Pokemod::Script& battleScript); + void on_varWorldScript_valueChanged(const Pokemod::Script& worldScript); private slots: void setGui(); }; diff --git a/pokemodr/gui/status.ui b/pokemodr/gui/status.ui index ba8e2bd0..e93f712b 100644 --- a/pokemodr/gui/status.ui +++ b/pokemodr/gui/status.ui @@ -28,22 +28,43 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxScript" > + <widget class="QGroupBox" name="boxBattleScript" > <property name="title" > - <string>Script</string> + <string>Battle Script</string> </property> <property name="toolTip" > - <string>The script that controls how the status works</string> + <string>The script that controls how the status works in battle</string> </property> <property name="statusTip" > - <string>The script that controls how the status works</string> + <string>The script that controls how the status works in battle</string> </property> <property name="whatsThis" > - <string>The script that controls how the status works</string> + <string>The script that controls how the status works in battle</string> </property> <layout class="QHBoxLayout" > <item> - <widget class="Pokemodr::ScriptWidget" name="varScript" /> + <widget class="Pokemodr::ScriptWidget" name="varBattleScript" /> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxWorldScript" > + <property name="title" > + <string>WorldScript</string> + </property> + <property name="toolTip" > + <string>The script that controls how the status works in the overworld</string> + </property> + <property name="statusTip" > + <string>The script that controls how the status works in the overworld</string> + </property> + <property name="whatsThis" > + <string>The script that controls how the status works in the overworld</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="Pokemodr::ScriptWidget" name="varWorldScript" /> </item> </layout> </widget> 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 |
