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


C++ StarSystem::AllRegions方法代码示例

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


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

示例1:

void
MsnEditNavDlg::OnSystemSelect(AWEvent* event)
{
	StarSystem* sys = 0;

	if (cmb_system) {
		const char* name = cmb_system->GetSelectedItem();

		Galaxy* galaxy = Galaxy::GetInstance();
		ListIter<StarSystem> iter = galaxy->GetSystemList();
		while (++iter) {
			StarSystem* s = iter.value();

			if (!strcmp(s->Name(), name)) {
				sys = s;
				break;
			}
		}
	}

	if (sys && cmb_region) {
		cmb_region->ClearItems();

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

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

	ScrapeForm();
}
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:36,代码来源:MsnEditNavDlg.cpp

示例2: if

void
MsnElemDlg::Show()
{
	FormWindow::Show();

	if (!elem) return;

	int current_class = 0;

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

		cmb_class->AddItem(Ship::ClassName(Ship::DRONE));
		cmb_class->AddItem(Ship::ClassName(Ship::FIGHTER));
		cmb_class->AddItem(Ship::ClassName(Ship::ATTACK));

		cmb_class->AddItem(Ship::ClassName(Ship::LCA));
		cmb_class->AddItem(Ship::ClassName(Ship::COURIER));
		cmb_class->AddItem(Ship::ClassName(Ship::CARGO));
		cmb_class->AddItem(Ship::ClassName(Ship::CORVETTE));
		cmb_class->AddItem(Ship::ClassName(Ship::FREIGHTER));
		cmb_class->AddItem(Ship::ClassName(Ship::FRIGATE));
		cmb_class->AddItem(Ship::ClassName(Ship::DESTROYER));
		cmb_class->AddItem(Ship::ClassName(Ship::CRUISER));
		cmb_class->AddItem(Ship::ClassName(Ship::BATTLESHIP));
		cmb_class->AddItem(Ship::ClassName(Ship::CARRIER));
		cmb_class->AddItem(Ship::ClassName(Ship::SWACS));
		cmb_class->AddItem(Ship::ClassName(Ship::DREADNAUGHT));
		cmb_class->AddItem(Ship::ClassName(Ship::STATION));
		cmb_class->AddItem(Ship::ClassName(Ship::FARCASTER));

		cmb_class->AddItem(Ship::ClassName(Ship::MINE));
		cmb_class->AddItem(Ship::ClassName(Ship::COMSAT));
		cmb_class->AddItem(Ship::ClassName(Ship::DEFSAT));

		cmb_class->AddItem(Ship::ClassName(Ship::BUILDING));
		cmb_class->AddItem(Ship::ClassName(Ship::FACTORY));
		cmb_class->AddItem(Ship::ClassName(Ship::SAM));
		cmb_class->AddItem(Ship::ClassName(Ship::EWR));
		cmb_class->AddItem(Ship::ClassName(Ship::C3I));
		cmb_class->AddItem(Ship::ClassName(Ship::STARBASE));

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

		for (int i = 0; i < cmb_class->NumItems(); i++) {
			const char* cname   = cmb_class->GetItem(i);
			int         classid = Ship::ClassForName(cname);

			if (design && classid == design->type) {
				cmb_class->SetSelection(i);
				current_class = classid;
				break;
			}
		}
	}

	if (cmb_design) {
		OnClassSelect(0);
		OnDesignSelect(0);
	}

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

		for (int i = Mission::PATROL; i <= Mission::OTHER; i++) {
			cmb_role->AddItem(Mission::RoleName(i));

			if (i == 0)
			cmb_role->SetSelection(0);

			else if (elem->MissionRole() == i)
			cmb_role->SetSelection(cmb_role->NumItems()-1);
		}
	}

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

		if (mission) {
			StarSystem* sys = mission->GetStarSystem();
			if (sys) {
				List<OrbitalRegion> regions;
				regions.append(sys->AllRegions());
				regions.sort();

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

					if (!strcmp(elem->Region(), region->Name()))
					cmb_region->SetSelection(cmb_region->NumItems()-1);
				}
			}
		}
	}

	char buf[64];

	if (edt_name)  edt_name->SetText(elem->Name());
//.........这里部分代码省略.........
开发者ID:lightgemini78,项目名称:Starshatter-Rearmed,代码行数:101,代码来源:MsnElemDlg.cpp


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