Pilot::Pilot(Flight *flt, Pilot_Params *params, Weapon_Instance *weapons, int n_weaps, char *hndl, Target *target_obj) : aiPilot(&sbrFlight), sbrFlight(flt) { this->params = params; this->weapons = weapons; this->n_weaps = n_weaps; this->target_obj = target_obj; SetAffiliation(params->affiliation); SetHandle(hndl); SetTask(NOTHING); AddaiPilot(this); target_flight = NULL; target_pilot = NULL; target = NULL; flight = flt; sel_wpn = 0; sel_weapon = &weapons[0]; message.time_limit = 3.0; new_damage = 0.0; if (!flight->controls.autopilot) { if (!IsPlayer()) ClearManeuverStack(); SetAsPlayer(1); } else SetAsPlayer(0); /* * See if we are carrying * stores which we can later * drop dramatically when engaged */ nstores = 0; for (int i=0;i<n_weaps;i++) { if (weapons[i].getType() == fueltank_t) { if (nstores < sbrPIL_MAX_STORES) { stores[nstores] = i; nstores++; } else break; } } }
// Set a maneuver. This clears the stack // and makes the maneuver the current one void aiBase::SetManeuver(int mnvr, uint32_t flags, sREAL d0, sREAL d1, sREAL d2) { if (mnvr >= 1 && mnvr < sManeuver::LAST) { ClearManeuverStack(); PushManeuver(mnvr,flags,d0,d1,d2); LOG("Setting Maneuver To: %s", sManeuver::Maneuver2String(mnvr)); } else LOG("Invalid Maneuver Passed: %d", mnvr); }