Ejemplo n.º 1
0
void TierWindow::updateTier()
{
    helper->applyVals();

    if (currentEdit != currentTier->name()) {
        /* Prevent to have duplicate names */
        if (dataTree->getNode(currentEdit)) {
            currentEdit = currentTier->name();
            QMessageBox::information(this, "Name Taken", "The name is already taken, so the old one will stay");
        } else {
            currentTier->changeName(currentEdit);
        }
    }

    currentTier->importBannedItems(items);
    currentTier->importBannedPokes(pokemons);
    currentTier->importBannedMoves(moves);
    currentTier->importBannedZMoves(zmoves);
    currentTier->importBannedAbilities(abilities);
    currentTier->importRestrictedPokes(restrPokemons);

    int clRes = 0;
    for (int i = 0; i < ChallengeInfo::numberOfClauses; i++) {
        if (clauses[i])
            clRes |= 1 << i;
    }
    currentTier->clauses = clRes;

    TierCategory *c = dataTree->getParentCategory(currentTier);
    if (c->name() != parent) {
        c->removeChild(currentTier);
        /* If the xml file is malformed, and has a tier and a category with the same name, it can crash here */
        TierCategory *c = (TierCategory*)dataTree->getNode(parent);
        c->appendChild(currentTier);
    }

    updateTree();
}
Ejemplo n.º 2
0
void TierWindow::updateCategory()
{
    helper->applyVals();

    if (currentEdit != currentTierCat->name()) {
        /* Prevent to have duplicate names */
        if (dataTree->getNode(currentEdit)) {
            currentEdit = currentTierCat->name();
            QMessageBox::information(this, "Name Taken", "The name is already taken, so the old one will stay");
        } else {
            currentTierCat->changeName(currentEdit);
        }
    }

    TierCategory *c = dataTree->getParentCategory(currentTierCat);
    if (c->name() != parent && currentTierCat->name() != parent) {
        c->removeChild(currentTierCat);
        /* If the xml file is malformed, and has a tier and a category with the same name, it can crash here */
        TierCategory *c = (TierCategory*)dataTree->getNode(parent);
        c->appendChild(currentTierCat);
    }

    updateTree();
}