本文整理汇总了C++中Body::GetSBody方法的典型用法代码示例。如果您正苦于以下问题:C++ Body::GetSBody方法的具体用法?C++ Body::GetSBody怎么用?C++ Body::GetSBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body::GetSBody方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnChangeTerrain
void ObjectViewerView::OnChangeTerrain()
{
const fixed volatileGas = fixed(65536.0*atof(m_sbodyVolatileGas->GetText().c_str()), 65536);
const fixed volatileLiquid = fixed(65536.0*atof(m_sbodyVolatileLiquid->GetText().c_str()), 65536);
const fixed volatileIces = fixed(65536.0*atof(m_sbodyVolatileIces->GetText().c_str()), 65536);
const fixed life = fixed(65536.0*atof(m_sbodyLife->GetText().c_str()), 65536);
const fixed volcanicity = fixed(65536.0*atof(m_sbodyVolcanicity->GetText().c_str()), 65536);
const fixed metallicity = fixed(65536.0*atof(m_sbodyMetallicity->GetText().c_str()), 65536);
const fixed mass = fixed(65536.0*atof(m_sbodyMass->GetText().c_str()), 65536);
const fixed radius = fixed(65536.0*atof(m_sbodyRadius->GetText().c_str()), 65536);
// XXX this is horrendous, but probably safe for the moment. all bodies,
// terrain, whatever else holds a const pointer to the same toplevel
// sbody. one day objectviewer should be far more contained and not
// actually modify the space
Body *body = Pi::player->GetNavTarget();
SBody *sbody = const_cast<SBody*>(body->GetSBody());
sbody->seed = atoi(m_sbodySeed->GetText().c_str());
sbody->radius = radius;
sbody->mass = mass;
sbody->m_metallicity = metallicity;
sbody->m_volatileGas = volatileGas;
sbody->m_volatileLiquid = volatileLiquid;
sbody->m_volatileIces = volatileIces;
sbody->m_volcanicity = volcanicity;
sbody->m_life = life;
// force reload
if (body->IsType(Object::TERRAINBODY))
static_cast<TerrainBody*>(body)->GetGeoSphere()->OnChangeDetailLevel();
}
示例2: l_body_attr_seed
/*
* Attribute: seed
*
* The random seed used to generate this <Body>. This is guaranteed to be the
* same for this body across runs of the same build of the game, and should be
* used to seed a <Rand> object when you want to ensure the same random
* numbers come out each time.
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_body_attr_seed(lua_State *l)
{
Body *b = LuaBody::GetFromLua(1);
const SBody *sbody = b->GetSBody();
assert(sbody);
lua_pushinteger(l, sbody->seed);
return 1;
}
示例3: l_body_attr_super_type
/*
* Attribute: superType
*
* The supertype of the body, as a <Constants.BodySuperType> constant
*
* Only valid for non-dynamic <Bodies>. For dynamic bodies <superType> will be nil.
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_body_attr_super_type(lua_State *l)
{
Body *b = LuaBody::GetFromLua(1);
const SBody *sbody = b->GetSBody();
if (!sbody) {
lua_pushnil(l);
return 1;
}
lua_pushstring(l, LuaConstants::GetConstantString(l, "BodySuperType", sbody->GetSuperType()));
return 1;
}
示例4: l_body_attr_path
/*
* Attribute: path
*
* The <SystemPath> that points to this body.
*
* If the body is a dynamic body it has no persistent path data, and its
* <path> value will be nil.
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_body_attr_path(lua_State *l)
{
Body *b = LuaBody::GetFromLua(1);
const SBody *sbody = b->GetSBody();
if (!sbody) {
lua_pushnil(l);
return 1;
}
SystemPath path = Pi::currentSystem->GetPath();
path.bodyIndex = sbody->id;
LuaSystemPath::PushToLua(&path);
return 1;
}