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


C++ SystemPath::IsSystemPath方法代码示例

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


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

示例1: UpdateIconSelections

void SystemInfoView::UpdateIconSelections()
{
	m_selectedBodyPath = SystemPath();

	for (auto& bodyIcon : m_bodyIcons) {

		bodyIcon.second->SetSelected(false);

		RefCountedPtr<StarSystem> currentSys = Pi::game->GetSpace()->GetStarSystem();
		if (currentSys && currentSys->GetPath() == m_system->GetPath()) {
			//navtarget can be only set in current system
			if (Body* navtarget = Pi::player->GetNavTarget()) {
				const SystemPath& navpath = navtarget->GetSystemBody()->GetPath();
				if (bodyIcon.first == navpath.bodyIndex) {
					bodyIcon.second->SetSelectColor(Color(0, 255, 0, 255));
					bodyIcon.second->SetSelected(true);
					m_selectedBodyPath = navpath;
				}
			}
		} else {
			SystemPath selected = Pi::sectorView->GetSelected();
			if (selected.IsSameSystem(m_system->GetPath()) && !selected.IsSystemPath()) {
				if (bodyIcon.first == selected.bodyIndex) {
					bodyIcon.second->SetSelectColor(Color(64, 96, 255, 255));
					bodyIcon.second->SetSelected(true);
					m_selectedBodyPath = selected;
				}
			}
		}
	}
}
开发者ID:Wuzzy2,项目名称:pioneer,代码行数:31,代码来源:SystemInfoView.cpp

示例2: GetHyperspaceExitPoint

vector3d Space::GetHyperspaceExitPoint(const SystemPath &source) const
{
    assert(m_starSystem);
    assert(source.IsSystemPath());

    const SystemPath &dest = m_starSystem->GetPath();

    Sector source_sec(source.sectorX, source.sectorY, source.sectorZ);
    Sector dest_sec(dest.sectorX, dest.sectorY, dest.sectorZ);

    Sector::System source_sys = source_sec.m_systems[source.systemIndex];
    Sector::System dest_sys = dest_sec.m_systems[dest.systemIndex];

    const vector3d sourcePos = vector3d(source_sys.p) + vector3d(source.sectorX, source.sectorY, source.sectorZ);
    const vector3d destPos = vector3d(dest_sys.p) + vector3d(dest.sectorX, dest.sectorY, dest.sectorZ);

    // find the first non-gravpoint. should be the primary star
    Body *primary = 0;
    for (BodyIterator i = BodiesBegin(); i != BodiesEnd(); ++i)
        if ((*i)->GetSystemBody()->type != SystemBody::TYPE_GRAVPOINT) {
            primary = *i;
            break;
        }
    assert(primary);

    // point along the line between source and dest, a reasonable distance
    // away based on the radius (don't want to end up inside black holes, and
    // then mix it up so that ships don't end up on top of each other
    vector3d pos = (sourcePos - destPos).Normalized() * (primary->GetSystemBody()->GetRadius()/AU+1.0)*11.0*AU*Pi::rng.Double(0.95,1.2) + MathUtil::RandomPointOnSphere(5.0,20.0)*1000.0;
    assert(pos.Length() > primary->GetSystemBody()->GetRadius());
    return pos + primary->GetPositionRelTo(GetRootFrame());
}
开发者ID:adammead,项目名称:pioneer,代码行数:32,代码来源:Space.cpp

示例3: l_sbodypath_system_only

/*
 * Method: SystemOnly
 *
 * Derive a SystemPath that points to the whole system.
 *
 * > system_path = path:SystemOnly()
 *
 * Return:
 *
 *   system_path - the SystemPath that represents just the system
 *
 * Availability:
 *
 *   alpha 17
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_system_only(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	if (!path->HasValidSystem())
		return luaL_error(l, "SystemPath:SystemOnly() self argument does not refer to a system");
	if (path->IsSystemPath()) { return 1; }
	const SystemPath sysOnly(path->SystemOnly());
	LuaObject<SystemPath>::PushToLua(sysOnly);
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:29,代码来源:LuaSystemPath.cpp

示例4: l_get_hyperspace_target

static int l_get_hyperspace_target(lua_State *l)
{
	LuaObject<Player>::CheckFromLua(1);
	if (Pi::game->IsNormalSpace()) {
		SystemPath sys = Pi::sectorView->GetHyperspaceTarget();
		assert(sys.IsSystemPath());
		LuaSystemPath::PushToLua(&sys);
	} else
		lua_pushnil(l);
	return 1;
}
开发者ID:HeadHunterEG,项目名称:pioneer,代码行数:11,代码来源:LuaPlayer.cpp

示例5: l_set_hyperspace_target

static int l_set_hyperspace_target(lua_State *l)
{
	LuaObject<Player>::CheckFromLua(1);
	if (Pi::game->IsNormalSpace()) {
		const SystemPath sys = *LuaObject<SystemPath>::CheckFromLua(2);
		if (!sys.IsSystemPath())
			return luaL_error(l, "Player:SetHyperspaceTarget() -- second parameter is not a system path");
		Pi::sectorView->SetHyperspaceTarget(sys);
		return 0;
	} else
		return luaL_error(l, "Player:SetHyperspaceTarget() cannot be used while in hyperspace");
}
开发者ID:Faiva78,项目名称:pioneer,代码行数:12,代码来源:LuaPlayer.cpp

示例6: l_get_hyperspace_target

static int l_get_hyperspace_target(lua_State *l)
{
	Player *player = LuaObject<Player>::CheckFromLua(1);
	SystemPath target;
	if (Pi::game->IsNormalSpace())
		target = Pi::sectorView->GetHyperspaceTarget();
	else
		target = player->GetHyperspaceDest();
	assert(target.IsSystemPath());
	LuaObject<SystemPath>::PushToLua(target);
	return 1;
}
开发者ID:Faiva78,项目名称:pioneer,代码行数:12,代码来源:LuaPlayer.cpp

示例7: l_sbodypath_meta_tostring

static int l_sbodypath_meta_tostring(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	if (path->IsSectorPath()) {
		lua_pushfstring(l, "<%d,%d,%d>", path->sectorX, path->sectorY, path->sectorZ);
	} else if (path->IsSystemPath()) {
		lua_pushfstring(l, "<%d,%d,%d : %d>",
			path->sectorX, path->sectorY, path->sectorZ,
			path->systemIndex);
	} else {
		assert(path->IsBodyPath());
		lua_pushfstring(l, "<%d,%d,%d : %d, %d>",
			path->sectorX, path->sectorY, path->sectorZ,
			path->systemIndex, path->bodyIndex);
	}
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:17,代码来源:LuaSystemPath.cpp

示例8: GetHyperspaceExitPoint

vector3d Space::GetHyperspaceExitPoint(const SystemPath &source) const
{
    assert(m_starSystem);
    assert(source.IsSystemPath());

    const SystemPath &dest = m_starSystem->GetPath();

    Sector source_sec(source.sectorX, source.sectorY, source.sectorZ);
    Sector dest_sec(dest.sectorX, dest.sectorY, dest.sectorZ);

    Sector::System source_sys = source_sec.m_systems[source.systemIndex];
    Sector::System dest_sys = dest_sec.m_systems[dest.systemIndex];

    const vector3d sourcePos = vector3d(source_sys.p) + vector3d(source.sectorX, source.sectorY, source.sectorZ);
    const vector3d destPos = vector3d(dest_sys.p) + vector3d(dest.sectorX, dest.sectorY, dest.sectorZ);

    return (sourcePos - destPos).Normalized() * 11.0*AU + MathUtil::RandomPointOnSphere(5.0,20.0)*1000.0; // "hyperspace zone": 11 AU from primary
}
开发者ID:cj31387,项目名称:pioneer,代码行数:18,代码来源:Space.cpp

示例9: GetHyperspaceExitPoint

vector3d Space::GetHyperspaceExitPoint(const SystemPath &source, const SystemPath &dest) const
{
	assert(m_starSystem);
	assert(source.IsSystemPath());

	assert(dest.IsSameSystem(m_starSystem->GetPath()));

	RefCountedPtr<const Sector> source_sec = m_sectorCache->GetCached(source);
	RefCountedPtr<const Sector> dest_sec = m_sectorCache->GetCached(dest);

	Sector::System source_sys = source_sec->m_systems[source.systemIndex];
	Sector::System dest_sys = dest_sec->m_systems[dest.systemIndex];

	const vector3d sourcePos = vector3d(source_sys.GetPosition()) + vector3d(source.sectorX, source.sectorY, source.sectorZ);
	const vector3d destPos = vector3d(dest_sys.GetPosition()) + vector3d(dest.sectorX, dest.sectorY, dest.sectorZ);

	Body *primary = 0;
	if (dest.IsBodyPath()) {
		assert(dest.bodyIndex < m_starSystem->GetNumBodies());
		primary = FindBodyForPath(&dest);
		while (primary && primary->GetSystemBody()->GetSuperType() != SystemBody::SUPERTYPE_STAR) {
			SystemBody* parent = primary->GetSystemBody()->GetParent();
			primary = parent ? FindBodyForPath(&parent->GetPath()) : 0;
		}
	}
	if (!primary) {
		// find the first non-gravpoint. should be the primary star
		for (Body* b : GetBodies())
			if (b->GetSystemBody()->GetType() != SystemBody::TYPE_GRAVPOINT) {
				primary = b;
				break;
			}
	}
	assert(primary);

	// point along the line between source and dest, a reasonable distance
	// away based on the radius (don't want to end up inside black holes, and
	// then mix it up so that ships don't end up on top of each other
	vector3d pos = (sourcePos - destPos).Normalized() * (primary->GetSystemBody()->GetRadius()/AU+1.0)*11.0*AU*Pi::rng.Double(0.95,1.2) + MathUtil::RandomPointOnSphere(5.0,20.0)*1000.0;
	assert(pos.Length() > primary->GetSystemBody()->GetRadius());
	return pos + primary->GetPositionRelTo(GetRootFrame());
}
开发者ID:ZeframCochrane,项目名称:pioneer,代码行数:42,代码来源:Space.cpp

示例10: l_set_hyperspace_target

static int l_set_hyperspace_target(lua_State *l)
{
	LuaObject<Player>::CheckFromLua(1);
	if (Pi::game->IsNormalSpace()) {
		const SystemPath path = *LuaObject<SystemPath>::CheckFromLua(2);
		if (!path.IsSystemPath()) {
			if (!path.IsBodyPath()) {
				return luaL_error(l, "Player:SetHyperspaceTarget() -- second parameter is not a system path or the path of a star");
			}
			RefCountedPtr<StarSystem> sys = Pi::game->GetGalaxy()->GetStarSystem(path);
			// Lua should never be able to get an invalid SystemPath
			// (note: this may change if it becomes possible to remove systems during the game)
			assert(path.bodyIndex < sys->GetNumBodies());
			SystemBody *sbody = sys->GetBodyByPath(path);
			if (!sbody->GetSuperType() == SystemBody::SUPERTYPE_STAR)
				return luaL_error(l, "Player:SetHyperspaceTarget() -- second parameter is not a system path or the path of a star");
		}
		Pi::game->GetSectorView()->SetHyperspaceTarget(path);
		return 0;
	} else
		return luaL_error(l, "Player:SetHyperspaceTarget() cannot be used while in hyperspace");
}
开发者ID:JBourn,项目名称:pioneer,代码行数:22,代码来源:LuaPlayer.cpp

示例11: l_sbodypath_get_system_body

/*
 * Method: GetSystemBody
 *
 * Get a <SystemBody> object for the body that this path points to
 *
 * > body = path:GetSystemBody()
 *
 * Return:
 *
 *   body - the <SystemBody>
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_get_system_body(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);

	if (path->IsSectorPath()) {
		luaL_error(l, "Path <%d,%d,%d> does not name a system or body", path->sectorX, path->sectorY, path->sectorZ);
		return 0;
	}

	RefCountedPtr<StarSystem> sys = Pi::game->GetGalaxy()->GetStarSystem(path);
	if (path->IsSystemPath()) {
		luaL_error(l, "Path <%d,%d,%d : %d ('%s')> does not name a body", path->sectorX, path->sectorY, path->sectorZ, path->systemIndex, sys->GetName().c_str());
		return 0;
	}

	// Lua should never be able to get an invalid SystemPath
	// (note: this may change if it becomes possible to remove systems during the game)
	assert(path->bodyIndex < sys->GetNumBodies());

	SystemBody *sbody = sys->GetBodyByPath(path);
	LuaObject<SystemBody>::PushToLua(sbody);
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:42,代码来源:LuaSystemPath.cpp

示例12: SystemChanged

void SystemInfoView::SystemChanged(const SystemPath &path)
{
	DeleteAllChildren();
	m_tabs = 0;

	if (!path.IsSystemPath())
		return;
	
	m_system = StarSystem::GetCached(path);

	m_sbodyInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100));

	if (m_system->m_unexplored) {
		Add(m_sbodyInfoTab, 0, 0);

		std::string _info =
			Lang::UNEXPLORED_SYSTEM_STAR_INFO_ONLY;

		Gui::Label *l = (new Gui::Label(_info))->Color(1.0f,1.0f,0.0f);
		m_sbodyInfoTab->Add(l, 35, 300);

		ShowAll();
		return;
	}

	m_econInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100));
	Gui::Fixed *demographicsTab = new Gui::Fixed();
	
	m_tabs = new Gui::Tabbed();
	m_tabs->AddPage(new Gui::Label(Lang::PLANETARY_INFO), m_sbodyInfoTab);
	m_tabs->AddPage(new Gui::Label(Lang::ECONOMIC_INFO), m_econInfoTab);
	m_tabs->AddPage(new Gui::Label(Lang::DEMOGRAPHICS), demographicsTab);
	Add(m_tabs, 0, 0);

	m_sbodyInfoTab->onMouseButtonEvent.connect(sigc::mem_fun(this, &SystemInfoView::OnClickBackground));

	m_bodyIcons.clear();
	int majorBodies, starports;
	{
		float pos[2] = { 0, 0 };
		float psize = -1;
		majorBodies = starports = 0;
		PutBodies(m_system->rootBody, m_econInfoTab, 1, pos, majorBodies, starports, psize);

		majorBodies = starports = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->rootBody, m_sbodyInfoTab, 1, pos, majorBodies, starports, psize);

		majorBodies = starports = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->rootBody, demographicsTab, 1, pos, majorBodies, starports, psize);
	}

	std::string _info = stringf(
		Lang::STABLE_SYSTEM_WITH_N_MAJOR_BODIES_STARPORTS,
		formatarg("bodycount", majorBodies),
		formatarg("body(s)", std::string(majorBodies == 1 ? Lang::BODY : Lang::BODIES)),
		formatarg("portcount", starports),
		formatarg("starport(s)", std::string(starports == 1 ? Lang::STARPORT : Lang::COUNT_STARPORTS)));
	_info += "\n\n";
	_info += m_system->GetLongDescription();

	{
		// astronomical body info tab
		m_infoBox = new Gui::VBox();

		Gui::HBox *scrollBox = new Gui::HBox();
		scrollBox->SetSpacing(5);
		m_sbodyInfoTab->Add(scrollBox, 35, 250);

		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(730);
		scroll->SetAdjustment(&portal->vscrollAdjust);

		Gui::Label *l = (new Gui::Label(_info))->Color(1.0f,1.0f,0.0f);
		m_infoBox->PackStart(l);
		portal->Add(m_infoBox);
		scrollBox->PackStart(scroll);
		scrollBox->PackStart(portal);
	}

	{
		// economy tab
		Gui::HBox *scrollBox2 = new Gui::HBox();
		scrollBox2->SetSpacing(5);
		m_econInfoTab->Add(scrollBox2, 35, 300);
		Gui::VScrollBar *scroll2 = new Gui::VScrollBar();
		Gui::VScrollPortal *portal2 = new Gui::VScrollPortal(730);
		scroll2->SetAdjustment(&portal2->vscrollAdjust);
		scrollBox2->PackStart(scroll2);
		scrollBox2->PackStart(portal2);

		m_econInfo = new Gui::Label("");
		m_econInfoTab->Add(m_econInfo, 35, 250);

		Gui::Fixed *f = new Gui::Fixed();
		m_econMajImport = new Gui::Label("");
		m_econMinImport = new Gui::Label("");
//.........这里部分代码省略.........
开发者ID:AaronSenese,项目名称:pioneer,代码行数:101,代码来源:SystemInfoView.cpp

示例13: l_sbodypath_is_system_path

static int l_sbodypath_is_system_path(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	LuaPush(l, path->IsSystemPath());
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:6,代码来源:LuaSystemPath.cpp


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