1
0
Fork 0

Avoid view-manager returning default SGGeod

- when switching views, force an update() to ensure view position
  is valid. Otherwise various subsystems such as AI traffic and the
  tile manager see a request for a 0,0 location.

- when switching to model view, we still generate a 0,0
  location initially - to be fixed.
This commit is contained in:
James Turner 2015-12-30 14:27:54 -06:00
parent 335fda719d
commit 9e4e6a6fbf
2 changed files with 15 additions and 1 deletions

View file

@ -139,6 +139,14 @@ FGViewMgr::init ()
do_bind();
}
void
FGViewMgr::postinit()
{
// force update now so many properties of the current view are valid,
// eg view position and orientation (as exposed via globals)
update(0.0);
}
void
FGViewMgr::shutdown()
{
@ -732,6 +740,11 @@ FGViewMgr::setView (int newview)
current = newview;
// copy in view data
copyToCurrent();
// force an update now, to avoid returning bogus data.
// real fix would to be make all the accessors use the dirty mechanism
// on FGViewer, so update() is a no-op.
update(0.0);
}

View file

@ -49,6 +49,7 @@ public:
~FGViewMgr( void );
virtual void init ();
virtual void postinit();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
@ -73,7 +74,7 @@ public:
void add_view( FGViewer * v );
static const char* subsystemName() { return "view-mgr"; }
static const char* subsystemName() { return "view-manager"; }
private:
void do_bind();