diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-06-28 19:37:45 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-06-28 19:37:45 +0000 |
| commit | 300e44b68e075d7fd78287e10262b0d502f4898d (patch) | |
| tree | 4c7d74eeb963f7f71c277d9fcc4275047a64a15c | |
| parent | d0a69fb182b3f11dd8073d1a3d33a61a75da66fc (diff) | |
| download | sigen-300e44b68e075d7fd78287e10262b0d502f4898d.tar.gz sigen-300e44b68e075d7fd78287e10262b0d502f4898d.tar.xz sigen-300e44b68e075d7fd78287e10262b0d502f4898d.zip | |
[FIX] Macros fixed and ID can't be set outside of constructors
[FIX] Map flyWarp no longer raises and error by default
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@216 6ecfd1a5-f3ed-3746-8530-beee90d26b22
71 files changed, 220 insertions, 174 deletions
@@ -1,4 +1,12 @@ ----------------- +Rev: 216 +Date: 28 June 2008 +User: MathStuf +----------------- +[FIX] Macros fixed and ID can't be set outside of constructors +[FIX] Map flyWarp no longer raises and error by default + +----------------- Rev: 215 Date: 22 June 2008 User: MathStuf diff --git a/pokegen.spec b/pokegen.spec index 03af94f2..b41d40ce 100644 --- a/pokegen.spec +++ b/pokegen.spec @@ -1,6 +1,6 @@ Name: pokegen Version: 0.0.2 -Release: 0.5.20080622svn215%{?dist} +Release: 0.5.20080628svn216%{?dist} Summary: Pokégen is a game aiming to be a customizable Pokémon-like game Group: Amusements/Games diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp index 939e1576..0d536765 100644 --- a/pokemod/Ability.cpp +++ b/pokemod/Ability.cpp @@ -45,7 +45,8 @@ Pokemod::Ability::Ability(const Ability& ability, const Pokemod* parent, const i Pokemod::Ability::Ability(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Ability", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Ability::~Ability() @@ -60,9 +61,9 @@ void Pokemod::Ability::validate() TEST_END(); } -void Pokemod::Ability::load(const QDomElement& xml, int id) +void Pokemod::Ability::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QString, description); LOAD(Script, script); diff --git a/pokemod/Ability.h b/pokemod/Ability.h index 413d6783..9a2aa898 100644 --- a/pokemod/Ability.h +++ b/pokemod/Ability.h @@ -35,12 +35,12 @@ class POKEMOD_EXPORT Ability : public Object Ability(const Ability& ability); Ability(const Pokemod* parent, const int id); Ability(const Ability& ability, const Pokemod* parent, const int id); - Ability(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Ability(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Ability(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp index 44ce70b7..4f3bdf9d 100644 --- a/pokemod/Author.cpp +++ b/pokemod/Author.cpp @@ -48,7 +48,8 @@ Pokemod::Author::Author(const Author& author, const Pokemod* parent, const int i Pokemod::Author::Author(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Author", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Author::validate() @@ -65,9 +66,9 @@ void Pokemod::Author::validate() TEST_END(); } -void Pokemod::Author::load(const QDomElement& xml, int id) +void Pokemod::Author::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QString, email); LOAD(QString, role); diff --git a/pokemod/Author.h b/pokemod/Author.h index 65e25dda..23f36b38 100644 --- a/pokemod/Author.h +++ b/pokemod/Author.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT Author : public Object Author(const Author& author); Author(const Pokemod* parent, const int id); Author(const Author& author, const Pokemod* parent, const int id); - Author(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Author(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp index b69d02e7..3d71f545 100644 --- a/pokemod/Badge.cpp +++ b/pokemod/Badge.cpp @@ -49,7 +49,8 @@ Pokemod::Badge::Badge(const Badge& badge, const Pokemod* parent, const int id) : Pokemod::Badge::Badge(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Badge", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Badge::validate() @@ -64,9 +65,9 @@ void Pokemod::Badge::validate() TEST_END(); } -void Pokemod::Badge::load(const QDomElement& xml, int id) +void Pokemod::Badge::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QPixmap, face); LOAD(QPixmap, badge); diff --git a/pokemod/Badge.h b/pokemod/Badge.h index cd0ee089..6d95ef92 100644 --- a/pokemod/Badge.h +++ b/pokemod/Badge.h @@ -39,11 +39,11 @@ class POKEMOD_EXPORT Badge : public Object Badge(const Badge& badge); Badge(const Pokemod* parent, const int id); Badge(const Badge& badge, const Pokemod* parent, const int id); - Badge(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Badge(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index c15a1585..a342862d 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -48,7 +48,8 @@ Pokemod::CoinList::CoinList(const CoinList& coinList, const Pokemod* parent, con Pokemod::CoinList::CoinList(const QDomElement& xml, const Pokemod* parent, const int id) : Object("CoinList", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::CoinList::~CoinList() @@ -99,9 +100,9 @@ void Pokemod::CoinList::validate() TEST_END(); } -void Pokemod::CoinList::load(const QDomElement& xml, int id) +void Pokemod::CoinList::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Script, script); LOAD_SUB(newObject, CoinListObject); diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h index 79b532fb..a04503cc 100644 --- a/pokemod/CoinList.h +++ b/pokemod/CoinList.h @@ -39,12 +39,12 @@ class POKEMOD_EXPORT CoinList : public Object CoinList(const CoinList& coinList); CoinList(const Pokemod* parent, const int id); CoinList(const CoinList& coinList, const Pokemod* parent, const int id); - CoinList(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + CoinList(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~CoinList(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp index 36cfaa92..5fb07840 100644 --- a/pokemod/CoinListObject.cpp +++ b/pokemod/CoinListObject.cpp @@ -49,7 +49,8 @@ Pokemod::CoinListObject::CoinListObject(const CoinListObject& object, const Coin Pokemod::CoinListObject::CoinListObject(const QDomElement& xml, const CoinList* parent, const int id) : Object("CoinListObject", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::CoinListObject::validate() @@ -61,9 +62,9 @@ void Pokemod::CoinListObject::validate() TEST_END(); } -void Pokemod::CoinListObject::load(const QDomElement& xml, int id) +void Pokemod::CoinListObject::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, type); LOAD(int, object); LOAD(int, amount); diff --git a/pokemod/CoinListObject.h b/pokemod/CoinListObject.h index 98093f9d..296dd254 100644 --- a/pokemod/CoinListObject.h +++ b/pokemod/CoinListObject.h @@ -42,11 +42,11 @@ class POKEMOD_EXPORT CoinListObject : public Object CoinListObject(const CoinListObject& object); CoinListObject(const CoinList* parent, const int id); CoinListObject(const CoinListObject& object, const CoinList* parent, const int id); - CoinListObject(const QDomElement& xml, const CoinList* parent, const int id = INT_MAX); + CoinListObject(const QDomElement& xml, const CoinList* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setType(const int type); diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp index eee5b353..450467fc 100644 --- a/pokemod/EggGroup.cpp +++ b/pokemod/EggGroup.cpp @@ -43,7 +43,8 @@ Pokemod::EggGroup::EggGroup(const EggGroup& eggGroup, const Pokemod* parent, con Pokemod::EggGroup::EggGroup(const QDomElement& xml, const Pokemod* parent, const int id) : Object("EggGroup", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::EggGroup::validate() @@ -54,9 +55,9 @@ void Pokemod::EggGroup::validate() TEST_END(); } -void Pokemod::EggGroup::load(const QDomElement& xml, int id) +void Pokemod::EggGroup::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); } diff --git a/pokemod/EggGroup.h b/pokemod/EggGroup.h index e31804e2..5d2927f7 100644 --- a/pokemod/EggGroup.h +++ b/pokemod/EggGroup.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT EggGroup : public Object EggGroup(const EggGroup& eggGroup); EggGroup(const Pokemod* parent, const int id); EggGroup(const EggGroup& eggGroup, const Pokemod* parent, const int id); - EggGroup(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + EggGroup(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/GlobalScript.cpp b/pokemod/GlobalScript.cpp index 47418b4c..cafd6835 100644 --- a/pokemod/GlobalScript.cpp +++ b/pokemod/GlobalScript.cpp @@ -44,7 +44,8 @@ Pokemod::GlobalScript::GlobalScript(const GlobalScript& globalScript, const Poke Pokemod::GlobalScript::GlobalScript(const QDomElement& xml, const Pokemod* parent, const int id) : Object("GlobalScript", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::GlobalScript::~GlobalScript() @@ -59,9 +60,9 @@ void Pokemod::GlobalScript::validate() TEST_END(); } -void Pokemod::GlobalScript::load(const QDomElement& xml, int id) +void Pokemod::GlobalScript::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Script, script); } diff --git a/pokemod/GlobalScript.h b/pokemod/GlobalScript.h index e8409390..097cd8a5 100644 --- a/pokemod/GlobalScript.h +++ b/pokemod/GlobalScript.h @@ -35,12 +35,12 @@ class POKEMOD_EXPORT GlobalScript : public Object GlobalScript(const GlobalScript& globalScript); GlobalScript(const Pokemod* parent, const int id); GlobalScript(const GlobalScript& globalScript, const Pokemod* parent, const int id); - GlobalScript(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + GlobalScript(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~GlobalScript(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index faaa1bd7..f0dd9392 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -52,7 +52,8 @@ Pokemod::Item::Item(const Item& item, const Pokemod* parent, const int id) : Pokemod::Item::Item(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Item", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Item::~Item() @@ -69,9 +70,9 @@ void Pokemod::Item::validate() TEST_END(); } -void Pokemod::Item::load(const QDomElement& xml, int id) +void Pokemod::Item::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(bool, sellable); LOAD(int, type); diff --git a/pokemod/Item.h b/pokemod/Item.h index 8404d896..01583ef9 100644 --- a/pokemod/Item.h +++ b/pokemod/Item.h @@ -35,12 +35,12 @@ class POKEMOD_EXPORT Item : public Object Item(const Item& item); Item(const Pokemod* parent, const int id); Item(const Item& item, const Pokemod* parent, const int id); - Item(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Item(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Item(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/ItemType.cpp b/pokemod/ItemType.cpp index d01a8901..55e20d72 100644 --- a/pokemod/ItemType.cpp +++ b/pokemod/ItemType.cpp @@ -48,7 +48,8 @@ Pokemod::ItemType::ItemType(const ItemType& itemType, const Pokemod* parent, con Pokemod::ItemType::ItemType(const QDomElement& xml, const Pokemod* parent, const int id) : Object("ItemType", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::ItemType::validate() @@ -61,9 +62,9 @@ void Pokemod::ItemType::validate() TEST_END(); } -void Pokemod::ItemType::load(const QDomElement& xml, int id) +void Pokemod::ItemType::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(int, computer); LOAD(int, player); diff --git a/pokemod/ItemType.h b/pokemod/ItemType.h index 91f2fcf1..1a67c384 100644 --- a/pokemod/ItemType.h +++ b/pokemod/ItemType.h @@ -42,11 +42,11 @@ class POKEMOD_EXPORT ItemType : public Object ItemType(const ItemType& itemType); ItemType(const Pokemod* parent, const int id); ItemType(const ItemType& itemType, const Pokemod* parent, const int id); - ItemType(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + ItemType(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Macros.h b/pokemod/Macros.h index 0ab9704e..f28d34e9 100644 --- a/pokemod/Macros.h +++ b/pokemod/Macros.h @@ -21,13 +21,18 @@ // Qt includes #include <QtCore/QBuffer> +/** + * @todo The macros should probably be replaced by protected static members of \a Pokemod::Object + */ + #define LOAD_NODE(variable) xml.firstChildElement(variable) #define LOAD_DATA(node) node.firstChild().toText().data() #define LOAD_ID() \ - if (id == INT_MAX) \ - id = xml.attribute("id", "2147483647").toInt(); \ - setId(id); \ - clear() + int newId = id; \ + if ((id == -1) && xml.hasAttribute("id")) \ + newId = xml.attribute("id", "-1").toInt(); \ + setId(newId) +#define LOAD_BEGIN() clear() #define LOAD(type, variable) m_##variable = LOAD_##type(LOAD_NODE(#variable)) #define LOAD_bool(node) ((LOAD_DATA(node) == "true") ? true : false) #define LOAD_int(node) LOAD_DATA(node).toInt() diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index b2ba980c..93815983 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -40,7 +40,7 @@ Pokemod::Map::Map(const Map& map) : Pokemod::Map::Map(const Pokemod* parent, const int id) : Object("Map", parent, id), m_name(""), - m_flyWarp(INT_MAX), + m_flyWarp(-1), m_type(INT_MAX) { } @@ -54,7 +54,8 @@ Pokemod::Map::Map(const Map& map, const Pokemod* parent, const int id) : Pokemod::Map::Map(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Map", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Map::~Map() @@ -103,9 +104,9 @@ void Pokemod::Map::validate() TEST_END(); } -void Pokemod::Map::load(const QDomElement& xml, int id) +void Pokemod::Map::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(int, flyWarp); LOAD(int, type); @@ -137,7 +138,7 @@ void Pokemod::Map::setName(const QString& name) void Pokemod::Map::setFlyWarp(const int flyWarp) { - if ((flyWarp != INT_MAX) && (warpIndex(flyWarp) == INT_MAX)) + if ((flyWarp != -1) && (warpIndex(flyWarp) == INT_MAX)) { emit(error(bounds("flyWarp"))); return; diff --git a/pokemod/Map.h b/pokemod/Map.h index 9d0ac910..2d6933c9 100644 --- a/pokemod/Map.h +++ b/pokemod/Map.h @@ -51,12 +51,12 @@ class POKEMOD_EXPORT Map : public Object Map(const Map& map); Map(const Pokemod* parent, const int id); Map(const Map& map, const Pokemod* parent, const int id); - Map(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Map(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Map(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp index e3e1d1f5..2f333f2c 100644 --- a/pokemod/MapEffect.cpp +++ b/pokemod/MapEffect.cpp @@ -48,7 +48,8 @@ Pokemod::MapEffect::MapEffect(const MapEffect& effect, const Map* parent, const Pokemod::MapEffect::MapEffect(const QDomElement& xml, const Map* parent, const int id) : Object("MapEffect", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::MapEffect::validate() @@ -61,9 +62,9 @@ void Pokemod::MapEffect::validate() TEST_END(); } -void Pokemod::MapEffect::load(const QDomElement& xml, int id) +void Pokemod::MapEffect::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Point, coordinate); LOAD(QPixmap, skin); diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h index 6c8a988c..d86bf3d1 100644 --- a/pokemod/MapEffect.h +++ b/pokemod/MapEffect.h @@ -39,11 +39,11 @@ class POKEMOD_EXPORT MapEffect : public Object MapEffect(const MapEffect& effect); MapEffect(const Map* parent, const int id); MapEffect(const MapEffect& effect, const Map* parent, const int id); - MapEffect(const QDomElement& xml, const Map* parent, const int id = INT_MAX); + MapEffect(const QDomElement& xml, const Map* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index 8aef8595..31507ec5 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -54,7 +54,8 @@ Pokemod::MapTrainer::MapTrainer(const MapTrainer& trainer, const Map* parent, co Pokemod::MapTrainer::MapTrainer(const QDomElement& xml, const Map* parent, const int id) : Object("MapTrainer", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::MapTrainer::~MapTrainer() @@ -80,9 +81,9 @@ void Pokemod::MapTrainer::validate() TEST_END(); } -void Pokemod::MapTrainer::load(const QDomElement& xml, int id) +void Pokemod::MapTrainer::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(int, trainerClass); LOAD(Point, coordinate); diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h index 425e91c3..23fd7927 100644 --- a/pokemod/MapTrainer.h +++ b/pokemod/MapTrainer.h @@ -40,12 +40,12 @@ class POKEMOD_EXPORT MapTrainer : public Object MapTrainer(const MapTrainer& trainer); MapTrainer(const Map* parent, const int id); MapTrainer(const MapTrainer& trainer, const Map* parent, const int id); - MapTrainer(const QDomElement& xml, const Map* parent, const int id = INT_MAX); + MapTrainer(const QDomElement& xml, const Map* parent, const int id = -1); ~MapTrainer(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp index ad1945cb..1d81732e 100644 --- a/pokemod/MapTrainerTeamMember.cpp +++ b/pokemod/MapTrainerTeamMember.cpp @@ -52,7 +52,8 @@ Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainerTeamMember& Pokemod::MapTrainerTeamMember::MapTrainerTeamMember(const QDomElement& xml, const MapTrainer* parent, const int id) : Object("MapTrainerTeamMember", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::MapTrainerTeamMember::validate() @@ -75,9 +76,9 @@ void Pokemod::MapTrainerTeamMember::validate() TEST_END(); } -void Pokemod::MapTrainerTeamMember::load(const QDomElement& xml, int id) +void Pokemod::MapTrainerTeamMember::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, species); LOAD(int, level); LOAD_LIST(int, ability); diff --git a/pokemod/MapTrainerTeamMember.h b/pokemod/MapTrainerTeamMember.h index 67065d53..74728fdd 100644 --- a/pokemod/MapTrainerTeamMember.h +++ b/pokemod/MapTrainerTeamMember.h @@ -37,11 +37,11 @@ class POKEMOD_EXPORT MapTrainerTeamMember : public Object MapTrainerTeamMember(const MapTrainerTeamMember& teamMember); MapTrainerTeamMember(const MapTrainer* parent, const int id); MapTrainerTeamMember(const MapTrainerTeamMember& teamMember, const MapTrainer* parent, const int id); - MapTrainerTeamMember(const QDomElement& xml, const MapTrainer* parent, const int id = INT_MAX); + MapTrainerTeamMember(const QDomElement& xml, const MapTrainer* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setSpecies(const int species); diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp index e3f1f090..872fe894 100644 --- a/pokemod/MapWarp.cpp +++ b/pokemod/MapWarp.cpp @@ -51,7 +51,8 @@ Pokemod::MapWarp::MapWarp(const MapWarp& warp, const Map* parent, const int id) Pokemod::MapWarp::MapWarp(const QDomElement& xml, const Map* parent, const int id) : Object("MapWarp", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::MapWarp::validate() @@ -65,9 +66,9 @@ void Pokemod::MapWarp::validate() TEST_END(); } -void Pokemod::MapWarp::load(const QDomElement& xml, int id) +void Pokemod::MapWarp::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Point, coordinate); LOAD(int, type); diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h index 84e133be..02d11dd2 100644 --- a/pokemod/MapWarp.h +++ b/pokemod/MapWarp.h @@ -21,11 +21,13 @@ // Pokemod includes #include "Object.h" #include "Point.h" -#include "Pokemod.h" #include "Script.h" namespace Pokemod { +// Forward declarations +class Map; + class POKEMOD_EXPORT MapWarp : public Object { Q_OBJECT @@ -44,11 +46,11 @@ class POKEMOD_EXPORT MapWarp : public Object MapWarp(const MapWarp& warp); MapWarp(const Map* parent, const int id); MapWarp(const MapWarp& warp, const Map* parent, const int id); - MapWarp(const QDomElement& xml, const Map* parent, const int id = INT_MAX); + MapWarp(const QDomElement& xml, const Map* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp index 30613ede..c4b519e4 100644 --- a/pokemod/MapWildList.cpp +++ b/pokemod/MapWildList.cpp @@ -47,7 +47,8 @@ Pokemod::MapWildList::MapWildList(const MapWildList& wildList, const Map* parent Pokemod::MapWildList::MapWildList(const QDomElement& xml, const Map* parent, const int id) : Object("MapWildList", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::MapWildList::~MapWildList() @@ -69,9 +70,9 @@ void Pokemod::MapWildList::validate() TEST_END(); } -void Pokemod::MapWildList::load(const QDomElement& xml, int id) +void Pokemod::MapWildList::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD_SUB(newEncounter, MapWildListEncounter); } diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h index 1e6ef54d..35027fa7 100644 --- a/pokemod/MapWildList.h +++ b/pokemod/MapWildList.h @@ -38,12 +38,12 @@ class POKEMOD_EXPORT MapWildList : public Object MapWildList(const MapWildList& wildList); MapWildList(const Map* parent, const int id); MapWildList(const MapWildList& wildList, const Map* parent, const int id); - MapWildList(const QDomElement& xml, const Map* parent, const int id = INT_MAX); + MapWildList(const QDomElement& xml, const Map* parent, const int id = -1); ~MapWildList(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp index 8af75ef7..ecec4778 100644 --- a/pokemod/MapWildListEncounter.cpp +++ b/pokemod/MapWildListEncounter.cpp @@ -48,7 +48,8 @@ Pokemod::MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& Pokemod::MapWildListEncounter::MapWildListEncounter(const QDomElement& xml, const MapWildList* parent, const int id) : Object("MapWildListEncounter", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::MapWildListEncounter::validate() @@ -60,9 +61,9 @@ void Pokemod::MapWildListEncounter::validate() TEST_END(); } -void Pokemod::MapWildListEncounter::load(const QDomElement& xml, int id) +void Pokemod::MapWildListEncounter::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, species); LOAD(int, level); LOAD(int, weight); diff --git a/pokemod/MapWildListEncounter.h b/pokemod/MapWildListEncounter.h index e8b49839..f6c942b8 100644 --- a/pokemod/MapWildListEncounter.h +++ b/pokemod/MapWildListEncounter.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT MapWildListEncounter: public Object MapWildListEncounter(const MapWildListEncounter& encounter); MapWildListEncounter(const MapWildList* parent, const int id); MapWildListEncounter(const MapWildListEncounter& encounter, const MapWildList* parent, const int id); - MapWildListEncounter(const QDomElement& xml, const MapWildList* parent, const int id = INT_MAX); + MapWildListEncounter(const QDomElement& xml, const MapWildList* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setSpecies(const int species); diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 84c29e7a..5393e427 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -55,7 +55,8 @@ Pokemod::Move::Move(const Move& move, const Pokemod* parent, const int id) : Pokemod::Move::Move(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Move", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Move::~Move() @@ -73,9 +74,9 @@ void Pokemod::Move::validate() TEST_END(); } -void Pokemod::Move::load(const QDomElement& xml, int id) +void Pokemod::Move::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Fraction, accuracy); LOAD(int, power); diff --git a/pokemod/Move.h b/pokemod/Move.h index 6c4992a4..fc55ae26 100644 --- a/pokemod/Move.h +++ b/pokemod/Move.h @@ -36,12 +36,12 @@ class POKEMOD_EXPORT Move : public Object Move(const Move& move); Move(const Pokemod* parent, const int id); Move(const Move& move, const Pokemod* parent, const int id); - Move(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Move(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Move(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index e3d61452..3ae75b96 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -47,7 +47,8 @@ Pokemod::Nature::Nature(const Nature& nature, const Pokemod* parent, const int i Pokemod::Nature::Nature(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Nature", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Nature::validate() @@ -59,9 +60,9 @@ void Pokemod::Nature::validate() TEST_END(); } -void Pokemod::Nature::load(const QDomElement& xml, int id) +void Pokemod::Nature::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD_ARRAY(Fraction, stat, ST_End_GSC); LOAD(int, weight); diff --git a/pokemod/Nature.h b/pokemod/Nature.h index 38aa874d..c1c6dbbd 100644 --- a/pokemod/Nature.h +++ b/pokemod/Nature.h @@ -35,11 +35,11 @@ class POKEMOD_EXPORT Nature : public Object Nature(const Nature& nature); Nature(const Pokemod* parent, const int id); Nature(const Nature& nature, const Pokemod* parent, const int id); - Nature(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Nature(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Object.h b/pokemod/Object.h index bc0e2850..82a9e925 100644 --- a/pokemod/Object.h +++ b/pokemod/Object.h @@ -23,7 +23,6 @@ // Qt includes #include <QtCore/QObject> -#include <QtCore/QTextStream> #include <QtXml/QDomElement> // C includes @@ -63,7 +62,7 @@ class POKEMOD_EXPORT Object : public QObject public slots: virtual void validate() = 0; - virtual void load(const QDomElement& xml, int id = INT_MAX) = 0; + virtual void load(const QDomElement& xml) = 0; virtual QDomElement save() const = 0; protected: void setId(const int id); diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index c1ee1daa..e4ea1117 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -271,9 +271,9 @@ void Pokemod::Pokemod::validate() TEST_END(); } -void Pokemod::Pokemod::load(const QDomElement& xml, const int) +void Pokemod::Pokemod::load(const QDomElement& xml) { - clear(); + LOAD_BEGIN(); LOAD(QString, title); LOAD(QString, version); LOAD(QString, description); diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index 7de585f2..1cfebc69 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -64,7 +64,7 @@ class POKEMOD_EXPORT Pokemod : public Object Pokemod(const QDomElement& xml); ~Pokemod(); - void load(const QDomElement& xml, const int = 0); + void load(const QDomElement& xml); QDomElement save() const; void setTitle(const QString& title); diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp index 225679ac..ded6a566 100644 --- a/pokemod/Rules.cpp +++ b/pokemod/Rules.cpp @@ -97,8 +97,9 @@ void Pokemod::Rules::validate() TEST_END(); } -void Pokemod::Rules::load(const QDomElement& xml, const int /*id*/) +void Pokemod::Rules::load(const QDomElement& xml) { + LOAD_BEGIN(); LOAD(bool, genderAllowed); LOAD(bool, breedingAllowed); LOAD(bool, criticalDomains); diff --git a/pokemod/Rules.h b/pokemod/Rules.h index efd621a4..b2e5099b 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -41,7 +41,7 @@ class POKEMOD_EXPORT Rules : public Object void validate(); - void load(const QDomElement& xml, const int /*id*/ = 0); + void load(const QDomElement& xml); QDomElement save() const; void setGenderAllowed(const bool genderAllowed); diff --git a/pokemod/Sound.cpp b/pokemod/Sound.cpp index e6178c55..21ce2a2e 100644 --- a/pokemod/Sound.cpp +++ b/pokemod/Sound.cpp @@ -44,7 +44,8 @@ Pokemod::Sound::Sound(const Sound& sound, const Pokemod* parent, const int id) : Pokemod::Sound::Sound(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Sound", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Sound::validate() @@ -57,9 +58,9 @@ void Pokemod::Sound::validate() TEST_END(); } -void Pokemod::Sound::load(const QDomElement& xml, int id) +void Pokemod::Sound::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QByteArray, data); } diff --git a/pokemod/Sound.h b/pokemod/Sound.h index ef77cb85..7269065f 100644 --- a/pokemod/Sound.h +++ b/pokemod/Sound.h @@ -38,11 +38,11 @@ class POKEMOD_EXPORT Sound : public Object Sound(const Sound& sound); Sound(const Pokemod* parent, const int id); Sound(const Sound& sound, const Pokemod* parent, const int id); - Sound(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Sound(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 01914e40..6782f706 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -77,7 +77,8 @@ Pokemod::Species::Species(const Species& species, const Pokemod* parent, const i Pokemod::Species::Species(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Species", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Species::~Species() @@ -145,9 +146,9 @@ void Pokemod::Species::validate() TEST_END(); } -void Pokemod::Species::load(const QDomElement& xml, int id) +void Pokemod::Species::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD_ARRAY(int, baseStat, ST_End_GSC); LOAD_ARRAY(int, effortValue, ST_End_GSC); diff --git a/pokemod/Species.h b/pokemod/Species.h index d72708a7..1e458d18 100644 --- a/pokemod/Species.h +++ b/pokemod/Species.h @@ -55,12 +55,12 @@ class POKEMOD_EXPORT Species : public Object Species(const Species& species); Species(const Pokemod* parent, const int id); Species(const Species& species, const Pokemod* parent, const int id); - Species(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Species(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Species(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/SpeciesAbility.cpp b/pokemod/SpeciesAbility.cpp index f4123ee0..1bf8771b 100644 --- a/pokemod/SpeciesAbility.cpp +++ b/pokemod/SpeciesAbility.cpp @@ -45,7 +45,8 @@ Pokemod::SpeciesAbility::SpeciesAbility(const SpeciesAbility& ability, const Spe Pokemod::SpeciesAbility::SpeciesAbility(const QDomElement& xml, const Species* parent, const int id) : Object("SpeciesAbility", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::SpeciesAbility::validate() @@ -56,9 +57,9 @@ void Pokemod::SpeciesAbility::validate() TEST_END(); } -void Pokemod::SpeciesAbility::load(const QDomElement& xml, int id) +void Pokemod::SpeciesAbility::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, ability); LOAD(int, weight); } diff --git a/pokemod/SpeciesAbility.h b/pokemod/SpeciesAbility.h index 9ea2c47e..346f974a 100644 --- a/pokemod/SpeciesAbility.h +++ b/pokemod/SpeciesAbility.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT SpeciesAbility : public Object SpeciesAbility(const SpeciesAbility& ability); SpeciesAbility(const Species* parent, const int id); SpeciesAbility(const SpeciesAbility& ability, const Species* parent, const int id); - SpeciesAbility(const QDomElement& xml, const Species* parent, const int id = INT_MAX); + SpeciesAbility(const QDomElement& xml, const Species* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setAbility(const int ability); diff --git a/pokemod/SpeciesItem.cpp b/pokemod/SpeciesItem.cpp index 0450df6e..65b219ea 100644 --- a/pokemod/SpeciesItem.cpp +++ b/pokemod/SpeciesItem.cpp @@ -45,7 +45,8 @@ Pokemod::SpeciesItem::SpeciesItem(const SpeciesItem& item, const Species* parent Pokemod::SpeciesItem::SpeciesItem(const QDomElement& xml, const Species* parent, const int id) : Object("SpeciesItem", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::SpeciesItem::validate() @@ -56,9 +57,9 @@ void Pokemod::SpeciesItem::validate() TEST_END(); } -void Pokemod::SpeciesItem::load(const QDomElement& xml, int id) +void Pokemod::SpeciesItem::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, item); LOAD(int, weight); } diff --git a/pokemod/SpeciesItem.h b/pokemod/SpeciesItem.h index 6da0af05..93f4fc3c 100644 --- a/pokemod/SpeciesItem.h +++ b/pokemod/SpeciesItem.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT SpeciesItem : public Object SpeciesItem(const SpeciesItem& item); SpeciesItem(const Species* parent, const int id); SpeciesItem(const SpeciesItem& item, const Species* parent, const int id); - SpeciesItem(const QDomElement& xml, const Species* parent, const int id = INT_MAX); + SpeciesItem(const QDomElement& xml, const Species* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setItem(const int item); diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp index d26a186c..f2209b27 100644 --- a/pokemod/SpeciesMove.cpp +++ b/pokemod/SpeciesMove.cpp @@ -47,7 +47,8 @@ Pokemod::SpeciesMove::SpeciesMove(const SpeciesMove& move, const Species* parent Pokemod::SpeciesMove::SpeciesMove(const QDomElement& xml, const Species* parent, const int id) : Object("SpeciesMove", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::SpeciesMove::validate() @@ -59,9 +60,9 @@ void Pokemod::SpeciesMove::validate() TEST_END(); } -void Pokemod::SpeciesMove::load(const QDomElement& xml, int id) +void Pokemod::SpeciesMove::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(int, move); LOAD(int, level); LOAD(int, wild); diff --git a/pokemod/SpeciesMove.h b/pokemod/SpeciesMove.h index 9f9d6b87..affc9530 100644 --- a/pokemod/SpeciesMove.h +++ b/pokemod/SpeciesMove.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT SpeciesMove : public Object SpeciesMove(const SpeciesMove& move); SpeciesMove(const Species* parent, const int id); SpeciesMove(const SpeciesMove& move, const Species* parent, const int id); - SpeciesMove(const QDomElement& xml, const Species* parent, const int id = INT_MAX); + SpeciesMove(const QDomElement& xml, const Species* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setMove(const int move); diff --git a/pokemod/Sprite.cpp b/pokemod/Sprite.cpp index e497f270..4b2802bb 100644 --- a/pokemod/Sprite.cpp +++ b/pokemod/Sprite.cpp @@ -44,7 +44,8 @@ Pokemod::Sprite::Sprite(const Sprite& sprite, const Pokemod* parent, const int i Pokemod::Sprite::Sprite(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Sprite", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Sprite::~Sprite() @@ -59,9 +60,9 @@ void Pokemod::Sprite::validate() TEST_END(); } -void Pokemod::Sprite::load(const QDomElement& xml, int id) +void Pokemod::Sprite::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QPixmap, sprite); } diff --git a/pokemod/Sprite.h b/pokemod/Sprite.h index 7558c2bc..88e9c2f3 100644 --- a/pokemod/Sprite.h +++ b/pokemod/Sprite.h @@ -37,12 +37,12 @@ class POKEMOD_EXPORT Sprite : public Object Sprite(const Sprite& sprite); Sprite(const Pokemod* parent, const int id); Sprite(const Sprite& sprite, const Pokemod* parent, const int id); - Sprite(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Sprite(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Sprite(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Status.cpp b/pokemod/Status.cpp index 5abc21b7..6eb1d781 100644 --- a/pokemod/Status.cpp +++ b/pokemod/Status.cpp @@ -45,7 +45,8 @@ Pokemod::Status::Status(const Status& status, const Pokemod* parent, const int i Pokemod::Status::Status(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Status", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Status::~Status() @@ -60,9 +61,9 @@ void Pokemod::Status::validate() TEST_END(); } -void Pokemod::Status::load(const QDomElement& xml, int id) +void Pokemod::Status::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Script, script); } diff --git a/pokemod/Status.h b/pokemod/Status.h index 47bd6baf..e891aa30 100644 --- a/pokemod/Status.h +++ b/pokemod/Status.h @@ -35,12 +35,12 @@ class POKEMOD_EXPORT Status : public Object Status(const Status& status); Status(const Pokemod* parent, const int id); Status(const Status& status, const Pokemod* parent, const int id); - Status(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Status(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Status(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp index a8e81b45..819e42de 100644 --- a/pokemod/Store.cpp +++ b/pokemod/Store.cpp @@ -43,7 +43,8 @@ Pokemod::Store::Store(const Store& store, const Pokemod* parent, const int id) : Pokemod::Store::Store(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Store", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Store::validate() @@ -60,9 +61,9 @@ void Pokemod::Store::validate() TEST_END(); } -void Pokemod::Store::load(const QDomElement& xml, int id) +void Pokemod::Store::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD_LIST(int, item); } diff --git a/pokemod/Store.h b/pokemod/Store.h index cc991b5f..ac04862a 100644 --- a/pokemod/Store.h +++ b/pokemod/Store.h @@ -37,11 +37,11 @@ class POKEMOD_EXPORT Store : public Object Store(const Store& store); Store(const Pokemod* parent, const int id); Store(const Store& store, const Pokemod* parent, const int id); - Store(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Store(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp index d616dd21..685bf57f 100644 --- a/pokemod/Tile.cpp +++ b/pokemod/Tile.cpp @@ -47,7 +47,8 @@ Pokemod::Tile::Tile(const Tile& tile, const Pokemod* parent, const int id) : Pokemod::Tile::Tile(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Tile", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Tile::validate() @@ -59,9 +60,9 @@ void Pokemod::Tile::validate() TEST_END(); } -void Pokemod::Tile::load(const QDomElement& xml, int id) +void Pokemod::Tile::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(QPixmap, sprite); LOAD_ARRAY(bool, from, D_End); diff --git a/pokemod/Tile.h b/pokemod/Tile.h index d0b9ca6c..758cad14 100644 --- a/pokemod/Tile.h +++ b/pokemod/Tile.h @@ -38,11 +38,11 @@ class POKEMOD_EXPORT Tile : public Object Tile(const Tile& tile); Tile(const Pokemod* parent, const int id); Tile(const Tile& tile, const Pokemod* parent, const int id); - Tile(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Tile(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp index 13a4235b..1a829000 100644 --- a/pokemod/Time.cpp +++ b/pokemod/Time.cpp @@ -45,7 +45,8 @@ Pokemod::Time::Time(const Time& time, const Pokemod* parent, const int id) : Pokemod::Time::Time(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Time", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Time::validate() @@ -58,9 +59,9 @@ void Pokemod::Time::validate() TEST_END(); } -void Pokemod::Time::load(const QDomElement& xml, int id) +void Pokemod::Time::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(int, hour); LOAD(int, minute); diff --git a/pokemod/Time.h b/pokemod/Time.h index 39f0e7ae..9799f328 100644 --- a/pokemod/Time.h +++ b/pokemod/Time.h @@ -34,11 +34,11 @@ class POKEMOD_EXPORT Time : public Object Time(const Time& time); Time(const Pokemod* parent, const int id); Time(const Time& time, const Pokemod* parent, const int id); - Time(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Time(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp index b82dbd1c..3b32e1dd 100644 --- a/pokemod/Trainer.cpp +++ b/pokemod/Trainer.cpp @@ -47,7 +47,8 @@ Pokemod::Trainer::Trainer(const Trainer& trainer, const Pokemod* parent, const i Pokemod::Trainer::Trainer(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Trainer", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Trainer::validate() @@ -60,9 +61,9 @@ void Pokemod::Trainer::validate() TEST_END(); } -void Pokemod::Trainer::load(const QDomElement& xml, int id) +void Pokemod::Trainer::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(int, moneyFactor); LOAD(QPixmap, skin); diff --git a/pokemod/Trainer.h b/pokemod/Trainer.h index d77364b4..12c23d7d 100644 --- a/pokemod/Trainer.h +++ b/pokemod/Trainer.h @@ -48,11 +48,11 @@ class POKEMOD_EXPORT Trainer : public Object Trainer(const Trainer& trainer); Trainer(const Pokemod* parent, const int id); Trainer(const Trainer& trainer, const Pokemod* parent, const int id); - Trainer(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Trainer(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Type.cpp b/pokemod/Type.cpp index 5a83af34..26760478 100644 --- a/pokemod/Type.cpp +++ b/pokemod/Type.cpp @@ -44,7 +44,8 @@ Pokemod::Type::Type(const Type& type, const Pokemod* parent, const int id) : Pokemod::Type::Type(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Type", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } void Pokemod::Type::validate() @@ -55,9 +56,9 @@ void Pokemod::Type::validate() TEST_END(); } -void Pokemod::Type::load(const QDomElement& xml, int id) +void Pokemod::Type::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Fraction, stab); } diff --git a/pokemod/Type.h b/pokemod/Type.h index b851fad4..374537f6 100644 --- a/pokemod/Type.h +++ b/pokemod/Type.h @@ -35,11 +35,11 @@ class POKEMOD_EXPORT Type : public Object Type(const Type& type); Type(const Pokemod* parent, const int id); Type(const Type& type, const Pokemod* parent, const int id); - Type(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Type(const QDomElement& xml, const Pokemod* parent, const int id = -1); void validate(); - void load(const QDomElement& xml, const int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemod/Weather.cpp b/pokemod/Weather.cpp index fa080445..1f336bb1 100644 --- a/pokemod/Weather.cpp +++ b/pokemod/Weather.cpp @@ -45,7 +45,8 @@ Pokemod::Weather::Weather(const Weather& weather, const Pokemod* parent, const i Pokemod::Weather::Weather(const QDomElement& xml, const Pokemod* parent, const int id) : Object("Weather", parent, id) { - load(xml, id); + LOAD_ID(); + load(xml); } Pokemod::Weather::~Weather() @@ -60,9 +61,9 @@ void Pokemod::Weather::validate() TEST_END(); } -void Pokemod::Weather::load(const QDomElement& xml, int id) +void Pokemod::Weather::load(const QDomElement& xml) { - LOAD_ID(); + LOAD_BEGIN(); LOAD(QString, name); LOAD(Script, script); } diff --git a/pokemod/Weather.h b/pokemod/Weather.h index b17a0b09..cd9fa874 100644 --- a/pokemod/Weather.h +++ b/pokemod/Weather.h @@ -35,12 +35,12 @@ class POKEMOD_EXPORT Weather : public Object Weather(const Weather& weather); Weather(const Pokemod* parent, const int id); Weather(const Weather& weather, const Pokemod* parent, const int id); - Weather(const QDomElement& xml, const Pokemod* parent, const int id = INT_MAX); + Weather(const QDomElement& xml, const Pokemod* parent, const int id = -1); ~Weather(); void validate(); - void load(const QDomElement& xml, int id = INT_MAX); + void load(const QDomElement& xml); QDomElement save() const; void setName(const QString& name); diff --git a/pokemodr/MapUI.cpp b/pokemodr/MapUI.cpp index cd132cbf..b4bedfd0 100644 --- a/pokemodr/MapUI.cpp +++ b/pokemodr/MapUI.cpp @@ -71,11 +71,11 @@ void Pokemodr::MapUI::refreshGui() void Pokemodr::MapUI::setGui() { varName->setText(static_cast<Pokemod::Map*>(modified())->name()); - boxFlyWarp->setChecked((static_cast<Pokemod::Map*>(modified())->flyWarp() == INT_MAX) ? Qt::Unchecked : Qt::Checked); -// varFlyWarp->setCurrentIndex(varFlyWarp->findData(static_cast<Pokemod::Map*>(modified())->flyWarp())); + boxFlyWarp->setChecked((static_cast<Pokemod::Map*>(modified())->flyWarp() == -1) ? Qt::Unchecked : Qt::Checked); + varFlyWarp->setCurrentIndex(varFlyWarp->findData(static_cast<Pokemod::Map*>(modified())->flyWarp())); varType->setCurrentIndex(static_cast<Pokemod::Map*>(modified())->type()); -// buttonDeleteColumn->setEnabled(0 < m_model->columnCount()); -// buttonDeleteRow->setEnabled(0 < m_model->rowCount()); + buttonDeleteColumn->setEnabled(0 < varTilemap->model()->columnCount()); + buttonDeleteRow->setEnabled(0 < varTilemap->model()->rowCount()); } void Pokemodr::MapUI::apply() |
