当前位置: 首页>>代码示例>>C++>>正文


C++ ListIter::Name方法代码示例

本文整理汇总了C++中ListIter::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIter::Name方法的具体用法?C++ ListIter::Name怎么用?C++ ListIter::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListIter的用法示例。


在下文中一共展示了ListIter::Name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

StarSystem*
Galaxy::GetSystem(const char* name)
{
    ListIter<StarSystem> sys = systems;
    while (++sys) {
        if (!strcmp(sys->Name(), name))
        return sys.value();
    }

    return 0;
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:11,代码来源:Galaxy.cpp

示例2:

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++;
			}
		}
	}
}
开发者ID:lightgemini78,项目名称:Starshatter-Rearmed,代码行数:48,代码来源:MsnPkgDlg.cpp

示例3: if

Menu*
RadioView::GetRadioMenu(Ship* s)
{
	dst_elem = 0;

	if (s && sim) {
		if (s->IsStarship()) {
			starship_menu->ClearItems();

			int n           = 0;
			int page_offset = starship_page*PAGE_SIZE;

			ListIter<Element> elem = sim->GetElements();

			if (num_pages == 0) {
				while (++elem) {
					if (elem->IsFinished() || elem->IsSquadron() || elem->IsStatic())
					continue;

					if (ship->GetIFF() == elem->GetIFF() && ship->GetElement() != elem.value())
					n++;
				}

				num_pages = (n/PAGE_SIZE) + (n%PAGE_SIZE > 0);
				n = 0;
				elem.reset();
			}

			while (++elem) {
				if (elem->IsFinished() || elem->IsSquadron() || elem->IsStatic())
				continue;

				if (ship->GetIFF() == elem->GetIFF() && ship->GetElement() != elem.value()) {
					if (n >= page_offset && n < page_offset+PAGE_SIZE) {
						char text[64];
						sprintf_s(text, "%d. %s", n+1 - page_offset, (const char*) elem->Name());

						if (elem->IsActive()) {
							starship_menu->AddMenu(text, elem_menu, (DWORD) elem.value());
						}
						else {
							strcat_s(text, " ");
							strcat_s(text, Game::GetText("RadioView.item.not-avail").data());
							starship_menu->AddItem(text, 0, false);
						}
					}
					n++;
				}
			}

			if (num_pages > 1) {
				char text[64];
				sprintf_s(text, Game::GetText("RadioView.item.next-page").data(), starship_page + 1, num_pages);
				starship_menu->AddItem(text); 
			}

			return starship_menu;
		}
		else if (s->IsDropship()) {
			return fighter_menu;
		}
	}

	return 0;
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:65,代码来源:RadioView.cpp

示例4:

void
MsnEditNavDlg::Show()
{
	bool need_tab_update = !shown;

	NavDlg::Show();

	if (txt_name && cmb_type) {
		txt_name->SetText("");

		if (cmb_system) {
			cmb_system->ClearItems();

			Galaxy* galaxy = Galaxy::GetInstance();
			ListIter<StarSystem> iter = galaxy->GetSystemList();
			while (++iter) {
				cmb_system->AddItem(iter->Name());
			}
		}

		if (mission) {
			int i;

			txt_name->SetText(mission->Name());
			cmb_type->SetSelection(mission->Type());

			StarSystem* sys = mission->GetStarSystem();
			if (sys && cmb_system && cmb_region) {
				for (i = 0; i < cmb_system->NumItems(); i++) {
					if (!strcmp(cmb_system->GetItem(i), sys->Name())) {
						cmb_system->SetSelection(i);
						break;
					}
				}

				cmb_region->ClearItems();
				int sel_rgn = 0;

				List<OrbitalRegion> regions;
				regions.append(sys->AllRegions());
				regions.sort();

				i = 0;
				ListIter<OrbitalRegion> iter = regions;
				while (++iter) {
					OrbitalRegion* region = iter.value();
					cmb_region->AddItem(region->Name());

					if (!strcmp(mission->GetRegion(), region->Name())) {
						sel_rgn = i;
					}

					i++;
				}

				cmb_region->SetSelection(sel_rgn);
			}
		}
	}

	if (need_tab_update) {
		ShowTab(2);
	}

	exit_latch = true;
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:66,代码来源:MsnEditNavDlg.cpp


注:本文中的ListIter::Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。