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


C++ Mission::infoCost方法代码示例

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


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

示例1: handleAction

void BriefMenu::handleAction(const int actionId, void *ctx, const int modKeys) {
    Mission *pMission = g_Session.getMission();
    if (actionId == infosButId_) {
        // Buy some informations
        if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) {
            g_Session.setMoney(g_Session.getMoney() - pMission->infoCost(g_Session.getSelectedBlock().infoLevel));
            g_Session.getSelectedBlock().infoLevel += 1;
            
            getStatic(txtMoneyId_)->setTextFormated("%d", g_Session.getMoney());
            if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) {
                getStatic(txtInfoId_)->setTextFormated("%d",
                    pMission->infoCost(g_Session.getSelectedBlock().infoLevel));
            } else
                getStatic(txtInfoId_)->setText("");
        }

        getOption(nextButId_)->setVisible(true);
    }

    if (actionId == enhButId_) {
        // Buy some map enhancement
        if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) {
            g_Session.setMoney(g_Session.getMoney() - 
                pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel));
            g_Session.getSelectedBlock().enhanceLevel += 1;
            
            getStatic(txtMoneyId_)->setTextFormated("%d", g_Session.getMoney());
            if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) {
                getStatic(txtEnhId_)->setTextFormated("%d",
                    pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel));
            } else
                getStatic(txtEnhId_)->setText("");
        }
    }

    if (actionId == nextButId_) {
        // Next page
        start_line_ += 14;
        getOption(prevButId_)->setVisible(true);
        needRendering();
    }

    if (actionId == prevButId_) {
        // Previous page
        start_line_ -= 14;

        if (start_line_ <= 0) {
            start_line_ = 0;
            getOption(prevButId_)->setVisible(false);
        }
        getOption(nextButId_)->setVisible(true);
        needRendering();
    }
}
开发者ID:spippolatore,项目名称:freesynd,代码行数:54,代码来源:briefmenu.cpp

示例2: handleShow

void BriefMenu::handleShow() {

    menu_manager_->saveBackground();

    // grab mission info
    int cur_miss = g_Session.getSelectedBlock().mis_id;
    Mission *pMission = g_App.missions().loadMission(cur_miss);
    assert(pMission != NULL);
    g_Session.setMission(pMission);
    // NOTE: map is required to be loaded here, because minimap is z=0
    pMission->loadMap();

    pMission->createMinimap();
    
    bool found = false;
    int maxx = pMission->mmax_x_;
    int maxy = pMission->mmax_y_;

    for (int x = 0; x < maxx && (!found); x++) {
        for (int y = 0; y < maxy && (!found); y++) {
            if (pMission->getMinimapOverlay(x, y) == 1) {
                minimap_scroll_x_ = x;
                minimap_scroll_y_ = y;
                found = true;
            }
        }
    }

    minimap_blink_ticks_ = 0;
    minimap_blink_ = 0;
    start_line_ = 0;

    updateClock();

    if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) {
        getStatic(txtInfoId_)->setTextFormated("%d",
            pMission->infoCost(g_Session.getSelectedBlock().infoLevel));
    } else
        getStatic(txtInfoId_)->setText("");
    if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) {
        getStatic(txtEnhId_)->setTextFormated("%d",
            pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel));
    } else
        getStatic(txtEnhId_)->setText("");

    g_System.showCursor();
}
开发者ID:spippolatore,项目名称:freesynd,代码行数:47,代码来源:briefmenu.cpp


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