本文整理汇总了C++中StarSystem::GetBodyByPath方法的典型用法代码示例。如果您正苦于以下问题:C++ StarSystem::GetBodyByPath方法的具体用法?C++ StarSystem::GetBodyByPath怎么用?C++ StarSystem::GetBodyByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StarSystem
的用法示例。
在下文中一共展示了StarSystem::GetBodyByPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 = LuaSystemPath::GetFromLua(1);
StarSystem *s = StarSystem::GetCached(path);
SBody *sbody = s->GetBodyByPath(path);
LuaSBody::PushToLua(sbody);
s->Release();
return 1;
}
示例2: UpdateInfo
virtual void UpdateInfo() {
const float YSEP = Gui::Screen::GetFontHeight() * 1.5f;
DeleteAllChildren();
Gui::Label *l = new Gui::Label(Lang::MISSIONS);
Add(l, 20, 20);
l = new Gui::Label(Lang::TYPE);
Add(l, 20, 20+YSEP*2);
l = new Gui::Label(Lang::CLIENT);
Add(l, 100, 20+YSEP*2);
l = new Gui::Label(Lang::LOCATION);
Add(l, 260, 20+YSEP*2);
l = new Gui::Label(Lang::DUE);
Add(l, 420, 20+YSEP*2);
l = new Gui::Label(Lang::REWARD);
Add(l, 580, 20+YSEP*2);
l = new Gui::Label(Lang::STATUS);
Add(l, 680, 20+YSEP*2);
ShowChildren();
Gui::VScrollBar *scroll = new Gui::VScrollBar();
Gui::VScrollPortal *portal = new Gui::VScrollPortal(760);
scroll->SetAdjustment(&portal->vscrollAdjust);
const std::list<const Mission*> &missions = Pi::player->missions.GetAll();
Gui::Fixed *innerbox = new Gui::Fixed(760, YSEP*3 * missions.size());
float ypos = 0;
for (std::list<const Mission*>::const_iterator i = missions.begin(); i != missions.end(); ++i) {
SystemPath path = (*i)->location;
StarSystem *s = StarSystem::GetCached(path);
SBody *sbody = s->GetBodyByPath(&path);
l = new Gui::Label((*i)->type);
innerbox->Add(l, 0, ypos);
l = new Gui::Label((*i)->client);
innerbox->Add(l, 80, ypos);
l = new Gui::Label(stringf("%0,\n%1 [%2{d},%3{d},%4{d}]", sbody->name.c_str(), s->GetName().c_str(), path.sectorX, path.sectorY, path.sectorZ));
innerbox->Add(l, 240, ypos);
l = new Gui::Label(format_date((*i)->due));
innerbox->Add(l, 400, ypos);
l = new Gui::Label(format_money((*i)->reward));
innerbox->Add(l, 560, ypos);
switch ((*i)->status) {
case Mission::FAILED: l = new Gui::Label(std::string("#f00")+std::string(Lang::FAILED)); break;
case Mission::COMPLETED: l = new Gui::Label(std::string("#ff0")+std::string(Lang::COMPLETED)); break;
default:
case Mission::ACTIVE: l = new Gui::Label(std::string("#0f0")+std::string(Lang::ACTIVE)); break;
}
innerbox->Add(l, 660, ypos);
ypos += YSEP*3;
}
Add(portal, 20, 20 + YSEP*3);
Add(scroll, 780, 20 + YSEP*3);
scroll->ShowAll();
portal->Add(innerbox);
portal->ShowAll();
}