Пример #1
0
void
SeekerAI::CheckDecoys(double target_distance)
{
    // if the assigned target has the burner lit,
    // ignore the decoys:
    if (orig_target && orig_target->Augmenter()) {
        SetTarget(orig_target);
        return;
    }

    if (target && 
            target == orig_target && 
            orig_target->GetActiveDecoys().size()) {

        ListIter<Shot> decoy = orig_target->GetActiveDecoys();

        while (++decoy) {
            double decoy_distance = Point(decoy->Location() - self->Location()).length();

            if (decoy_distance < target_distance) {
                if (rand() < 1600) {
                    SetTarget(decoy.value(), 0);
                    return;
                }
            }
        }
    }
}
void
MsnPkgDlg::DrawNavPlan()
{
	if (mission) {
		if (pkg_index < 0 || pkg_index >= mission->GetElements().size())
		pkg_index = 0;

		MissionElement* element = mission->GetElements()[pkg_index];
		if (nav_list && element) {
			nav_list->ClearItems();

			Point loc          = element->Location();
			int   i            = 0;

			ListIter<Instruction> navpt = element->NavList();
			while (++navpt) {
				char txt[256];
				sprintf_s(txt, "%d", i + 1);

				nav_list->AddItem(txt);
				nav_list->SetItemText(i, 1, Instruction::ActionName(navpt->Action()));
				nav_list->SetItemText(i, 2, navpt->RegionName());

				double dist = Point(loc - navpt->Location()).length();
				FormatNumber(txt, dist);
				nav_list->SetItemText(i, 3, txt);

				sprintf_s(txt, "%d", navpt->Speed());
				nav_list->SetItemText(i, 4, txt);

				loc = navpt->Location();
				i++;
			}
		}
	}
}