本文整理汇总了C++中StarSystem::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ StarSystem::GetName方法的具体用法?C++ StarSystem::GetName怎么用?C++ StarSystem::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StarSystem
的用法示例。
在下文中一共展示了StarSystem::GetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_starsystem_attr_name
/*
* Attribute: name
*
* The name of the system. This is usually the same as the name of the primary
* star.
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_starsystem_attr_name(lua_State *l)
{
PROFILE_SCOPED()
StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
lua_pushstring(l, s->GetName().c_str());
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();
}
示例3: l_starsystem_export_to_lua
/*
* Method: ExportToLua
*
* Export of generated system for personal interest, customisation, etc
*
* Availability:
*
* alpha 33
*
* Status:
*
* experimental
*/
static int l_starsystem_export_to_lua(lua_State *l)
{
PROFILE_SCOPED()
LUA_DEBUG_START(l);
StarSystem *s = LuaObject<StarSystem>::CheckFromLua(1);
static const std::string EXPORTED_SYSTEMS_DIR_NAME("exported_systems");
if (!FileSystem::userFiles.MakeDirectory(EXPORTED_SYSTEMS_DIR_NAME)) {
throw CouldNotOpenFileException();
}
// construct the filename with folder and extension
try {
const std::string filename(EXPORTED_SYSTEMS_DIR_NAME + "/" + FileSystem::SanitiseFileName(s->GetName()) + ".lua");
const std::string finalPath = FileSystem::NormalisePath(
FileSystem::JoinPathBelow(FileSystem::GetUserDir(), filename));
s->ExportToLua(finalPath.c_str());
} catch (std::invalid_argument &) {
return luaL_error(l, "could not export system -- name forms an invalid path");
}
LUA_DEBUG_END(l, 0);
return 0;
}
示例4: l_starsystem_attr_name
/*
* Attribute: name
*
* The name of the system. This is usually the same as the name of the primary
* star.
*
* Availability:
*
* alpha 10
*
* Status:
*
* stable
*/
static int l_starsystem_attr_name(lua_State *l)
{
StarSystem *s = LuaStarSystem::CheckFromLua(1);
lua_pushstring(l, s->GetName().c_str());
return 1;
}