summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-29 11:51:33 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-29 11:51:33 -0500
commit02d571db3ef9fa2cb73203ef3dc46827ee6960cf (patch)
treec4550579979c4cb067b52dbf169e3e80ca0cf1aa
parentaef78077e88da4626eddadd1cb8b13eaab3a16ca (diff)
downloadsigen-02d571db3ef9fa2cb73203ef3dc46827ee6960cf.tar.gz
sigen-02d571db3ef9fa2cb73203ef3dc46827ee6960cf.tar.xz
sigen-02d571db3ef9fa2cb73203ef3dc46827ee6960cf.zip
Added macros for subclass handling
-rw-r--r--sigmod/CoinList.cpp85
-rw-r--r--sigmod/CoinList.h2
-rw-r--r--sigmod/Macros.h88
-rw-r--r--sigmod/Map.cpp429
-rw-r--r--sigmod/MapTrainer.cpp85
-rw-r--r--sigmod/MapWildList.cpp85
-rw-r--r--sigmod/Sigmod.cpp1804
-rw-r--r--sigmod/Species.cpp257
8 files changed, 151 insertions, 2684 deletions
diff --git a/sigmod/CoinList.cpp b/sigmod/CoinList.cpp
index bc3a6fcb..a8fd4f2f 100644
--- a/sigmod/CoinList.cpp
+++ b/sigmod/CoinList.cpp
@@ -111,87 +111,7 @@ GETTER(CoinList, Sigcore::Script, script)
CHECK(CoinList, QString&, name)
CHECK(CoinList, Sigcore::Script&, script)
-const Sigmod::CoinListItem* Sigmod::CoinList::item(const int index) const
-{
- if (index < itemCount())
- return m_items.at(index);
- return NULL;
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::item(const int index)
-{
- if (index < itemCount())
- return m_items[index];
- return NULL;
-}
-
-const Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id) const
-{
- return item(itemIndex(id));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::itemById(const int id)
-{
- return item(itemIndex(id));
-}
-
-int Sigmod::CoinList::itemIndex(const int id) const
-{
- for (int i = 0; i < itemCount(); ++i)
- {
- if (m_items[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::CoinList::itemCount() const
-{
- return m_items.size();
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem()
-{
- return newItem(new CoinListItem(this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(const QDomElement& xml)
-{
- return newItem(new CoinListItem(xml, this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(const CoinListItem& item)
-{
- return newItem(new CoinListItem(item, this, itemId()));
-}
-
-Sigmod::CoinListItem* Sigmod::CoinList::newItem(CoinListItem* item)
-{
- m_items.append(item);
- return item;
-}
-
-void Sigmod::CoinList::deleteItem(const int index)
-{
- if (index < itemCount())
- {
- delete m_items[index];
- m_items.removeAt(index);
- }
-}
-
-void Sigmod::CoinList::deleteItemById(const int id)
-{
- deleteItem(itemIndex(id));
-}
-
-int Sigmod::CoinList::itemId() const
-{
- int i = 0;
- while ((i < itemCount()) && (itemIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(CoinList, Item, item, items)
Sigmod::CoinList& Sigmod::CoinList::operator=(const CoinList& rhs)
{
@@ -206,6 +126,5 @@ Sigmod::CoinList& Sigmod::CoinList::operator=(const CoinList& rhs)
void Sigmod::CoinList::clear()
{
- qDeleteAll(m_items);
- m_items.clear();
+ SUBCLASS_CLEAR(items);
}
diff --git a/sigmod/CoinList.h b/sigmod/CoinList.h
index f4c74669..f84d339c 100644
--- a/sigmod/CoinList.h
+++ b/sigmod/CoinList.h
@@ -189,7 +189,7 @@ class SIGMOD_EXPORT CoinList : public Object
CoinList& operator=(const CoinList& rhs);
private:
- int itemId() const;
+ int newItemId() const;
CoinListItem* newItem(CoinListItem* item);
void clear();
diff --git a/sigmod/Macros.h b/sigmod/Macros.h
index 4f46fd74..6213bc97 100644
--- a/sigmod/Macros.h
+++ b/sigmod/Macros.h
@@ -241,6 +241,94 @@ CHECK_BEGIN(class, type, variable) \
TBOUNDS(variable, (min), (max)) \
CHECK_END()
+#define SUBCLASS_RAW(class, subclass, capital, short, variable) \
+const Sigmod::subclass* Sigmod::class::short(const int index) const \
+{ \
+ if (index < short##Count()) \
+ return m_##variable.at(index); \
+ return NULL; \
+} \
+ \
+Sigmod::subclass* Sigmod::class::short(const int index) \
+{ \
+ if (index < short##Count()) \
+ return m_##variable[index]; \
+ return NULL; \
+} \
+ \
+const Sigmod::subclass* Sigmod::class::short##ById(const int id) const \
+{ \
+ return short(short##Index(id)); \
+} \
+ \
+Sigmod::subclass* Sigmod::class::short##ById(const int id) \
+{ \
+ return short(short##Index(id)); \
+} \
+ \
+int Sigmod::class::short##Index(const int id) const \
+{ \
+ for (int i = 0; i < short##Count(); ++i) \
+ { \
+ if (m_##variable[i]->id() == id) \
+ return i; \
+ } \
+ return INT_MAX; \
+} \
+ \
+int Sigmod::class::short##Count() const \
+{ \
+ return m_##variable.size(); \
+} \
+ \
+Sigmod::subclass* Sigmod::class::new##capital() \
+{ \
+ return new##capital(new subclass(this, new##capital##Id())); \
+} \
+ \
+Sigmod::subclass* Sigmod::class::new##capital(const QDomElement& xml) \
+{ \
+ return new##capital(new subclass(xml, this, new##capital##Id())); \
+} \
+ \
+Sigmod::subclass* Sigmod::class::new##capital(const subclass& short) \
+{ \
+ return new##capital(new subclass(short, this, new##capital##Id())); \
+} \
+ \
+Sigmod::subclass* Sigmod::class::new##capital(subclass* short) \
+{ \
+ m_##variable.append(short); \
+ return short; \
+} \
+ \
+void Sigmod::class::delete##capital(const int index) \
+{ \
+ if (index < short##Count()) \
+ { \
+ delete m_##variable[index]; \
+ m_##variable.removeAt(index); \
+ } \
+} \
+ \
+void Sigmod::class::delete##capital##ById(const int id) \
+{ \
+ delete##capital(short##Index(id)); \
+} \
+ \
+int Sigmod::class::new##capital##Id() const \
+{ \
+ int i = 0; \
+ while ((i < short##Count()) && (short##Index(i) != INT_MAX)) \
+ ++i; \
+ return i; \
+}
+#define SUBCLASS(class, capital, short, variable) SUBCLASS_RAW(class, class##capital, capital, short, variable)
+#define SSUBCLASS(class, capital, short, variable) SUBCLASS_RAW(class, capital, capital, short, variable)
+#define SUBCLASS_CLEAR(variable) \
+ qDeleteAll(m_##variable); \
+ m_##variable.clear()
+
#endif
#endif
diff --git a/sigmod/Map.cpp b/sigmod/Map.cpp
index c71bf552..af58d36f 100644
--- a/sigmod/Map.cpp
+++ b/sigmod/Map.cpp
@@ -169,415 +169,11 @@ CHECK(Map, Type, type)
CHECK_BOUNDS(Map, int, width, 1, INT_MAX)
CHECK_BOUNDS(Map, int, height, 1, INT_MAX)
-const Sigmod::MapEffect* Sigmod::Map::effect(const int index) const
-{
- if (index < effectCount())
- return m_effects.at(index);
- return NULL;
-}
-
-Sigmod::MapEffect* Sigmod::Map::effect(const int index)
-{
- if (index < effectCount())
- return m_effects[index];
- return NULL;
-}
-
-const Sigmod::MapEffect* Sigmod::Map::effectById(const int index) const
-{
- return effect(effectIndex(index));
-}
-
-Sigmod::MapEffect* Sigmod::Map::effectById(const int index)
-{
- return effect(effectIndex(index));
-}
-
-int Sigmod::Map::effectIndex(const int id) const
-{
- for (int i = 0; i < effectCount(); ++i)
- {
- if (m_effects[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Map::effectCount() const
-{
- return m_effects.size();
-}
-
-Sigmod::MapEffect* Sigmod::Map::newEffect()
-{
- return newEffect(new MapEffect(this, newEffectId()));
-}
-
-Sigmod::MapEffect* Sigmod::Map::newEffect(const QDomElement& xml)
-{
- return newEffect(new MapEffect(xml, this, newEffectId()));
-}
-
-Sigmod::MapEffect* Sigmod::Map::newEffect(const MapEffect& effect)
-{
- return newEffect(new MapEffect(effect, this, newEffectId()));
-}
-
-Sigmod::MapEffect* Sigmod::Map::newEffect(MapEffect* effect)
-{
- m_effects.append(effect);
- return effect;
-}
-
-void Sigmod::Map::deleteEffect(const int index)
-{
- if (index < effectCount())
- {
- delete m_effects[index];
- m_effects.removeAt(index);
- }
-}
-
-void Sigmod::Map::deleteEffectById(const int id)
-{
- deleteEffect(effectIndex(id));
-}
-
-int Sigmod::Map::newEffectId() const
-{
- int i = 0;
- while ((i < effectCount()) && (effectIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::MapTile* Sigmod::Map::tile(const int index) const
-{
- if (index < tileCount())
- return m_tiles.at(index);
- return NULL;
-}
-
-Sigmod::MapTile* Sigmod::Map::tile(const int index)
-{
- if (index < tileCount())
- return m_tiles[index];
- return NULL;
-}
-
-const Sigmod::MapTile* Sigmod::Map::tileById(const int index) const
-{
- return tile(tileIndex(index));
-}
-
-Sigmod::MapTile* Sigmod::Map::tileById(const int index)
-{
- return tile(tileIndex(index));
-}
-
-int Sigmod::Map::tileIndex(const int id) const
-{
- for (int i = 0; i < tileCount(); ++i)
- {
- if (m_tiles[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Map::tileCount() const
-{
- return m_tiles.size();
-}
-
-Sigmod::MapTile* Sigmod::Map::newTile()
-{
- return newTile(new MapTile(this, newTileId()));
-}
-
-Sigmod::MapTile* Sigmod::Map::newTile(const QDomElement& xml)
-{
- return newTile(new MapTile(xml, this, newTileId()));
-}
-
-Sigmod::MapTile* Sigmod::Map::newTile(const MapTile& tile)
-{
- return newTile(new MapTile(tile, this, newTileId()));
-}
-
-Sigmod::MapTile* Sigmod::Map::newTile(MapTile* tile)
-{
- m_tiles.append(tile);
- return tile;
-}
-
-void Sigmod::Map::deleteTile(const int index)
-{
- if (index < tileCount())
- {
- delete m_tiles[index];
- m_tiles.removeAt(index);
- }
-}
-
-void Sigmod::Map::deleteTileById(const int id)
-{
- deleteTile(tileIndex(id));
-}
-
-int Sigmod::Map::newTileId() const
-{
- int i = 0;
- while ((i < tileCount()) && (tileIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::MapTrainer* Sigmod::Map::trainer(const int index) const
-{
- if (index < trainerCount())
- return m_trainers.at(index);
- return NULL;
-}
-
-Sigmod::MapTrainer* Sigmod::Map::trainer(const int index)
-{
- if (index < trainerCount())
- return m_trainers[index];
- return NULL;
-}
-
-const Sigmod::MapTrainer* Sigmod::Map::trainerById(const int id) const
-{
- return trainer(trainerIndex(id));
-}
-
-Sigmod::MapTrainer* Sigmod::Map::trainerById(const int id)
-{
- return trainer(trainerIndex(id));
-}
-
-int Sigmod::Map::trainerIndex(const int id) const
-{
- for (int i = 0; i < trainerCount(); ++i)
- {
- if (m_trainers[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Map::trainerCount() const
-{
- return m_trainers.size();
-}
-
-Sigmod::MapTrainer* Sigmod::Map::newTrainer()
-{
- return newTrainer(new MapTrainer(this, newTrainerId()));
-}
-
-Sigmod::MapTrainer* Sigmod::Map::newTrainer(const QDomElement& xml)
-{
- return newTrainer(new MapTrainer(xml, this, newTrainerId()));
-}
-
-Sigmod::MapTrainer* Sigmod::Map::newTrainer(const MapTrainer& trainer)
-{
- return newTrainer(new MapTrainer(trainer, this, newTrainerId()));
-}
-
-Sigmod::MapTrainer* Sigmod::Map::newTrainer(MapTrainer* trainer)
-{
- m_trainers.append(trainer);
- return trainer;
-}
-
-void Sigmod::Map::deleteTrainer(const int index)
-{
- if (index < trainerCount())
- {
- delete m_trainers[index];
- m_trainers.removeAt(index);
- }
-}
-
-void Sigmod::Map::deleteTrainerById(const int id)
-{
- deleteTrainer(trainerIndex(id));
-}
-
-int Sigmod::Map::newTrainerId() const
-{
- int i = 0;
- while ((i < trainerCount()) && (trainerIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::MapWarp* Sigmod::Map::warp(const int index) const
-{
- if (index < warpCount())
- return m_warps.at(index);
- return NULL;
-}
-
-Sigmod::MapWarp* Sigmod::Map::warp(const int index)
-{
- if (index < warpCount())
- return m_warps[index];
- return NULL;
-}
-
-const Sigmod::MapWarp* Sigmod::Map::warpById(const int id) const
-{
- return warp(warpIndex(id));
-}
-
-Sigmod::MapWarp* Sigmod::Map::warpById(const int id)
-{
- return warp(warpIndex(id));
-}
-
-int Sigmod::Map::warpIndex(const int id) const
-{
- for (int i = 0; i < warpCount(); ++i)
- {
- if (m_warps[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Map::warpCount() const
-{
- return m_warps.size();
-}
-
-Sigmod::MapWarp* Sigmod::Map::newWarp()
-{
- return newWarp(new MapWarp(this, newWarpId()));
-}
-
-Sigmod::MapWarp* Sigmod::Map::newWarp(const QDomElement& xml)
-{
- return newWarp(new MapWarp(xml, this, newWarpId()));
-}
-
-Sigmod::MapWarp* Sigmod::Map::newWarp(const MapWarp& warp)
-{
- return newWarp(new MapWarp(warp, this, newWarpId()));
-}
-
-Sigmod::MapWarp* Sigmod::Map::newWarp(MapWarp* warp)
-{
- m_warps.append(warp);
- return warp;
-}
-
-void Sigmod::Map::deleteWarp(const int index)
-{
- if (index < warpCount())
- {
- delete m_warps[index];
- m_warps.removeAt(index);
- }
-}
-
-void Sigmod::Map::deleteWarpById(const int id)
-{
- deleteWarp(warpIndex(id));
-}
-
-int Sigmod::Map::newWarpId() const
-{
- int i = 0;
- while ((i < warpCount()) && (warpIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::MapWildList* Sigmod::Map::wildList(const int index) const
-{
- if (index < wildListCount())
- return m_wildLists.at(index);
- return NULL;
-}
-
-Sigmod::MapWildList* Sigmod::Map::wildList(const int index)
-{
- if (index < wildListCount())
- return m_wildLists[index];
- return NULL;
-}
-
-const Sigmod::MapWildList* Sigmod::Map::wildListById(const int id) const
-{
- return wildList(wildListIndex(id));
-}
-
-Sigmod::MapWildList* Sigmod::Map::wildListById(const int id)
-{
- return wildList(wildListIndex(id));
-}
-
-int Sigmod::Map::wildListIndex(const int id) const
-{
- for (int i = 0; i < wildListCount(); ++i)
- {
- if (m_wildLists[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Map::wildListCount() const
-{
- return m_wildLists.size();
-}
-
-Sigmod::MapWildList* Sigmod::Map::newWildList()
-{
- return newWildList(new MapWildList(this, newWildListId()));
-}
-
-Sigmod::MapWildList* Sigmod::Map::newWildList(const QDomElement& xml)
-{
- return newWildList(new MapWildList(xml, this, newWildListId()));
-}
-
-Sigmod::MapWildList* Sigmod::Map::newWildList(const MapWildList& wildList)
-{
- return newWildList(new MapWildList(wildList, this, newWildListId()));
-}
-
-Sigmod::MapWildList* Sigmod::Map::newWildList(MapWildList* wildList)
-{
- m_wildLists.append(wildList);
- return wildList;
-}
-
-void Sigmod::Map::deleteWildList(const int index)
-{
- if (index < wildListCount())
- {
- delete m_wildLists[index];
- m_wildLists.removeAt(index);
- }
-}
-
-void Sigmod::Map::deleteWildListById(const int id)
-{
- deleteWildList(wildListIndex(id));
-}
-
-int Sigmod::Map::newWildListId() const
-{
- int i = 0;
- while ((i < warpCount()) && (warpIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(Map, Effect, effect, effects)
+SUBCLASS(Map, Tile, tile, tiles)
+SUBCLASS(Map, Trainer, trainer, trainers)
+SUBCLASS(Map, Warp, warp, warps)
+SUBCLASS(Map, WildList, wildList, wildLists)
Sigmod::Map& Sigmod::Map::operator=(const Map& rhs)
{
@@ -599,14 +195,9 @@ Sigmod::Map& Sigmod::Map::operator=(const Map& rhs)
void Sigmod::Map::clear()
{
- qDeleteAll(m_effects);
- m_effects.clear();
- qDeleteAll(m_tiles);
- m_tiles.clear();
- qDeleteAll(m_trainers);
- m_trainers.clear();
- qDeleteAll(m_warps);
- m_warps.clear();
- qDeleteAll(m_wildLists);
- m_wildLists.clear();
+ SUBCLASS_CLEAR(effects);
+ SUBCLASS_CLEAR(tiles);
+ SUBCLASS_CLEAR(trainers);
+ SUBCLASS_CLEAR(warps);
+ SUBCLASS_CLEAR(wildLists);
}
diff --git a/sigmod/MapTrainer.cpp b/sigmod/MapTrainer.cpp
index ccef08fe..516af27c 100644
--- a/sigmod/MapTrainer.cpp
+++ b/sigmod/MapTrainer.cpp
@@ -138,87 +138,7 @@ CHECK_BEGIN(MapTrainer, int, leadTeamMember)
}
CHECK_END()
-const Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::teamMember(const int index) const
-{
- if (index < teamMemberCount())
- return m_teamMembers.at(index);
- return NULL;
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::teamMember(const int index)
-{
- if (index < teamMemberCount())
- return m_teamMembers[index];
- return NULL;
-}
-
-const Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::teamMemberById(const int id) const
-{
- return teamMember(teamMemberIndex(id));
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::teamMemberById(const int id)
-{
- return teamMember(teamMemberIndex(id));
-}
-
-int Sigmod::MapTrainer::teamMemberIndex(const int id) const
-{
- for (int i = 0; i < teamMemberCount(); ++i)
- {
- if (m_teamMembers[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::MapTrainer::teamMemberCount() const
-{
- return m_teamMembers.size();
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::newTeamMember()
-{
- return newTeamMember(new MapTrainerTeamMember(this, newTeamMemberId()));
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::newTeamMember(const QDomElement& xml)
-{
- return newTeamMember(new MapTrainerTeamMember(xml, this, newTeamMemberId()));
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::newTeamMember(const MapTrainerTeamMember& teamMember)
-{
- return newTeamMember(new MapTrainerTeamMember(teamMember, this, newTeamMemberId()));
-}
-
-Sigmod::MapTrainerTeamMember* Sigmod::MapTrainer::newTeamMember(MapTrainerTeamMember* teamMember)
-{
- m_teamMembers.append(teamMember);
- return teamMember;
-}
-
-void Sigmod::MapTrainer::deleteTeamMember(const int index)
-{
- if (index < teamMemberCount())
- {
- delete m_teamMembers[index];
- m_teamMembers.removeAt(index);
- }
-}
-
-void Sigmod::MapTrainer::deleteTeamMemberById(const int id)
-{
- deleteTeamMember(teamMemberIndex(id));
-}
-
-int Sigmod::MapTrainer::newTeamMemberId() const
-{
- int i = 0;
- while ((i < teamMemberCount()) && (teamMemberIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(MapTrainer, TeamMember, teamMember, teamMembers)
Sigmod::MapTrainer& Sigmod::MapTrainer::operator=(const MapTrainer& rhs)
{
@@ -237,6 +157,5 @@ Sigmod::MapTrainer& Sigmod::MapTrainer::operator=(const MapTrainer& rhs)
void Sigmod::MapTrainer::clear()
{
- while (teamMemberCount())
- deleteTeamMember(0);
+ SUBCLASS_CLEAR(teamMembers);
}
diff --git a/sigmod/MapWildList.cpp b/sigmod/MapWildList.cpp
index 2b0ca266..27820147 100644
--- a/sigmod/MapWildList.cpp
+++ b/sigmod/MapWildList.cpp
@@ -91,87 +91,7 @@ GETTER(MapWildList, QString, name)
CHECK(MapWildList, QString&, name)
-const Sigmod::MapWildListEncounter* Sigmod::MapWildList::encounter(const int index) const
-{
- if (index < encounterCount())
- return m_encounters.at(index);
- return NULL;
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::encounter(const int index)
-{
- if (index < encounterCount())
- return m_encounters[index];
- return NULL;
-}
-
-const Sigmod::MapWildListEncounter* Sigmod::MapWildList::encounterById(const int id) const
-{
- return encounter(encounterIndex(id));
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::encounterById(const int id)
-{
- return encounter(encounterIndex(id));
-}
-
-int Sigmod::MapWildList::encounterIndex(const int id) const
-{
- for (int i = 0; i < encounterCount(); ++i)
- {
- if (m_encounters[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::MapWildList::encounterCount() const
-{
- return m_encounters.size();
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::newEncounter()
-{
- return newEncounter(new MapWildListEncounter(this, newEncounterId()));
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::newEncounter(const QDomElement& xml)
-{
- return newEncounter(new MapWildListEncounter(xml, this, newEncounterId()));
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::newEncounter(const MapWildListEncounter& encounter)
-{
- return newEncounter(new MapWildListEncounter(encounter, this, newEncounterId()));
-}
-
-Sigmod::MapWildListEncounter* Sigmod::MapWildList::newEncounter(MapWildListEncounter* encounter)
-{
- m_encounters.append(encounter);
- return encounter;
-}
-
-void Sigmod::MapWildList::deleteEncounter(const int index)
-{
- if (index < encounterCount())
- {
- delete m_encounters[index];
- m_encounters.removeAt(index);
- }
-}
-
-void Sigmod::MapWildList::deleteEncounterById(const int id)
-{
- deleteEncounter(encounterIndex(id));
-}
-
-int Sigmod::MapWildList::newEncounterId() const
-{
- int i = 0;
- while ((i < encounterCount()) && (encounterIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(MapWildList, Encounter, encounter, encounters)
Sigmod::MapWildList& Sigmod::MapWildList::operator=(const MapWildList& rhs)
{
@@ -185,6 +105,5 @@ Sigmod::MapWildList& Sigmod::MapWildList::operator=(const MapWildList& rhs)
void Sigmod::MapWildList::clear()
{
- qDeleteAll(m_encounters);
- m_encounters.clear();
+ SUBCLASS_CLEAR(encounters);
}
diff --git a/sigmod/Sigmod.cpp b/sigmod/Sigmod.cpp
index a916e39c..c6eabb49 100644
--- a/sigmod/Sigmod.cpp
+++ b/sigmod/Sigmod.cpp
@@ -424,1645 +424,26 @@ CHECK_BEGIN(Sigmod, int, startWarp)
CHECK_END()
CHECK_BOUNDS(Sigmod, Sigcore::Fraction&, typechart, 0, INT_MAX)
-const Sigmod::Ability* Sigmod::Sigmod::ability(const int index) const
-{
- if (index < abilityCount())
- return m_abilities.at(index);
- return NULL;
-}
-
-Sigmod::Ability* Sigmod::Sigmod::ability(const int index)
-{
- if (index < abilityCount())
- return m_abilities[index];
- return NULL;
-}
-
-const Sigmod::Ability* Sigmod::Sigmod::abilityById(const int id) const
-{
- return ability(abilityIndex(id));
-}
-
-Sigmod::Ability* Sigmod::Sigmod::abilityById(const int id)
-{
- return ability(abilityIndex(id));
-}
-
-int Sigmod::Sigmod::abilityIndex(const int id) const
-{
- for (int i = 0; i < abilityCount(); ++i)
- {
- if (m_abilities[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::abilityCount() const
-{
- return m_abilities.size();
-}
-
-Sigmod::Ability* Sigmod::Sigmod::newAbility()
-{
- return newAbility(new Ability(this, newAbilityId()));
-}
-
-Sigmod::Ability* Sigmod::Sigmod::newAbility(const QDomElement& xml)
-{
- return newAbility(new Ability(xml, this, newAbilityId()));
-}
-
-Sigmod::Ability* Sigmod::Sigmod::newAbility(const Ability& ability)
-{
- return newAbility(new Ability(ability, this, newAbilityId()));
-}
-
-Sigmod::Ability* Sigmod::Sigmod::newAbility(Ability* ability)
-{
- m_abilities.append(ability);
- return ability;
-}
-
-void Sigmod::Sigmod::deleteAbility(const int index)
-{
- if (index < abilityCount())
- {
- delete m_abilities[index];
- m_abilities.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteAbilityById(const int id)
-{
- deleteAbility(abilityIndex(id));
-}
-
-int Sigmod::Sigmod::newAbilityId() const
-{
- int i = 0;
- while ((i < abilityCount()) && (abilityIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Author* Sigmod::Sigmod::author(const int index) const
-{
- if (index < authorCount())
- return m_authors.at(index);
- return NULL;
-}
-
-Sigmod::Author* Sigmod::Sigmod::author(const int index)
-{
- if (index < authorCount())
- return m_authors[index];
- return NULL;
-}
-
-const Sigmod::Author* Sigmod::Sigmod::authorById(const int id) const
-{
- return author(authorIndex(id));
-}
-
-Sigmod::Author* Sigmod::Sigmod::authorById(const int id)
-{
- return author(authorIndex(id));
-}
-
-int Sigmod::Sigmod::authorIndex(const int id) const
-{
- for (int i = 0; i < authorCount(); ++i)
- {
- if (m_authors[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::authorCount() const
-{
- return m_authors.size();
-}
-
-Sigmod::Author* Sigmod::Sigmod::newAuthor()
-{
- return newAuthor(new Author(this, newAuthorId()));
-}
-
-Sigmod::Author* Sigmod::Sigmod::newAuthor(const QDomElement& xml)
-{
- return newAuthor(new Author(xml, this, newAuthorId()));
-}
-
-Sigmod::Author* Sigmod::Sigmod::newAuthor(const Author& author)
-{
- return newAuthor(new Author(author, this, newAuthorId()));
-}
-
-Sigmod::Author* Sigmod::Sigmod::newAuthor(Author* author)
-{
- m_authors.append(author);
- return author;
-}
-
-void Sigmod::Sigmod::deleteAuthor(const int index)
-{
- if (index < authorCount())
- {
- delete m_authors[index];
- m_authors.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteAuthorById(const int id)
-{
- deleteAuthor(authorIndex(id));
-}
-
-int Sigmod::Sigmod::newAuthorId() const
-{
- int i = 0;
- while ((i < authorCount()) && (authorIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Badge* Sigmod::Sigmod::badge(const int index) const
-{
- if (index < badgeCount())
- return m_badges.at(index);
- return NULL;
-}
-
-Sigmod::Badge* Sigmod::Sigmod::badge(const int index)
-{
- if (index < badgeCount())
- return m_badges[index];
- return NULL;
-}
-
-const Sigmod::Badge* Sigmod::Sigmod::badgeById(const int id) const
-{
- return badge(badgeIndex(id));
-}
-
-Sigmod::Badge* Sigmod::Sigmod::badgeById(const int id)
-{
- return badge(badgeIndex(id));
-}
-
-int Sigmod::Sigmod::badgeIndex(const int id) const
-{
- for (int i = 0; i < badgeCount(); ++i)
- {
- if (m_badges[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::badgeCount() const
-{
- return m_badges.size();
-}
-
-Sigmod::Badge* Sigmod::Sigmod::newBadge()
-{
- return newBadge(new Badge(this, newBadgeId()));
-}
-
-Sigmod::Badge* Sigmod::Sigmod::newBadge(const QDomElement& xml)
-{
- return newBadge(new Badge(xml, this, newBadgeId()));
-}
-
-Sigmod::Badge* Sigmod::Sigmod::newBadge(const Badge& badge)
-{
- return newBadge(new Badge(badge, this, newBadgeId()));
-}
-
-Sigmod::Badge* Sigmod::Sigmod::newBadge(Badge* badge)
-{
- m_badges.append(badge);
- return badge;
-}
-
-void Sigmod::Sigmod::deleteBadge(const int index)
-{
- if (index < badgeCount())
- {
- delete m_badges[index];
- m_badges.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteBadgeById(const int id)
-{
- deleteBadge(badgeIndex(id));
-}
-
-int Sigmod::Sigmod::newBadgeId() const
-{
- int i = 0;
- while ((i < badgeCount()) && (badgeIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::CoinList* Sigmod::Sigmod::coinList(const int index) const
-{
- if (index < coinListCount())
- return m_coinLists.at(index);
- return NULL;
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::coinList(const int index)
-{
- if (index < coinListCount())
- return m_coinLists[index];
- return NULL;
-}
-
-const Sigmod::CoinList* Sigmod::Sigmod::coinListById(const int id) const
-{
- return coinList(coinListIndex(id));
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::coinListById(const int id)
-{
- return coinList(coinListIndex(id));
-}
-
-int Sigmod::Sigmod::coinListIndex(const int id) const
-{
- for (int i = 0; i < coinListCount(); ++i)
- {
- if (m_coinLists[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::coinListCount() const
-{
- return m_coinLists.size();
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::newCoinList()
-{
- return newCoinList(new CoinList(this, newCoinListId()));
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::newCoinList(const QDomElement& xml)
-{
- return newCoinList(new CoinList(xml, this, newCoinListId()));
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::newCoinList(const CoinList& coinList)
-{
- return newCoinList(new CoinList(coinList, this, newCoinListId()));
-}
-
-Sigmod::CoinList* Sigmod::Sigmod::newCoinList(CoinList* coinList)
-{
- m_coinLists.append(coinList);
- return coinList;
-}
-
-void Sigmod::Sigmod::deleteCoinList(const int index)
-{
- if (index < coinListCount())
- {
- delete m_coinLists[index];
- m_coinLists.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteCoinListById(const int id)
-{
- deleteCoinList(coinListIndex(id));
-}
-
-int Sigmod::Sigmod::newCoinListId() const
-{
- int i = 0;
- while ((i < coinListCount()) && (coinListIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::EggGroup* Sigmod::Sigmod::eggGroup(const int index) const
-{
- if (index < eggGroupCount())
- return m_eggGroups.at(index);
- return NULL;
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::eggGroup(const int index)
-{
- if (index < eggGroupCount())
- return m_eggGroups[index];
- return NULL;
-}
-
-const Sigmod::EggGroup* Sigmod::Sigmod::eggGroupById(const int id) const
-{
- return eggGroup(eggGroupIndex(id));
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::eggGroupById(const int id)
-{
- return eggGroup(eggGroupIndex(id));
-}
-
-int Sigmod::Sigmod::eggGroupIndex(const int id) const
-{
- for (int i = 0; i < eggGroupCount(); ++i)
- {
- if (m_eggGroups[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::eggGroupCount() const
-{
- return m_eggGroups.size();
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::newEggGroup()
-{
- return newEggGroup(new EggGroup(this, newEggGroupId()));
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::newEggGroup(const QDomElement& xml)
-{
- return newEggGroup(new EggGroup(xml, this, newEggGroupId()));
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::newEggGroup(const EggGroup& eggGroup)
-{
- return newEggGroup(new EggGroup(eggGroup, this, newEggGroupId()));
-}
-
-Sigmod::EggGroup* Sigmod::Sigmod::newEggGroup(EggGroup* eggGroup)
-{
- m_eggGroups.append(eggGroup);
- return eggGroup;
-}
-
-void Sigmod::Sigmod::deleteEggGroup(const int index)
-{
- if (index < eggGroupCount())
- {
- delete m_eggGroups[index];
- m_eggGroups.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteEggGroupById(const int id)
-{
- deleteEggGroup(eggGroupIndex(id));
-}
-
-int Sigmod::Sigmod::newEggGroupId() const
-{
- int i = 0;
- while ((i < eggGroupCount()) && (eggGroupIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::GlobalScript* Sigmod::Sigmod::globalScript(const int index) const
-{
- if (index < globalScriptCount())
- return m_globalScripts.at(index);
- return NULL;
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::globalScript(const int index)
-{
- if (index < globalScriptCount())
- return m_globalScripts[index];
- return NULL;
-}
-
-const Sigmod::GlobalScript* Sigmod::Sigmod::globalScriptById(const int id) const
-{
- return globalScript(globalScriptIndex(id));
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::globalScriptById(const int id)
-{
- return globalScript(globalScriptIndex(id));
-}
-
-int Sigmod::Sigmod::globalScriptIndex(const int id) const
-{
- for (int i = 0; i < globalScriptCount(); ++i)
- {
- if (m_globalScripts[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::globalScriptCount() const
-{
- return m_globalScripts.size();
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::newGlobalScript()
-{
- return newGlobalScript(new GlobalScript(this, newGlobalScriptId()));
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::newGlobalScript(const QDomElement& xml)
-{
- return newGlobalScript(new GlobalScript(xml, this, newGlobalScriptId()));
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::newGlobalScript(const GlobalScript& globalScript)
-{
- return newGlobalScript(new GlobalScript(globalScript, this, newGlobalScriptId()));
-}
-
-Sigmod::GlobalScript* Sigmod::Sigmod::newGlobalScript(GlobalScript* globalScript)
-{
- m_globalScripts.append(globalScript);
- return globalScript;
-}
-
-void Sigmod::Sigmod::deleteGlobalScript(const int index)
-{
- if (index < globalScriptCount())
- {
- delete m_globalScripts[index];
- m_globalScripts.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteGlobalScriptById(const int id)
-{
- deleteGlobalScript(globalScriptIndex(id));
-}
-
-int Sigmod::Sigmod::newGlobalScriptId() const
-{
- int i = 0;
- while ((i < globalScriptCount()) && (globalScriptIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Item* Sigmod::Sigmod::item(const int index) const
-{
- if (index < itemCount())
- return m_items.at(index);
- return NULL;
-}
-
-Sigmod::Item* Sigmod::Sigmod::item(const int index)
-{
- if (index < itemCount())
- return m_items[index];
- return NULL;
-}
-
-const Sigmod::Item* Sigmod::Sigmod::itemById(const int id) const
-{
- return item(itemIndex(id));
-}
-
-Sigmod::Item* Sigmod::Sigmod::itemById(const int id)
-{
- return item(itemIndex(id));
-}
-
-int Sigmod::Sigmod::itemIndex(const int id) const
-{
- for (int i = 0; i < itemCount(); ++i)
- {
- if (m_items[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::itemCount() const
-{
- return m_items.size();
-}
-
-Sigmod::Item* Sigmod::Sigmod::newItem()
-{
- return newItem(new Item(this, newItemId()));
-}
-
-Sigmod::Item* Sigmod::Sigmod::newItem(const QDomElement& xml)
-{
- return newItem(new Item(xml, this, newItemId()));
-}
-
-Sigmod::Item* Sigmod::Sigmod::newItem(const Item& item)
-{
- return newItem(new Item(item, this, newItemId()));
-}
-
-Sigmod::Item* Sigmod::Sigmod::newItem(Item* item)
-{
- m_items.append(item);
- return item;
-}
-
-void Sigmod::Sigmod::deleteItem(const int index)
-{
- if (index < itemCount())
- {
- delete m_items[index];
- m_items.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteItemById(const int id)
-{
- deleteItem(itemIndex(id));
-}
-
-int Sigmod::Sigmod::newItemId() const
-{
- int i = 0;
- while ((i < itemCount()) && (itemIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::ItemType* Sigmod::Sigmod::itemType(const int index) const
-{
- if (index < itemTypeCount())
- return m_itemTypes.at(index);
- return NULL;
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::itemType(const int index)
-{
- if (index < itemTypeCount())
- return m_itemTypes[index];
- return NULL;
-}
-
-const Sigmod::ItemType* Sigmod::Sigmod::itemTypeById(const int id) const
-{
- return itemType(itemTypeIndex(id));
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::itemTypeById(const int id)
-{
- return itemType(itemTypeIndex(id));
-}
-
-int Sigmod::Sigmod::itemTypeIndex(const int id) const
-{
- for (int i = 0; i < itemTypeCount(); ++i)
- {
- if (m_itemTypes[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::itemTypeCount() const
-{
- return m_itemTypes.size();
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::newItemType()
-{
- return newItemType(new ItemType(this, newItemTypeId()));
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::newItemType(const QDomElement& xml)
-{
- return newItemType(new ItemType(xml, this, newItemTypeId()));
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::newItemType(const ItemType& itemType)
-{
- return newItemType(new ItemType(itemType, this, newItemTypeId()));
-}
-
-Sigmod::ItemType* Sigmod::Sigmod::newItemType(ItemType* itemType)
-{
- m_itemTypes.append(itemType);
- return itemType;
-}
-
-void Sigmod::Sigmod::deleteItemType(const int index)
-{
- if (index < itemTypeCount())
- {
- delete m_itemTypes[index];
- m_itemTypes.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteItemTypeById(const int id)
-{
- deleteItemType(itemTypeIndex(id));
-}
-
-int Sigmod::Sigmod::newItemTypeId() const
-{
- int i = 0;
- while ((i < itemTypeCount()) && (itemTypeIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Map* Sigmod::Sigmod::map(const int index) const
-{
- if (index < mapCount())
- return m_maps.at(index);
- return NULL;
-}
-
-Sigmod::Map* Sigmod::Sigmod::map(const int index)
-{
- if (index < mapCount())
- return m_maps[index];
- return NULL;
-}
-
-const Sigmod::Map* Sigmod::Sigmod::mapById(const int id) const
-{
- return map(mapIndex(id));
-}
-
-Sigmod::Map* Sigmod::Sigmod::mapById(const int id)
-{
- return map(mapIndex(id));
-}
-
-int Sigmod::Sigmod::mapIndex(const int id) const
-{
- for (int i = 0; i < mapCount(); ++i)
- {
- if (m_maps[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::mapCount() const
-{
- return m_maps.size();
-}
-
-Sigmod::Map* Sigmod::Sigmod::newMap()
-{
- return newMap(new Map(this, newMapId()));
-}
-
-Sigmod::Map* Sigmod::Sigmod::newMap(const QDomElement& xml)
-{
- return newMap(new Map(xml, this, newMapId()));
-}
-
-Sigmod::Map* Sigmod::Sigmod::newMap(const Map& map)
-{
- return newMap(new Map(map, this, newMapId()));
-}
-
-Sigmod::Map* Sigmod::Sigmod::newMap(Map* map)
-{
- m_maps.append(map);
- return map;
-}
-
-void Sigmod::Sigmod::deleteMap(const int index)
-{
- if (index < mapCount())
- {
- delete m_maps[index];
- m_maps.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteMapById(const int id)
-{
- deleteMap(mapIndex(id));
-}
-
-int Sigmod::Sigmod::newMapId() const
-{
- int i = 0;
- while ((i < mapCount()) && (mapIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Move* Sigmod::Sigmod::move(const int index) const
-{
- if (index < moveCount())
- return m_moves.at(index);
- return NULL;
-}
-
-Sigmod::Move* Sigmod::Sigmod::move(const int index)
-{
- if (index < moveCount())
- return m_moves[index];
- return NULL;
-}
-
-const Sigmod::Move* Sigmod::Sigmod::moveById(const int id) const
-{
- return move(moveIndex(id));
-}
-
-Sigmod::Move* Sigmod::Sigmod::moveById(const int id)
-{
- return move(moveIndex(id));
-}
-
-int Sigmod::Sigmod::moveIndex(const int id) const
-{
- for (int i = 0; i < moveCount(); ++i)
- {
- if (m_moves[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::moveCount() const
-{
- return m_moves.size();
-}
-
-Sigmod::Move* Sigmod::Sigmod::newMove()
-{
- return newMove(new Move(this, newMoveId()));
-}
-
-Sigmod::Move* Sigmod::Sigmod::newMove(const QDomElement& xml)
-{
- return newMove(new Move(xml, this, newMoveId()));
-}
-
-Sigmod::Move* Sigmod::Sigmod::newMove(const Move& move)
-{
- return newMove(new Move(move, this, newMoveId()));
-}
-
-Sigmod::Move* Sigmod::Sigmod::newMove(Move* move)
-{
- m_moves.append(move);
- return move;
-}
-
-void Sigmod::Sigmod::deleteMove(const int index)
-{
- if (index < moveCount())
- {
- delete m_moves[index];
- m_moves.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteMoveById(const int id)
-{
- deleteMove(moveIndex(id));
-}
-
-int Sigmod::Sigmod::newMoveId() const
-{
- int i = 0;
- while ((i < moveCount()) && (moveIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Nature* Sigmod::Sigmod::nature(const int index) const
-{
- if (index < natureCount())
- return m_natures.at(index);
- return NULL;
-}
-
-Sigmod::Nature* Sigmod::Sigmod::nature(const int index)
-{
- if (index < natureCount())
- return m_natures[index];
- return NULL;
-}
-
-const Sigmod::Nature* Sigmod::Sigmod::natureById(const int id) const
-{
- return nature(natureIndex(id));
-}
-
-Sigmod::Nature* Sigmod::Sigmod::natureById(const int id)
-{
- return nature(natureIndex(id));
-}
-
-int Sigmod::Sigmod::natureIndex(const int id) const
-{
- for (int i = 0; i < natureCount(); ++i)
- {
- if (m_natures[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::natureCount() const
-{
- return m_natures.size();
-}
-
-Sigmod::Nature* Sigmod::Sigmod::newNature()
-{
- return newNature(new Nature(this, newNatureId()));
-}
-
-Sigmod::Nature* Sigmod::Sigmod::newNature(const QDomElement& xml)
-{
- return newNature(new Nature(xml, this, newNatureId()));
-}
-
-Sigmod::Nature* Sigmod::Sigmod::newNature(const Nature& nature)
-{
- return newNature(new Nature(nature, this, newNatureId()));
-}
-
-Sigmod::Nature* Sigmod::Sigmod::newNature(Nature* nature)
-{
- m_natures.append(nature);
- return nature;
-}
-
-void Sigmod::Sigmod::deleteNature(const int index)
-{
- if (index < natureCount())
- {
- delete m_natures[index];
- m_natures.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteNatureById(const int id)
-{
- deleteNature(natureIndex(id));
-}
-
-int Sigmod::Sigmod::newNatureId() const
-{
- int i = 0;
- while ((i < natureCount()) && (natureIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Skin* Sigmod::Sigmod::skin(const int index) const
-{
- if (index < skinCount())
- return m_skins.at(index);
- return NULL;
-}
-
-Sigmod::Skin* Sigmod::Sigmod::skin(const int index)
-{
- if (index < skinCount())
- return m_skins[index];
- return NULL;
-}
-
-const Sigmod::Skin* Sigmod::Sigmod::skinById(const int id) const
-{
- return skin(skinIndex(id));
-}
-
-Sigmod::Skin* Sigmod::Sigmod::skinById(const int id)
-{
- return skin(skinIndex(id));
-}
-
-int Sigmod::Sigmod::skinIndex(const int id) const
-{
- for (int i = 0; i < skinCount(); ++i)
- {
- if (m_skins[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::skinCount() const
-{
- return m_skins.size();
-}
-
-Sigmod::Skin* Sigmod::Sigmod::newSkin()
-{
- return newSkin(new Skin(this, newSkinId()));
-}
-
-Sigmod::Skin* Sigmod::Sigmod::newSkin(const QDomElement& xml)
-{
- return newSkin(new Skin(xml, this, newSkinId()));
-}
-
-Sigmod::Skin* Sigmod::Sigmod::newSkin(const Skin& skin)
-{
- return newSkin(new Skin(skin, this, newSkinId()));
-}
-
-Sigmod::Skin* Sigmod::Sigmod::newSkin(Skin* skin)
-{
- m_skins.append(skin);
- return skin;
-}
-
-void Sigmod::Sigmod::deleteSkin(const int index)
-{
- if (index < skinCount())
- {
- delete m_skins[index];
- m_skins.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteSkinById(const int id)
-{
- deleteSkin(skinIndex(id));
-}
-
-int Sigmod::Sigmod::newSkinId() const
-{
- int i = 0;
- while ((i < skinCount()) && (skinIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Sound* Sigmod::Sigmod::sound(const int index) const
-{
- if (index < soundCount())
- return m_sounds.at(index);
- return NULL;
-}
-
-Sigmod::Sound* Sigmod::Sigmod::sound(const int index)
-{
- if (index < soundCount())
- return m_sounds[index];
- return NULL;
-}
-
-const Sigmod::Sound* Sigmod::Sigmod::soundById(const int id) const
-{
- return sound(soundIndex(id));
-}
-
-Sigmod::Sound* Sigmod::Sigmod::soundById(const int id)
-{
- return sound(soundIndex(id));
-}
-
-int Sigmod::Sigmod::soundIndex(const int id) const
-{
- for (int i = 0; i < soundCount(); ++i)
- {
- if (m_sounds[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::soundCount() const
-{
- return m_sounds.size();
-}
-
-Sigmod::Sound* Sigmod::Sigmod::newSound()
-{
- return newSound(new Sound(this, newSoundId()));
-}
-
-Sigmod::Sound* Sigmod::Sigmod::newSound(const QDomElement& xml)
-{
- return newSound(new Sound(xml, this, newSoundId()));
-}
-
-Sigmod::Sound* Sigmod::Sigmod::newSound(const Sound& sound)
-{
- return newSound(new Sound(sound, this, newSoundId()));
-}
-
-Sigmod::Sound* Sigmod::Sigmod::newSound(Sound* sound)
-{
- m_sounds.append(sound);
- return sound;
-}
-
-void Sigmod::Sigmod::deleteSound(const int index)
-{
- if (index < soundCount())
- {
- delete m_sounds[index];
- m_sounds.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteSoundById(const int id)
-{
- deleteSound(soundIndex(id));
-}
-
-int Sigmod::Sigmod::newSoundId() const
-{
- int i = 0;
- while ((i < soundCount()) && (soundIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Species* Sigmod::Sigmod::species(const int index) const
-{
- if (index < speciesCount())
- return m_species.at(index);
- return NULL;
-}
-
-Sigmod::Species* Sigmod::Sigmod::species(const int index)
-{
- if (index < speciesCount())
- return m_species[index];
- return NULL;
-}
-
-const Sigmod::Species* Sigmod::Sigmod::speciesById(const int id) const
-{
- return species(speciesIndex(id));
-}
-
-Sigmod::Species* Sigmod::Sigmod::speciesById(const int id)
-{
- return species(speciesIndex(id));
-}
-
-int Sigmod::Sigmod::speciesIndex(const int id) const
-{
- for (int i = 0; i < speciesCount(); ++i)
- {
- if (m_species[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::speciesCount() const
-{
- return m_species.size();
-}
-
-Sigmod::Species* Sigmod::Sigmod::newSpecies()
-{
- return newSpecies(new Species(this, newSpeciesId()));
-}
-
-Sigmod::Species* Sigmod::Sigmod::newSpecies(const QDomElement& xml)
-{
- return newSpecies(new Species(xml, this, newSpeciesId()));
-}
-
-Sigmod::Species* Sigmod::Sigmod::newSpecies(const Species& species)
-{
- return newSpecies(new Species(species, this, newSpeciesId()));
-}
-
-Sigmod::Species* Sigmod::Sigmod::newSpecies(Species* species)
-{
- m_species.append(species);
- return species;
-}
-
-void Sigmod::Sigmod::deleteSpecies(const int index)
-{
- if (index < speciesCount())
- {
- delete m_species[index];
- m_species.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteSpeciesById(const int id)
-{
- deleteSpecies(speciesIndex(id));
-}
-
-int Sigmod::Sigmod::newSpeciesId() const
-{
- int i = 0;
- while ((i < speciesCount()) && (speciesIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Sprite* Sigmod::Sigmod::sprite(const int index) const
-{
- if (index < spriteCount())
- return m_sprites.at(index);
- return NULL;
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::sprite(const int index)
-{
- if (index < spriteCount())
- return m_sprites[index];
- return NULL;
-}
-
-const Sigmod::Sprite* Sigmod::Sigmod::spriteById(const int id) const
-{
- return sprite(spriteIndex(id));
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::spriteById(const int id)
-{
- return sprite(spriteIndex(id));
-}
-
-int Sigmod::Sigmod::spriteIndex(const int id) const
-{
- for (int i = 0; i < spriteCount(); ++i)
- {
- if (m_sprites[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::spriteCount() const
-{
- return m_sprites.size();
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::newSprite()
-{
- return newSprite(new Sprite(this, newSpriteId()));
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::newSprite(const QDomElement& xml)
-{
- return newSprite(new Sprite(xml, this, newSpriteId()));
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::newSprite(const Sprite& sprite)
-{
- return newSprite(new Sprite(sprite, this, newSpriteId()));
-}
-
-Sigmod::Sprite* Sigmod::Sigmod::newSprite(Sprite* sprite)
-{
- m_sprites.append(sprite);
- return sprite;
-}
-
-void Sigmod::Sigmod::deleteSprite(const int index)
-{
- if (index < spriteCount())
- {
- delete m_sprites[index];
- m_sprites.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteSpriteById(const int id)
-{
- deleteSprite(spriteIndex(id));
-}
-
-int Sigmod::Sigmod::newSpriteId() const
-{
- int i = 0;
- while ((i < spriteCount()) && (spriteIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Status* Sigmod::Sigmod::status(const int index) const
-{
- if (index < statusCount())
- return m_status.at(index);
- return NULL;
-}
-
-Sigmod::Status* Sigmod::Sigmod::status(const int index)
-{
- if (index < statusCount())
- return m_status[index];
- return NULL;
-}
-
-const Sigmod::Status* Sigmod::Sigmod::statusById(const int id) const
-{
- return status(statusIndex(id));
-}
-
-Sigmod::Status* Sigmod::Sigmod::statusById(const int id)
-{
- return status(statusIndex(id));
-}
-
-int Sigmod::Sigmod::statusIndex(const int id) const
-{
- for (int i = 0; i < statusCount(); ++i)
- {
- if (m_status[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::statusCount() const
-{
- return m_status.size();
-}
-
-Sigmod::Status* Sigmod::Sigmod::newStatus()
-{
- return newStatus(new Status(this, newStatusId()));
-}
-
-Sigmod::Status* Sigmod::Sigmod::newStatus(const QDomElement& xml)
-{
- return newStatus(new Status(xml, this, newStatusId()));
-}
-
-Sigmod::Status* Sigmod::Sigmod::newStatus(const Status& status)
-{
- return newStatus(new Status(status, this, newStatusId()));
-}
-
-Sigmod::Status* Sigmod::Sigmod::newStatus(Status* status)
-{
- m_status.append(status);
- return status;
-}
-
-void Sigmod::Sigmod::deleteStatus(const int index)
-{
- if (index < statusCount())
- {
- delete m_status[index];
- m_status.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteStatusById(const int id)
-{
- deleteStatus(statusIndex(id));
-}
-
-int Sigmod::Sigmod::newStatusId() const
-{
- int i = 0;
- while ((i < statusCount()) && (statusIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Store* Sigmod::Sigmod::store(const int index) const
-{
- if (index < storeCount())
- return m_stores.at(index);
- return NULL;
-}
-
-Sigmod::Store* Sigmod::Sigmod::store(const int index)
-{
- if (index < storeCount())
- return m_stores[index];
- return NULL;
-}
-
-const Sigmod::Store* Sigmod::Sigmod::storeById(const int id) const
-{
- return store(storeIndex(id));
-}
-
-Sigmod::Store* Sigmod::Sigmod::storeById(const int id)
-{
- return store(storeIndex(id));
-}
-
-int Sigmod::Sigmod::storeIndex(const int id) const
-{
- for (int i = 0; i < storeCount(); ++i)
- {
- if (m_stores[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::storeCount() const
-{
- return m_stores.size();
-}
-
-Sigmod::Store* Sigmod::Sigmod::newStore()
-{
- return newStore(new Store(this, newStoreId()));
-}
-
-Sigmod::Store* Sigmod::Sigmod::newStore(const QDomElement& xml)
-{
- return newStore(new Store(xml, this, newStoreId()));
-}
-
-Sigmod::Store* Sigmod::Sigmod::newStore(const Store& store)
-{
- return newStore(new Store(store, this, newStoreId()));
-}
-
-Sigmod::Store* Sigmod::Sigmod::newStore(Store* store)
-{
- m_stores.append(store);
- return store;
-}
-
-void Sigmod::Sigmod::deleteStore(const int index)
-{
- if (index < storeCount())
- {
- delete m_stores[index];
- m_stores.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteStoreById(const int id)
-{
- deleteStore(storeIndex(id));
-}
-
-int Sigmod::Sigmod::newStoreId() const
-{
- int i = 0;
- while ((i < storeCount()) && (storeIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Tile* Sigmod::Sigmod::tile(const int index) const
-{
- if (index < tileCount())
- return m_tiles.at(index);
- return NULL;
-}
-
-Sigmod::Tile* Sigmod::Sigmod::tile(const int index)
-{
- if (index < tileCount())
- return m_tiles[index];
- return NULL;
-}
-
-const Sigmod::Tile* Sigmod::Sigmod::tileById(const int id) const
-{
- return tile(tileIndex(id));
-}
-
-Sigmod::Tile* Sigmod::Sigmod::tileById(const int id)
-{
- return tile(tileIndex(id));
-}
-
-int Sigmod::Sigmod::tileIndex(const int id) const
-{
- for (int i = 0; i < tileCount(); ++i)
- {
- if (m_tiles[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::tileCount() const
-{
- return m_tiles.size();
-}
-
-Sigmod::Tile* Sigmod::Sigmod::newTile()
-{
- return newTile(new Tile(this, newTileId()));
-}
-
-Sigmod::Tile* Sigmod::Sigmod::newTile(const QDomElement& xml)
-{
- return newTile(new Tile(xml, this, newTileId()));
-}
-
-Sigmod::Tile* Sigmod::Sigmod::newTile(const Tile& tile)
-{
- return newTile(new Tile(tile, this, newTileId()));
-}
-
-Sigmod::Tile* Sigmod::Sigmod::newTile(Tile* tile)
-{
- m_tiles.append(tile);
- return tile;
-}
-
-void Sigmod::Sigmod::deleteTile(const int index)
-{
- if (index < tileCount())
- {
- delete m_tiles[index];
- m_tiles.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteTileById(const int id)
-{
- deleteTile(tileIndex(id));
-}
-
-int Sigmod::Sigmod::newTileId() const
-{
- int i = 0;
- while ((i < tileCount()) && (tileIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Time* Sigmod::Sigmod::time(const int index) const
-{
- if (index < timeCount())
- return m_times.at(index);
- return NULL;
-}
-
-Sigmod::Time* Sigmod::Sigmod::time(const int index)
-{
- if (index < timeCount())
- return m_times[index];
- return NULL;
-}
-
-const Sigmod::Time* Sigmod::Sigmod::timeById(const int id) const
-{
- return time(timeIndex(id));
-}
-
-Sigmod::Time* Sigmod::Sigmod::timeById(const int id)
-{
- return time(timeIndex(id));
-}
-
-int Sigmod::Sigmod::timeIndex(const int id) const
-{
- for (int i = 0; i < timeCount(); ++i)
- {
- if (m_times[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::timeCount() const
-{
- return m_times.size();
-}
-
-Sigmod::Time* Sigmod::Sigmod::newTime()
-{
- return newTime(new Time(this, newTimeId()));
-}
-
-Sigmod::Time* Sigmod::Sigmod::newTime(const QDomElement& xml)
-{
- return newTime(new Time(xml, this, newTimeId()));
-}
-
-Sigmod::Time* Sigmod::Sigmod::newTime(const Time& time)
-{
- return newTime(new Time(time, this, newTimeId()));
-}
-
-Sigmod::Time* Sigmod::Sigmod::newTime(Time* time)
-{
- m_times.append(time);
- return time;
-}
-
-void Sigmod::Sigmod::deleteTime(const int index)
-{
- if (index < timeCount())
- {
- delete m_times[index];
- m_times.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteTimeById(const int id)
-{
- deleteTime(timeIndex(id));
-}
-
-int Sigmod::Sigmod::newTimeId() const
-{
- int i = 0;
- while ((i < timeCount()) && (timeIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::Trainer* Sigmod::Sigmod::trainer(const int index) const
-{
- if (index < trainerCount())
- return m_trainers.at(index);
- return NULL;
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::trainer(const int index)
-{
- if (index < trainerCount())
- return m_trainers[index];
- return NULL;
-}
-
-const Sigmod::Trainer* Sigmod::Sigmod::trainerById(const int id) const
-{
- return trainer(trainerIndex(id));
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::trainerById(const int id)
-{
- return trainer(trainerIndex(id));
-}
-
-int Sigmod::Sigmod::trainerIndex(const int id) const
-{
- for (int i = 0; i < trainerCount(); ++i)
- {
- if (m_trainers[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::trainerCount() const
-{
- return m_trainers.size();
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::newTrainer()
-{
- return newTrainer(new Trainer(this, newTrainerId()));
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::newTrainer(const QDomElement& xml)
-{
- return newTrainer(new Trainer(xml, this, newTrainerId()));
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::newTrainer(const Trainer& trainer)
-{
- return newTrainer(new Trainer(trainer, this, newTrainerId()));
-}
-
-Sigmod::Trainer* Sigmod::Sigmod::newTrainer(Trainer* trainer)
-{
- m_trainers.append(trainer);
- return trainer;
-}
-
-void Sigmod::Sigmod::deleteTrainer(const int index)
-{
- if (index < trainerCount())
- {
- delete m_trainers[index];
- m_trainers.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteTrainerById(const int id)
-{
- deleteTrainer(trainerIndex(id));
-}
-
-int Sigmod::Sigmod::newTrainerId() const
-{
- int i = 0;
- while ((i < trainerCount()) && (trainerIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SSUBCLASS(Sigmod, Ability, ability, abilities)
+SSUBCLASS(Sigmod, Author, author, authors)
+SSUBCLASS(Sigmod, Badge, badge, badges)
+SSUBCLASS(Sigmod, CoinList, coinList, coinLists)
+SSUBCLASS(Sigmod, EggGroup, eggGroup, eggGroups)
+SSUBCLASS(Sigmod, GlobalScript, globalScript, globalScripts)
+SSUBCLASS(Sigmod, Item, item, items)
+SSUBCLASS(Sigmod, ItemType, itemType, itemTypes)
+SSUBCLASS(Sigmod, Map, map, maps)
+SSUBCLASS(Sigmod, Move, move, moves)
+SSUBCLASS(Sigmod, Nature, nature, natures)
+SSUBCLASS(Sigmod, Skin, skin, skins)
+SSUBCLASS(Sigmod, Sound, sound, sounds)
+SSUBCLASS(Sigmod, Species, species, species)
+SSUBCLASS(Sigmod, Sprite, sprite, sprites)
+SSUBCLASS(Sigmod, Status, status, status)
+SSUBCLASS(Sigmod, Store, store, stores)
+SSUBCLASS(Sigmod, Tile, tile, tiles)
+SSUBCLASS(Sigmod, Time, time, times)
+SSUBCLASS(Sigmod, Trainer, trainer, trainers)
const Sigmod::Type* Sigmod::Sigmod::type(const int index) const
{
@@ -2148,87 +529,7 @@ int Sigmod::Sigmod::newTypeId() const
return i;
}
-const Sigmod::Weather* Sigmod::Sigmod::weather(const int index) const
-{
- if (index < weatherCount())
- return m_weathers.at(index);
- return NULL;
-}
-
-Sigmod::Weather* Sigmod::Sigmod::weather(const int index)
-{
- if (index < weatherCount())
- return m_weathers[index];
- return NULL;
-}
-
-const Sigmod::Weather* Sigmod::Sigmod::weatherById(const int id) const
-{
- return weather(weatherIndex(id));
-}
-
-Sigmod::Weather* Sigmod::Sigmod::weatherById(const int id)
-{
- return weather(weatherIndex(id));
-}
-
-int Sigmod::Sigmod::weatherIndex(const int id) const
-{
- for (int i = 0; i < weatherCount(); ++i)
- {
- if (m_weathers[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Sigmod::weatherCount() const
-{
- return m_weathers.size();
-}
-
-Sigmod::Weather* Sigmod::Sigmod::newWeather()
-{
- return newWeather(new Weather(this, newWeatherId()));
-}
-
-Sigmod::Weather* Sigmod::Sigmod::newWeather(const QDomElement& xml)
-{
- return newWeather(new Weather(xml, this, newWeatherId()));
-}
-
-Sigmod::Weather* Sigmod::Sigmod::newWeather(const Weather& weather)
-{
- return newWeather(new Weather(weather, this, newWeatherId()));
-}
-
-Sigmod::Weather* Sigmod::Sigmod::newWeather(Weather* weather)
-{
- m_weathers.append(weather);
- return weather;
-}
-
-void Sigmod::Sigmod::deleteWeather(const int index)
-{
- if (index < weatherCount())
- {
- delete m_weathers[index];
- m_weathers.removeAt(index);
- }
-}
-
-void Sigmod::Sigmod::deleteWeatherById(const int id)
-{
- deleteWeather(weatherIndex(id));
-}
-
-int Sigmod::Sigmod::newWeatherId() const
-{
- int i = 0;
- while ((i < weatherCount()) && (weatherIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SSUBCLASS(Sigmod, Weather, weather, weathers)
Sigmod::Sigmod& Sigmod::Sigmod::operator=(const Sigmod& rhs)
{
@@ -2271,48 +572,23 @@ Sigmod::Sigmod& Sigmod::Sigmod::operator=(const Sigmod& rhs)
void Sigmod::Sigmod::clear()
{
- qDeleteAll(m_abilities);
- m_abilities.clear();
- qDeleteAll(m_authors);
- m_authors.clear();
- qDeleteAll(m_badges);
- m_badges.clear();
- qDeleteAll(m_coinLists);
- m_coinLists.clear();
- qDeleteAll(m_eggGroups);
- m_eggGroups.clear();
- qDeleteAll(m_globalScripts);
- m_globalScripts.clear();
- qDeleteAll(m_items);
- m_items.clear();
- qDeleteAll(m_itemTypes);
- m_itemTypes.clear();
- qDeleteAll(m_maps);
- m_maps.clear();
- qDeleteAll(m_moves);
- m_moves.clear();
- qDeleteAll(m_natures);
- m_natures.clear();
- qDeleteAll(m_skins);
- m_skins.clear();
- qDeleteAll(m_sounds);
- m_sounds.clear();
- qDeleteAll(m_species);
- m_species.clear();
- qDeleteAll(m_sprites);
- m_sprites.clear();
- qDeleteAll(m_status);
- m_status.clear();
- qDeleteAll(m_stores);
- m_stores.clear();
- qDeleteAll(m_tiles);
- m_tiles.clear();
- qDeleteAll(m_times);
- m_times.clear();
- qDeleteAll(m_trainers);
- m_trainers.clear();
- qDeleteAll(m_types);
- m_types.clear();
- qDeleteAll(m_weathers);
- m_weathers.clear();
+ SUBCLASS_CLEAR(abilities);
+ SUBCLASS_CLEAR(badges);
+ SUBCLASS_CLEAR(coinLists);
+ SUBCLASS_CLEAR(eggGroups);
+ SUBCLASS_CLEAR(globalScripts);
+ SUBCLASS_CLEAR(items);
+ SUBCLASS_CLEAR(maps);
+ SUBCLASS_CLEAR(moves);
+ SUBCLASS_CLEAR(natures);
+ SUBCLASS_CLEAR(skins);
+ SUBCLASS_CLEAR(sounds);
+ SUBCLASS_CLEAR(species);
+ SUBCLASS_CLEAR(sprites);
+ SUBCLASS_CLEAR(status);
+ SUBCLASS_CLEAR(stores);
+ SUBCLASS_CLEAR(tiles);
+ SUBCLASS_CLEAR(trainers);
+ SUBCLASS_CLEAR(types);
+ SUBCLASS_CLEAR(weathers);
}
diff --git a/sigmod/Species.cpp b/sigmod/Species.cpp
index 00fe6062..1940188a 100644
--- a/sigmod/Species.cpp
+++ b/sigmod/Species.cpp
@@ -357,251 +357,9 @@ CHECK_INDEX(Species, int, type, sigmod(), type)
CHECK_INDEX(Species, int, eggGroup, sigmod(), eggGroup)
CHECK(Species, Sigcore::Script&, evolution)
-const Sigmod::SpeciesAbility* Sigmod::Species::ability(const int index) const
-{
- if (index < abilityCount())
- return m_abilities.at(index);
- return NULL;
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::ability(const int index)
-{
- if (index < abilityCount())
- return m_abilities[index];
- return NULL;
-}
-
-const Sigmod::SpeciesAbility* Sigmod::Species::abilityById(const int id) const
-{
- return ability(abilityIndex(id));
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::abilityById(const int id)
-{
- return ability(abilityIndex(id));
-}
-
-int Sigmod::Species::abilityIndex(const int id) const
-{
- for (int i = 0; i < abilityCount(); ++i)
- {
- if (m_abilities[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Species::abilityCount() const
-{
- return m_abilities.size();
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::newAbility()
-{
- return newAbility(new SpeciesAbility(this, newAbilityId()));
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::newAbility(const QDomElement& xml)
-{
- return newAbility(new SpeciesAbility(xml, this, newAbilityId()));
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::newAbility(const SpeciesAbility& ability)
-{
- return newAbility(new SpeciesAbility(ability, this, newAbilityId()));
-}
-
-Sigmod::SpeciesAbility* Sigmod::Species::newAbility(SpeciesAbility* ability)
-{
- m_abilities.append(ability);
- return ability;
-}
-
-void Sigmod::Species::deleteAbility(const int index)
-{
- if (index < abilityCount())
- {
- delete m_abilities[index];
- m_abilities.removeAt(index);
- }
-}
-
-void Sigmod::Species::deleteAbilityById(const int id)
-{
- deleteAbility(abilityIndex(id));
-}
-
-int Sigmod::Species::newAbilityId() const
-{
- int i = 0;
- while ((i < abilityCount()) && (abilityIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::SpeciesItem* Sigmod::Species::item(const int index) const
-{
- if (index < itemCount())
- return m_items.at(index);
- return NULL;
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::item(const int index)
-{
- if (index < itemCount())
- return m_items[index];
- return NULL;
-}
-
-const Sigmod::SpeciesItem* Sigmod::Species::itemById(const int id) const
-{
- return item(itemIndex(id));
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::itemById(const int id)
-{
- return item(itemIndex(id));
-}
-
-int Sigmod::Species::itemIndex(const int id) const
-{
- for (int i = 0; i < itemCount(); ++i)
- {
- if (m_items[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Species::itemCount() const
-{
- return m_items.size();
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::newItem()
-{
- return newItem(new SpeciesItem(this, newItemId()));
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::newItem(const QDomElement& xml)
-{
- return newItem(new SpeciesItem(xml, this, newItemId()));
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::newItem(const SpeciesItem& item)
-{
- return newItem(new SpeciesItem(item, this, newItemId()));
-}
-
-Sigmod::SpeciesItem* Sigmod::Species::newItem(SpeciesItem* item)
-{
- m_items.append(item);
- return item;
-}
-
-void Sigmod::Species::deleteItem(const int index)
-{
- if (index < itemCount())
- {
- delete m_items[index];
- m_items.removeAt(index);
- }
-}
-
-void Sigmod::Species::deleteItemById(const int id)
-{
- deleteItem(itemIndex(id));
-}
-
-int Sigmod::Species::newItemId() const
-{
- int i = 0;
- while ((i < itemCount()) && (itemIndex(i) != INT_MAX))
- ++i;
- return i;
-}
-
-const Sigmod::SpeciesMove* Sigmod::Species::move(const int index) const
-{
- if (index < moveCount())
- return m_moves.at(index);
- return NULL;
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::move(const int index)
-{
- if (index < moveCount())
- return m_moves[index];
- return NULL;
-}
-
-const Sigmod::SpeciesMove* Sigmod::Species::moveById(const int id) const
-{
- return move(moveIndex(id));
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::moveById(const int id)
-{
- return move(moveIndex(id));
-}
-
-int Sigmod::Species::moveIndex(const int id) const
-{
- for (int i = 0; i < moveCount(); ++i)
- {
- if (m_moves[i]->id() == id)
- return i;
- }
- return INT_MAX;
-}
-
-int Sigmod::Species::moveCount() const
-{
- return m_moves.size();
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::newMove()
-{
- return newMove(new SpeciesMove(this, newMoveId()));
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::newMove(const QDomElement& xml)
-{
- return newMove(new SpeciesMove(xml, this, newMoveId()));
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::newMove(const SpeciesMove& move)
-{
- return newMove(new SpeciesMove(move, this, newMoveId()));
-}
-
-Sigmod::SpeciesMove* Sigmod::Species::newMove(SpeciesMove* move)
-{
- m_moves.append(move);
- return move;
-}
-
-void Sigmod::Species::deleteMove(const int index)
-{
- if (index < moveCount())
- {
- delete m_moves[index];
- m_moves.removeAt(index);
- }
-}
-
-void Sigmod::Species::deleteMoveById(const int id)
-{
- deleteMove(moveIndex(id));
-}
-
-int Sigmod::Species::newMoveId() const
-{
- int i = 0;
- while ((i < moveCount()) && (moveIndex(i) != INT_MAX))
- ++i;
- return i;
-}
+SUBCLASS(Species, Ability, ability, abilities)
+SUBCLASS(Species, Item, item, items)
+SUBCLASS(Species, Move, move, moves)
Sigmod::Species& Sigmod::Species::operator=(const Species& rhs)
{
@@ -641,10 +399,7 @@ Sigmod::Species& Sigmod::Species::operator=(const Species& rhs)
void Sigmod::Species::clear()
{
- qDeleteAll(m_abilities);
- m_abilities.clear();
- qDeleteAll(m_items);
- m_items.clear();
- qDeleteAll(m_moves);
- m_moves.clear();
+ SUBCLASS_CLEAR(abilities);
+ SUBCLASS_CLEAR(items);
+ SUBCLASS_CLEAR(moves);
}