diff options
Diffstat (limited to 'sigmodr/tree/TreeItem.cpp')
-rw-r--r-- | sigmodr/tree/TreeItem.cpp | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeItem.cpp b/sigmodr/tree/TreeItem.cpp index 17180a93..45dd604f 100644 --- a/sigmodr/tree/TreeItem.cpp +++ b/sigmodr/tree/TreeItem.cpp @@ -96,6 +96,195 @@ TreeItem::TreeItem(const TreeItemType type, Object* object, TreeItem* parent) : m_object(object), m_parent(parent) { + Game* game = qobject_cast<Game*>(m_object); + CoinList* coinList = qobject_cast<CoinList*>(m_object); + Map* map = qobject_cast<Map*>(m_object); + MapTrainer* trainer = qobject_cast<MapTrainer*>(m_object); + MapWildList* wildList = qobject_cast<MapWildList*>(m_object); + Species* species = qobject_cast<Species*>(m_object); + if (m_type == GroupAbility) + { + for (int i = 0; i < game->abilityCount(); ++i) + m_children.append(new TreeItem(EntryAbility, game->ability(i), this)); + } + if (m_type == GroupAuthor) + { + for (int i = 0; i < game->authorCount(); ++i) + m_children.append(new TreeItem(EntryAuthor, game->author(i), this)); + } + if (m_type == GroupBadge) + { + for (int i = 0; i < game->badgeCount(); ++i) + m_children.append(new TreeItem(EntryBadge, game->badge(i), this)); + } + if (m_type == GroupCoinList) + { + for (int i = 0; i < game->coinListCount(); ++i) + m_children.append(new TreeItem(EntryCoinList, game->coinList(i), this)); + } + if (m_type == GroupEggGroup) + { + for (int i = 0; i < game->eggGroupCount(); ++i) + m_children.append(new TreeItem(EntryEggGroup, game->eggGroup(i), this)); + } + if (m_type == GroupGlobalScript) + { + for (int i = 0; i < game->globalScriptCount(); ++i) + m_children.append(new TreeItem(EntryGlobalScript, game->globalScript(i), this)); + } + if (m_type == GroupItem) + { + for (int i = 0; i < game->itemCount(); ++i) + m_children.append(new TreeItem(EntryItem, game->item(i), this)); + } + if (m_type == GroupItemType) + { + for (int i = 0; i < game->itemTypeCount(); ++i) + m_children.append(new TreeItem(EntryItemType, game->itemType(i), this)); + } + if (m_type == GroupMap) + { + for (int i = 0; i < game->mapCount(); ++i) + m_children.append(new TreeItem(EntryMap, game->map(i), this)); + } + if (m_type == GroupMapEffect) + { + for (int i = 0; i < map->effectCount(); ++i) + m_children.append(new TreeItem(EntryMapEffect, map->effect(i), this)); + } + if (m_type == GroupMapTrainer) + { + for (int i = 0; i < map->trainerCount(); ++i) + m_children.append(new TreeItem(EntryMapTrainer, map->trainer(i), this)); + } + if (m_type == GroupMapWarp) + { + for (int i = 0; i < map->warpCount(); ++i) + m_children.append(new TreeItem(EntryMapWarp, map->warp(i), this)); + } + if (m_type == GroupMapWildList) + { + for (int i = 0; i < map->wildListCount(); ++i) + m_children.append(new TreeItem(EntryMapWildList, map->wildList(i), this)); + } + if (m_type == GroupMove) + { + for (int i = 0; i < game->moveCount(); ++i) + m_children.append(new TreeItem(EntryMove, game->move(i), this)); + } + if (m_type == GroupNature) + { + for (int i = 0; i < game->natureCount(); ++i) + m_children.append(new TreeItem(EntryNature, game->nature(i), this)); + } + if (m_type == GroupSkin) + { + for (int i = 0; i < game->skinCount(); ++i) + m_children.append(new TreeItem(EntrySkin, game->skin(i), this)); + } + if (m_type == GroupSound) + { + for (int i = 0; i < game->soundCount(); ++i) + m_children.append(new TreeItem(EntrySound, game->sound(i), this)); + } + if (m_type == GroupSpecies) + { + for (int i = 0; i < game->speciesCount(); ++i) + m_children.append(new TreeItem(EntrySpecies, game->species(i), this)); + } + if (m_type == GroupSprite) + { + for (int i = 0; i < game->spriteCount(); ++i) + m_children.append(new TreeItem(EntrySprite, game->sprite(i), this)); + } + if (m_type == GroupStatus) + { + for (int i = 0; i < game->statusCount(); ++i) + m_children.append(new TreeItem(EntryStatus, game->status(i), this)); + } + if (m_type == GroupStore) + { + for (int i = 0; i < game->storeCount(); ++i) + m_children.append(new TreeItem(EntryStore, game->store(i), this)); + } + if (m_type == GroupTile) + { + for (int i = 0; i < game->tileCount(); ++i) + m_children.append(new TreeItem(EntryTile, game->tile(i), this)); + } + if (m_type == GroupTime) + { + for (int i = 0; i < game->timeCount(); ++i) + m_children.append(new TreeItem(EntryTime, game->time(i), this)); + } + if (m_type == GroupTrainer) + { + for (int i = 0; i < game->trainerCount(); ++i) + m_children.append(new TreeItem(EntryTrainer, game->trainer(i), this)); + } + if (m_type == GroupType) + { + for (int i = 0; i < game->typeCount(); ++i) + m_children.append(new TreeItem(EntryType, game->type(i), this)); + } + if (m_type == GroupWeather) + { + for (int i = 0; i < game->weatherCount(); ++i) + m_children.append(new TreeItem(EntryWeather, game->weather(i), this)); + } + if (m_type == EntryGame) + { + m_children.append(new TreeItem(EntryRules, game->rules(), this)); + m_children.append(new TreeItem(GroupAbility, game, this)); + m_children.append(new TreeItem(GroupAuthor, game, this)); + m_children.append(new TreeItem(GroupBadge, game, this)); + m_children.append(new TreeItem(GroupCoinList, game, this)); + m_children.append(new TreeItem(GroupEggGroup, game, this)); + m_children.append(new TreeItem(GroupGlobalScript, game, this)); + m_children.append(new TreeItem(GroupItem, game, this)); + m_children.append(new TreeItem(GroupItemType, game, this)); + m_children.append(new TreeItem(GroupMap, game, this)); + m_children.append(new TreeItem(GroupMove, game, this)); + m_children.append(new TreeItem(GroupNature, game, this)); + m_children.append(new TreeItem(GroupSkin, game, this)); + m_children.append(new TreeItem(GroupSound, game, this)); + m_children.append(new TreeItem(GroupSpecies, game, this)); + m_children.append(new TreeItem(GroupSprite, game, this)); + m_children.append(new TreeItem(GroupStatus, game, this)); + m_children.append(new TreeItem(GroupStore, game, this)); + m_children.append(new TreeItem(GroupTile, game, this)); + m_children.append(new TreeItem(GroupTime, game, this)); + m_children.append(new TreeItem(GroupTrainer, game, this)); + m_children.append(new TreeItem(GroupType, game, this)); + m_children.append(new TreeItem(GroupWeather, game, this)); + } + if (m_type == EntryCoinList) + { + for (int i = 0; i < coinList->itemCount(); ++i) + m_children.append(new TreeItem(EntryCoinListItem, coinList->item(i), this)); + } + if (m_type == EntryMap) + { + m_children.append(new TreeItem(GroupMapEffect, map, this)); + m_children.append(new TreeItem(GroupMapTrainer, map, this)); + m_children.append(new TreeItem(GroupMapWarp, map, this)); + m_children.append(new TreeItem(GroupMapWildList, map, this)); + } + if (m_type == EntryMapTrainer) + { + for (int i = 0; i < trainer->teamMemberCount(); ++i) + m_children.append(new TreeItem(EntryMapTrainerTeamMember, trainer->teamMember(i), this)); + } + if (m_type == EntryMapWildList) + { + for (int i = 0; i < wildList->encounterCount(); ++i) + m_children.append(new TreeItem(EntryMapWildListEncounter, wildList->encounter(i), this)); + } + if (m_type == EntrySpecies) + { + for (int i = 0; i < species->moveCount(); ++i) + m_children.append(new TreeItem(EntrySpeciesMove, species->move(i), this)); + } } TreeItem::~TreeItem() |