Another one

Post Reply
bmaxa
Posts: 10
Joined: Sat May 31, 2014 2:12 pm

Another one

Post by bmaxa »

In SystemInfoView there should be check if navTarget has SystemBody, because if nav target
is hyperspace cloud it does not. Bug can be triggered if ship hyperspaces and there
is cloud analyzer so nav target becames cloud or as I have added clouds to
navtarget list ;)

Code: Select all

diff --git a/src/SystemInfoView.cpp b/src/SystemInfoView.cpp
index 5b67e4d..467ca6e 100644
--- a/src/SystemInfoView.cpp
+++ b/src/SystemInfoView.cpp
@@ -481,15 +481,19 @@ SystemInfoView::RefreshType SystemInfoView::NeedsRefresh()
                        return REFRESH_SELECTED;
        } else {
                Body *navTarget = Pi::player->GetNavTarget();
-               if (navTarget && navTarget->GetSystemBody()->GetType() != SystemBody::TYPE_STARPORT_SURFACE) {
+               if(navTarget)
+               {
+               const SystemBody* sb = navTarget->GetSystemBody();
+               if (sb && sb->GetType() != SystemBody::TYPE_STARPORT_SURFACE) {
                        // Navigation target is something we show in the info view
-                       if (navTarget->GetSystemBody()->GetPath() != m_selectedBodyPath)
+                       if (sb->GetPath() != m_selectedBodyPath)
                                return REFRESH_SELECTED; // and wasn't selected, yet
                } else {
                        // nothing to be selected
                        if (m_selectedBodyPath.IsBodyPath())
                                return REFRESH_SELECTED; // but there was something selected
                }
+               }
        }
 
        return REFRESH_NONE;
@@ -542,12 +546,15 @@ void SystemInfoView::UpdateIconSelections()
                if (currentSys && currentSys->GetPath() == m_system->GetPath()) {
                        //navtarget can be only set in current system
                        if (Body* navtarget = Pi::player->GetNavTarget()) {
-                               const SystemPath& navpath = navtarget->GetSystemBody()->GetPath();
+                               if (const SystemBody* sb = navtarget->GetSystemBody())
+                               {
+                               const SystemPath& navpath = sb->GetPath();
                                if (bodyIcon.first == navpath.bodyIndex) {
                                        bodyIcon.second->SetSelectColor(Color(0, 255, 0, 255));
                                        bodyIcon.second->SetSelected(true);
                                        m_selectedBodyPath = navpath;
                                }
+                               }
                        }
                } else {
                        SystemPath selected = Pi::sectorView->GetSelected();
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Another one

Post by FluffyFreak »

The best thing to do with these, and we do appreciate them, is to submit pull requests for them on GitHub so that we can test them, give feedback and eventually include them in the game :)
bmaxa
Posts: 10
Joined: Sat May 31, 2014 2:12 pm

Re: Another one

Post by bmaxa »

Ok, will do ;)
Consider pull requests what do you think? Do I request first bug fixes first, then features eg enhanced nav targets list and price difference
in economy view?
impaktor
Posts: 1008
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Another one

Post by impaktor »

Yes, seperate bug-fixes from features.

All bug-fixes should be accepted (provided they do what they should).

However, new features might not go in a desirable direction for the game. (For instance showing the base price multiplicative factor in the system view, as you mentioned elsewhere. I think this exposes too much of how the code works to the player.)
bmaxa
Posts: 10
Joined: Sat May 31, 2014 2:12 pm

Re: Another one

Post by bmaxa »

Bugs only show up with features enables. All these are 10 minute changes, it is more fuss to me to make pull request, so never mind ;)
Post Reply