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


C++ SystemPath类代码示例

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


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

示例1: 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);
	const SystemPath sysOnly(path->SystemOnly());
	LuaObject<SystemPath>::PushToLua(sysOnly);
	return 1;
}
开发者ID:Luomu,项目名称:pioneer,代码行数:26,代码来源:LuaSystemPath.cpp

示例2: SystemPath

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

示例3: l_sbodypath_sector_only

/*
 * Method: SectorOnly
 *
 * Derive a SystemPath that points to the whole sector.
 *
 * > sector_path = path:SectorOnly()
 *
 * Return:
 *
 *   sector_path - the SystemPath that represents just the sector
 *
 * Availability:
 *
 *   alpha 17
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_sector_only(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	if (path->IsSectorPath()) { return 1; }
	LuaObject<SystemPath>::PushToLua(path->SectorOnly());
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:26,代码来源:LuaSystemPath.cpp

示例4: l_sbodypath_is_same_sector

/*
 * Method: IsSameSector
 *
 * Determine if two <SystemPath> objects point to objects in the same sector.
 *
 * > is_same = path:IsSameSector(otherpath)
 *
 * Parameters:
 *
 *   otherpath - the <SystemPath> to compare with this path
 *
 * Return:
 *
 *   is_same - true if the path's point to the same sector, false otherwise
 *
 * Availability:
 *
 *   alpha 17
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_is_same_sector(lua_State *l)
{
	SystemPath *a = LuaObject<SystemPath>::CheckFromLua(1);
	SystemPath *b = LuaObject<SystemPath>::CheckFromLua(2);

	lua_pushboolean(l, a->IsSameSector(b));
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:31,代码来源:LuaSystemPath.cpp

示例5: l_sbodypath_is_same_system

/*
 * Method: IsSameSystem
 *
 * Determine if two <SystemPath> objects point to objects in the same system.
 *
 * > is_same = path:IsSameSystem(otherpath)
 *
 * Parameters:
 *
 *   otherpath - the <SystemPath> to compare with this path
 *
 * Return:
 *
 *   is_same - true if the path's point to the same system, false otherwise
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_is_same_system(lua_State *l)
{
	SystemPath *a = LuaSystemPath::CheckFromLua(1);
	SystemPath *b = LuaSystemPath::CheckFromLua(2);

	lua_pushboolean(l, a->IsSameSystem(b));
	return 1;
}
开发者ID:karakalo,项目名称:pioneer,代码行数:31,代码来源:LuaSystemPath.cpp

示例6: l_sbodypath_attr_body_index

/*
 * Attribute: bodyIndex
 *
 * The body index component of the path, or nil if the SystemPath does
 * not point to a body.
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_attr_body_index(lua_State *l)
{
	SystemPath *path = LuaSystemPath::CheckFromLua(1);
	if (path->IsBodyPath())
		lua_pushinteger(l, path->bodyIndex);
	else
		lua_pushnil(l);
	return 1;
}
开发者ID:karakalo,项目名称:pioneer,代码行数:23,代码来源:LuaSystemPath.cpp

示例7: l_sbodypath_attr_system_index

/*
 * Attribute: systemIndex
 *
 * The system index component of the path, or nil if the SystemPath does
 * not point to a system.
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_attr_system_index(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	if (!path->IsSectorPath())
		lua_pushinteger(l, path->systemIndex);
	else
		lua_pushnil(l);
	return 1;
}
开发者ID:Luomu,项目名称:pioneer,代码行数:23,代码来源:LuaSystemPath.cpp

示例8: l_sbodypath_attr_body_index

/*
 * Attribute: bodyIndex
 *
 * The body index component of the path, or nil if the SystemPath does
 * not point to a body.
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_attr_body_index(lua_State *l)
{
	SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1);
	if (path->HasValidBody())
		lua_pushinteger(l, path->bodyIndex);
	else
		lua_pushnil(l);
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:23,代码来源:LuaSystemPath.cpp

示例9: 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

示例10: 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

示例11: distance_to_system

static float distance_to_system(const SystemPath &dest)
{
	SystemPath here = Pi::game->GetSpace()->GetStarSystem()->GetPath();
	assert(here.HasValidSystem());
	assert(dest.HasValidSystem());

	Sector sec1(here.sectorX, here.sectorY, here.sectorZ);
	Sector sec2(dest.sectorX, dest.sectorY, dest.sectorZ);

	return Sector::DistanceBetween(&sec1, here.systemIndex, &sec2, dest.systemIndex);
}
开发者ID:HeadHunterEG,项目名称:pioneer,代码行数:11,代码来源:Ship.cpp

示例12: 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

示例13: 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

示例14: l_sbodypath_get_star_system

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

	if (path->IsSectorPath())
		return luaL_error(l, "SystemPath:GetStarSystem() self argument does not refer to a system");

	RefCountedPtr<StarSystem> s = Pi::game->GetGalaxy()->GetStarSystem(path);
	// LuaObject<StarSystem> shares ownership of the StarSystem,
	// because LuaAcquirer<LuaObject<StarSystem>> uses IncRefCount and DecRefCount
	LuaObject<StarSystem>::PushToLua(s.Get());
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:32,代码来源:LuaSystemPath.cpp

示例15: l_sbodypath_is_same_system

/*
 * Method: IsSameSystem
 *
 * Determine if two <SystemPath> objects point to objects in the same system.
 *
 * > is_same = path:IsSameSystem(otherpath)
 *
 * Parameters:
 *
 *   otherpath - the <SystemPath> to compare with this path
 *
 * Return:
 *
 *   is_same - true if the path's point to the same system, false otherwise
 *
 * Availability:
 *
 *   alpha 10
 *
 * Status:
 *
 *   stable
 */
static int l_sbodypath_is_same_system(lua_State *l)
{
	SystemPath *a = LuaObject<SystemPath>::CheckFromLua(1);
	SystemPath *b = LuaObject<SystemPath>::CheckFromLua(2);

	if (!a->HasValidSystem())
		return luaL_error(l, "SystemPath:IsSameSystem() self argument does not refer to a system");
	if (!b->HasValidSystem())
		return luaL_error(l, "SystemPath:IsSameSystem() argument #1 does not refer to a system");

	lua_pushboolean(l, a->IsSameSystem(b));
	return 1;
}
开发者ID:nozmajner,项目名称:pioneer,代码行数:36,代码来源:LuaSystemPath.cpp


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