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


C++ Player::AILevel方法代码示例

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


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

示例1: if

GroundAI::GroundAI(SimObject* s)
: ship((Ship*) s), target(0), subtarget(0), exec_time(0), carrier_ai(0)
{
    Sim*  sim         = Sim::GetSim();
    Ship* pship       = sim->GetPlayerShip();
    int   player_team = 1;
    int   ai_level    = 1;

    if (pship)
    player_team = pship->GetIFF();

    Player* player = Player::GetCurrentPlayer();
    if (player) {
        if (ship && ship->GetIFF() && ship->GetIFF() != player_team) {
            ai_level = player->AILevel();
        }
        else if (player->AILevel() == 0) {
            ai_level = 1;
        }
    }

    // evil alien ships are *always* smart:
    if (ship && ship->GetIFF() > 1 && ship->Design()->auto_roll > 1) {
        ai_level = 2;
    }

    if (ship && ship->GetHangar() && ship->GetCommandAILevel() > 0)
    carrier_ai = new(__FILE__,__LINE__) CarrierAI(ship, ai_level);
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:29,代码来源:GroundAI.cpp

示例2:

void
OptDlg::Show()
{
    FormWindow::Show();

    if (closed) {
        Starshatter*   stars = Starshatter::GetInstance();

        if (stars) {
            if (flight_model)
            flight_model->SetSelection(Ship::GetFlightModel());

            if (landings)
            landings->SetSelection(Ship::GetLandingModel());

            if (hud_mode)
            hud_mode->SetSelection(HUDView::IsArcade() ? 1 : 0);

            if (hud_color)
            hud_color->SetSelection(HUDView::DefaultColorSet());

            if (ff_mode)
            ff_mode->SetSelection((int) (Ship::GetFriendlyFireLevel() * 4));
        }

        Player* player = Player::GetCurrentPlayer();
        if (player) {
            if (flying_start)
            flying_start->SetSelection(player->FlyingStart());

            if (ai_difficulty)
            ai_difficulty->SetSelection(ai_difficulty->NumItems() - player->AILevel() - 1);

            if (grid_mode)
            grid_mode->SetSelection(player->GridMode());

            if (gunsight)
            gunsight->SetSelection(player->Gunsight());
        }
    }

    if (vid_btn)   vid_btn->SetButtonState(0);
    if (aud_btn)   aud_btn->SetButtonState(0);
    if (ctl_btn)   ctl_btn->SetButtonState(0);
    if (opt_btn)   opt_btn->SetButtonState(1);
    if (mod_btn)   mod_btn->SetButtonState(0);

    closed = false;
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:49,代码来源:OptDlg.cpp


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