void
MsnPkgDlg::DrawPackages()
{
	if (mission) {
		if (pkg_list) {
			pkg_list->ClearItems();

			int i = 0;
			int elem_index = 0;
			ListIter<MissionElement> elem = mission->GetElements();
			while (++elem) {
				// display this element?
				if (elem->GetIFF() == mission->Team()        && 
						!elem->IsSquadron()                      &&
						elem->Region() == mission->GetRegion()   &&
						elem->GetDesign()->type < Ship::STATION) {

					char txt[256];

					if (elem->Player() > 0) {
						sprintf_s(txt, "==>");
						if (pkg_index < 0)
						pkg_index = elem_index;
					}
					else {
						strcpy_s(txt, " ");
					}

					pkg_list->AddItemWithData(txt, elem->ElementID());
					pkg_list->SetItemText(i, 1, elem->Name());
					pkg_list->SetItemText(i, 2, elem->RoleName());

					const ShipDesign* design = elem->GetDesign();

					if (elem->Count() > 1)
					sprintf_s(txt, "%d %s", elem->Count(), design->abrv);
					else
					sprintf_s(txt, "%s %s", design->abrv, design->name);
					pkg_list->SetItemText(i, 3, txt);

					i++;
				}

				elem_index++;
			}
		}
	}
}
void
MsnPkgDlg::OnPackage(AWEvent* event)
{
	if (!pkg_list || !mission)
	return;

	int seln = pkg_list->GetListIndex();
	int pkg  = pkg_list->GetItemData(seln);

	int i = 0;
	ListIter<MissionElement> elem = mission->GetElements();
	while (++elem) {
		if (elem->ElementID() == pkg) {
			pkg_index = i;
			//mission->SetPlayer(elem.value());
		}

		i++;
	}

	//DrawPackages();
	DrawNavPlan();
}