本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}