diff options
Diffstat (limited to 'sigmod/Sigmod.cpp')
| -rw-r--r-- | sigmod/Sigmod.cpp | 1804 |
1 files changed, 40 insertions, 1764 deletions
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); } |
