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


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

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


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

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

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

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

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

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

示例6: l_sbodypath_is_sector_path

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


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