当前位置: 首页>>代码示例>>C++>>正文


C++ Armor::SetMaxDexBonus方法代码示例

本文整理汇总了C++中Armor::SetMaxDexBonus方法的典型用法代码示例。如果您正苦于以下问题:C++ Armor::SetMaxDexBonus方法的具体用法?C++ Armor::SetMaxDexBonus怎么用?C++ Armor::SetMaxDexBonus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Armor的用法示例。


在下文中一共展示了Armor::SetMaxDexBonus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_pushButton_clicked

void armor_edit_new::on_pushButton_clicked()
{
    //cout << "Next pressed\n";
    QString arr_qstring[13], description;
    bool good = false;
    bool priceerr = false,
         weighterr = false,
         armorBonuserr = false;

    //cout << "Grabbing user input\n";

    arr_qstring[0] = ui->name_textbox->text();
    arr_qstring[1] = ui->price_textbox->text();
    arr_qstring[2] = ui->type_textbox->text();
    arr_qstring[3] = ui->weight_textbox->text();
    arr_qstring[4] = ui->armor_textbox->text();
    arr_qstring[5] = ui->armorCheckPenalty_textbox->text();

    arr_qstring[6] = ui->don_textbox->text();
    arr_qstring[7] = ui->donHaste_textbox->text();
    arr_qstring[8] = ui->remove_textbox->text();
    arr_qstring[9] = ui->speedHuman_textbox->text();
    arr_qstring[10] = ui->speedDwarf_textbox->text();

    arr_qstring[11] = ui->maxDexBonus_textbox->text();
    arr_qstring[12] = ui->arcaneSpellFail_textbox->text();

    description = ui->description_textbox->toPlainText();

    Armor a;
        a.SetName(arr_qstring[0].toStdString()),
        a.SetCost(arr_qstring[1].toStdString()),
        a.SetType(arr_qstring[2].toStdString()),
        a.SetWeight(arr_qstring[3].toStdString()),
        a.SetArmorBonus(arr_qstring[4].toStdString()),
        a.SetArmorCheckPenalty(arr_qstring[5].toStdString()),
        a.SetDon(arr_qstring[6].toStdString()),
        a.SetDonHastely(arr_qstring[7].toStdString()),
        a.SetRemove(arr_qstring[8].toStdString()),
        a.SetSpeedHuman(arr_qstring[9].toStdString()),
        a.SetSpeedDwarf(arr_qstring[10].toStdString()),
        a.SetMaxDexBonus(arr_qstring[11].toStdString()),
        a.SetArcaneSpellFailure(arr_qstring[12].toStdString()),
        a.SetDescription(description.toStdString());

    for (int i = 0 ; i < a.GetCost().size(); i++)
        if (!isdigit(a.GetCost()[i]) || a.GetCost()[i] == '.')
            priceerr = true;
    for (int i = 0; i < a.GetWeight().size(); i++)
        if (!isdigit(a.GetWeight()[i]))
            weighterr = true;
    for (int i = 0; i < a.GetArmorBonus().size(); i++)
        if (!isdigit(a.GetArmorBonus()[i]))
            armorBonuserr = true;

    if (!priceerr && !weighterr && !armorBonuserr)
        good = true;
    else
    {
        good = false;
        //cout << "Something was false\n";
    }

    if (good)
    {
        //No need to check the return.
        //If we're at this point in the code then the database is fine.
        //cout << "Calling AddtoCEAMS\n";
        //if (
        AddToCEAMS(a);//)
        newDB.armor_V->push_back(a);
            //cout << "Success!\n";
        //else
            //cout << "Fail :(\n";

        //cout << "AddToCEAMS has returned\n";

        //Close window and signal success
        //success* goodWindow = new success;
       // goodWindow->show();
        this->close();
    }
    else
    {
        //Signal error, highlight error boxes
        if (priceerr)
            ui->price_textbox->setStyleSheet("QLabel{background_color:red;}");
        else
            ui->price_textbox->setStyleSheet("QLabel{background_color:white;}");
        if (weighterr)
            ui->weight_textbox->setStyleSheet("QLabel{background_color:red;}");
        else
            ui->weight_textbox->setStyleSheet("QLabel{background_color:white;}");
        if (armorBonuserr)
            ui->armor_textbox->setStyleSheet("QLabel{background_color:red;}");
        else
            ui->armor_textbox->setStyleSheet("QLabel{background_color:white;}");
    }


//.........这里部分代码省略.........
开发者ID:srohr,项目名称:CEAMS,代码行数:101,代码来源:armor_edit_new.cpp


注:本文中的Armor::SetMaxDexBonus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。