示例#1
0
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);
}
示例#2
0
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;
}