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


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

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


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

示例1: ShowCmdDlg

void
CmdMissionsDlg::Show()
{
    mode = MODE_MISSIONS;

    FormWindow::Show();
    ShowCmdDlg();

    campaign = Campaign::GetCampaign();

    if (campaign) {
        if (lst_missions) {
            lst_missions->ClearItems();

            Player*            player   = Player::GetCurrentPlayer();
            List<MissionInfo>& missions = campaign->GetMissionList();
            for (int i = 0; i < missions.size(); i++) {
                MissionInfo* info = missions[i];
                lst_missions->AddItemWithData(info->name, info->id);

                Mission* m = info->mission;
                if (m) {
                    if (m->Type() == Mission::TRAINING && player->HasTrained(m->Identity())) {
                        lst_missions->SetItemText(i, 1, Game::GetText("CmdMissionsDlg.training"));
                    }
                    else {
                        lst_missions->SetItemText(i, 1, m->TypeName());
                    }
                }

                char start_time[64];
                FormatDayTime(start_time, info->start);
                lst_missions->SetItemText(i, 2, start_time);
            }
        }
    }
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:37,代码来源:CmdMissionsDlg.cpp

示例2: if

void
CmdMissionsDlg::ExecFrame()
{
    CmdDlg::ExecFrame();

    if (campaign) {
        List<MissionInfo>& missions = campaign->GetMissionList();
        Player*            player   = Player::GetCurrentPlayer();

        if (missions.size() > lst_missions->NumItems()) {
            while (missions.size() > lst_missions->NumItems()) {
                MissionInfo* info = missions[lst_missions->NumItems()];
                int i = lst_missions->AddItemWithData(info->name, info->id) - 1;

                Mission* m = info->mission;
                if (m) {
                    if (m->Type() == Mission::TRAINING && player->HasTrained(m->Identity())) {
                        lst_missions->SetItemText(i, 1, Game::GetText("CmdMissionsDlg.training"));
                    }
                    else {
                        lst_missions->SetItemText(i, 1, m->TypeName());
                    }
                }

                char start_time[64];
                FormatDayTime(start_time, info->start);
                lst_missions->SetItemText(i, 2, start_time);
            }
        }

        else if (missions.size() < lst_missions->NumItems()) {
            lst_missions->ClearItems();

            for (int i = 0; i < missions.size(); i++) {
                MissionInfo* info = missions[i];
                lst_missions->AddItemWithData(info->name, info->id);

                Mission* m = info->mission;
                if (m) {
                    if (m->Type() == Mission::TRAINING && player->HasTrained(m->Identity())) {
                        lst_missions->SetItemText(i, 1, Game::GetText("CmdMissionsDlg.training"));
                    }
                    else {
                        lst_missions->SetItemText(i, 1, m->TypeName());
                    }
                }

                char start_time[64];
                FormatDayTime(start_time, info->start);
                lst_missions->SetItemText(i, 2, start_time);
            }
        }

        else if (missions.size() > 0 && lst_missions->NumItems() > 0) {
            int id = lst_missions->GetItemData(0);
            MissionInfo* info = campaign->GetMissionInfo(id);

            if (!info) {
                int seln    = -1;
                int seln_id = 0;

                for (int i = 0; i < lst_missions->NumItems(); i++)
                if (lst_missions->IsSelected(i))
                seln = i;
                
                if (seln >= 0)
                seln_id = lst_missions->GetItemData(seln);

                lst_missions->ClearItems();
                seln = -1;

                for (int i = 0; i < missions.size(); i++) {
                    MissionInfo* info = missions[i];
                    lst_missions->AddItemWithData(info->name, info->id);

                    Mission* m = info->mission;
                    if (m) {
                        if (m->Type() == Mission::TRAINING && player->HasTrained(m->Identity())) {
                            lst_missions->SetItemText(i, 1, Game::GetText("CmdMissionsDlg.training"));
                        }
                        else {
                            lst_missions->SetItemText(i, 1, m->TypeName());
                        }
                    }

                    char start_time[64];
                    FormatDayTime(start_time, info->start);
                    lst_missions->SetItemText(i, 2, start_time);

                    if (info->id == seln_id)
                    seln = i;
                }

                if (seln >= 0)
                lst_missions->SetSelected(seln);
            }
        }

        bool found = false;

//.........这里部分代码省略.........
开发者ID:Banbury,项目名称:starshatter-open,代码行数:101,代码来源:CmdMissionsDlg.cpp


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