/* * 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; }
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(); }