本文整理汇总了C++中Sim::FindAvailCallsign方法的典型用法代码示例。如果您正苦于以下问题:C++ Sim::FindAvailCallsign方法的具体用法?C++ Sim::FindAvailCallsign怎么用?C++ Sim::FindAvailCallsign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sim
的用法示例。
在下文中一共展示了Sim::FindAvailCallsign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
FltDlg::OnAlert(AWEvent* event)
{
if (!filter_list || !hangar_list || !ship) return;
int squad = filter_list->GetSelectedIndex();
Hangar* hangar = ship->GetHangar();
Sim* sim = Sim::GetSim();
const char* call = sim->FindAvailCallsign(ship->GetIFF());
Element* elem = sim->CreateElement(call, ship->GetIFF());
FlightDeck* deck = 0;
int queue = 1000;
const int* load = 0;
elem->SetSquadron(hangar->SquadronName(squad));
elem->SetCarrier(ship);
for (int i = 0; i < ship->NumFlightDecks(); i++) {
FlightDeck* d = ship->GetFlightDeck(i);
if (d && d->IsLaunchDeck()) {
int dq = hangar->PreflightQueue(d);
if (dq < queue) {
queue = dq;
deck = d;
}
}
}
int nalert = 0;
int slots[4];
for (int i = 0; i < 4; i++)
slots[i] = -1;
for (int i = 0; i < hangar_list->NumItems(); i++) {
if (hangar_list->IsSelected(i)) {
int nslot = hangar_list->GetItemData(i);
slots[nalert] = nslot;
if (!load) {
const HangarSlot* hangar_slot = hangar->GetSlot(squad, nslot);
if (hangar_slot) {
load = hangar->GetLoadout(hangar_slot);
elem->SetLoadout((int*) load);
}
}
hangar->GotoAlert(squad, nslot, deck, elem);
hangar_list->SetSelected(i, false);
nalert++;
if (nalert >= 4)
break;
}
}
NetUtil::SendElemCreate(elem, squad, slots, true);
}
示例2: new
void
FltDlg::OnPackage(AWEvent* event)
{
if (!filter_list || !hangar_list || !ship) return;
int code = Mission::PATROL;
switch (mission_type) {
case 0: code = Mission::PATROL; break;
case 1: code = Mission::INTERCEPT; break;
case 2: code = Mission::ASSAULT; break;
case 3: code = Mission::STRIKE; break;
case 4: code = Mission::ESCORT; break;
case 5: code = Mission::INTEL; break;
}
int squad = filter_list->GetSelectedIndex();
Hangar* hangar = ship->GetHangar();
Sim* sim = Sim::GetSim();
const char* call = sim->FindAvailCallsign(ship->GetIFF());
Element* elem = sim->CreateElement(call, ship->GetIFF(), code);
Element* tgt = 0;
FlightDeck* deck = 0;
int queue = 1000;
int* load = 0;
elem->SetSquadron(hangar->SquadronName(squad));
elem->SetCarrier(ship);
if (objective_list) {
int index = objective_list->GetListIndex();
Text target = objective_list->GetItemText(index);
Instruction* objective = new(__FILE__,__LINE__) Instruction(code, target.data());
elem->AddObjective(objective);
tgt = sim->FindElement(target.data());
}
if (loadout_list && design) {
int index = loadout_list->GetListIndex();
Text loadname = loadout_list->GetItemText(index);
ListIter<ShipLoad> sl = (List<ShipLoad>&) design->loadouts;
while (++sl && !load) {
if (sl->name == loadname) {
load = sl->load;
elem->SetLoadout(load);
}
}
}
for (int i = 0; i < ship->NumFlightDecks(); i++) {
FlightDeck* d = ship->GetFlightDeck(i);
if (d && d->IsLaunchDeck()) {
int dq = hangar->PreflightQueue(d);
if (dq < queue) {
queue = dq;
deck = d;
}
}
}
int npackage = 0;
int slots[6];
for (int i = 0; i < 6; i++)
slots[i] = -1;
for (int i = 0; i < hangar_list->NumItems(); i++) {
if (hangar_list->IsSelected(i)) {
int nslot = hangar_list->GetItemData(i);
hangar->GotoAlert(squad, nslot, deck, elem, load, true);
slots[npackage] = nslot;
hangar_list->SetSelected(i, false);
npackage++;
if (npackage >= 6)
break;
}
}
NetUtil::SendElemCreate(elem, squad, slots, false);
if (flight_planner) {
switch (mission_type) {
case 0:
default:
flight_planner->CreatePatrolRoute(elem, patrol_pattern++);
break;
case 1:
case 2:
case 3:
if (tgt)
flight_planner->CreateStrikeRoute(elem, tgt);
else
flight_planner->CreatePatrolRoute(elem, patrol_pattern++);
//.........这里部分代码省略.........