Merge branch 'consistent_set_nav_target_click'
commit
4644d139d8
|
@ -6,6 +6,9 @@ August 2014
|
|||
* Display ship heading and pitch (#3108)
|
||||
* Advanced radar mapper works in system orbital view (#3122)
|
||||
|
||||
* Minor changes and tweaks
|
||||
* Consistent set nav target on click in SystemView (#3125)
|
||||
|
||||
* Script and UI API changes
|
||||
* Ship:UseECM() returns recharge time and success state.
|
||||
|
||||
|
|
|
@ -351,12 +351,20 @@ void SystemView::OnClickObject(const SystemBody *b)
|
|||
m_infoLabel->SetText(desc);
|
||||
m_infoText->SetText(data);
|
||||
|
||||
if (Pi::KeyState(SDLK_LSHIFT) || Pi::KeyState(SDLK_RSHIFT)) {
|
||||
SystemPath path = m_system->GetPathOf(b);
|
||||
if (Pi::game->GetSpace()->GetStarSystem()->GetPath() == m_system->GetPath()) {
|
||||
Body* body = Pi::game->GetSpace()->FindBodyForPath(&path);
|
||||
if (body != 0)
|
||||
// click on object (in same system) sets/unsets it as nav target
|
||||
SystemPath path = m_system->GetPathOf(b);
|
||||
if (Pi::game->GetSpace()->GetStarSystem()->GetPath() == m_system->GetPath()) {
|
||||
Body* body = Pi::game->GetSpace()->FindBodyForPath(&path);
|
||||
if (body != 0) {
|
||||
if(Pi::player->GetNavTarget() == body) {
|
||||
Pi::player->SetNavTarget(body);
|
||||
Pi::player->SetNavTarget(0);
|
||||
Pi::game->log->Add(Lang::UNSET_NAVTARGET);
|
||||
}
|
||||
else {
|
||||
Pi::player->SetNavTarget(body);
|
||||
Pi::game->log->Add(Lang::SET_NAVTARGET_TO + body->GetLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,13 +387,13 @@ void SystemView::LabelShip(Ship *s, const vector3d &offset) {
|
|||
|
||||
vector3d pos;
|
||||
if (Gui::Screen::Project(offset, pos)) {
|
||||
m_shipLabels->Add(s->GetLabel(), sigc::bind(sigc::mem_fun(this, &SystemView::OnClickShipLabel), s), pos.x, pos.y);
|
||||
m_shipLabels->Add(s->GetLabel(), sigc::bind(sigc::mem_fun(this, &SystemView::OnClickShip), s), pos.x, pos.y);
|
||||
}
|
||||
|
||||
Gui::Screen::LeaveOrtho();
|
||||
}
|
||||
|
||||
void SystemView::OnClickShipLabel(Ship *s) {
|
||||
void SystemView::OnClickShip(Ship *s) {
|
||||
if(!s) { printf("clicked on ship label but ship wasn't there\n"); return; }
|
||||
if(Pi::player->GetNavTarget() == s) { //un-select ship if already selected
|
||||
Pi::player->SetNavTarget(0); // remove current
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
void RefreshShips(void);
|
||||
void DrawShips(const double t, const vector3d &offset);
|
||||
void LabelShip(Ship *s, const vector3d &offset);
|
||||
void OnClickShipLabel(Ship *s);
|
||||
void OnClickShip(Ship *s);
|
||||
|
||||
RefCountedPtr<StarSystem> m_system;
|
||||
const SystemBody *m_selectedObject;
|
||||
|
|
Loading…
Reference in New Issue