]> git.mxchange.org Git - flightgear.git/commitdiff
Fix the crashes on mini-panel and panel-reload with the KLN89, by removing the multip...
authordaveluff <daveluff>
Fri, 13 Jan 2006 22:07:50 +0000 (22:07 +0000)
committerdaveluff <daveluff>
Fri, 13 Jan 2006 22:07:50 +0000 (22:07 +0000)
src/Cockpit/panel.cxx
src/Cockpit/panel.hxx
src/Cockpit/panel_io.cxx
src/Instrumentation/KLN89/kln89.cxx
src/Instrumentation/KLN89/kln89_page_apt.cxx
src/Instrumentation/KLN89/kln89_page_nav.cxx
src/Instrumentation/dclgps.cxx
src/Instrumentation/dclgps.hxx

index d59c06f5101c4202bc7e8c83e10c49916f733bac..35cff0df1720416e91bcd4b922abb7e445c19372 100644 (file)
@@ -825,6 +825,28 @@ FGLayeredInstrument::addTransformation (FGPanelTransformation * transformation)
 }
 
 
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGSpecialInstrument.
+////////////////////////////////////////////////////////////////////////
+
+FGSpecialInstrument::FGSpecialInstrument (DCLGPS* sb)
+  : FGPanelInstrument()
+{
+  complex = sb;
+}
+
+FGSpecialInstrument::~FGSpecialInstrument ()
+{
+}
+
+void
+FGSpecialInstrument::draw ()
+{
+  complex->draw();
+}
+
+
 \f
 ////////////////////////////////////////////////////////////////////////
 // Implementation of FGInstrumentLayer.
index 22169810611bc24ebcb4497209a8a24106ea9754..f4dbd7eb294a500475bf9969596f8139ca1f858c 100644 (file)
@@ -48,6 +48,7 @@
 
 #include <Main/fg_props.hxx>
 #include <Input/input.hxx>
+#include <Instrumentation/dclgps.hxx>
 
 SG_USING_STD(vector);
 SG_USING_STD(map);
@@ -428,6 +429,28 @@ protected:
 };
 
 
+/**
+ * An empty-shell instrument that exists soley in
+ * order to redirect commands from the panel to a
+ * complex instrument inherited from SGSubsystem.
+ *
+ * Currently the only complex instrument is the KLN89,
+ * which we've hardwired this to for now.
+ */
+class FGSpecialInstrument : public FGPanelInstrument
+{
+public:
+  FGSpecialInstrument(DCLGPS* sb);
+  //FGSpecialInstrument (int x, int y, int w, int h);
+  virtual ~FGSpecialInstrument ();
+
+  virtual void draw ();
+  
+protected:
+  DCLGPS* complex;
+};
+
+
 /**
  * An instrument layer containing a group of sublayers.
  *
index 375630652e9ba65c98b27489ebce12417d076a2d..a8ae3f8828671afba0b13098dd3814674eb93604 100644 (file)
@@ -787,11 +787,14 @@ readPanel (const SGPropertyNode * root)
           
           // Warning - hardwired size!!!
           RenderArea2D* instrument = new RenderArea2D(158, 40, 158, 40, x, y);
-          // FIXME: shift-F3 (panel reload) kill's us here due to duplicate subsystem!
-          KLN89* gps = new KLN89(instrument);
-          panel->addInstrument(gps);
-          globals->add_subsystem("kln89", gps);
-          //gps->init();  // init seems to get called automagically.
+          KLN89* gps = (KLN89*)globals->get_subsystem("kln89");
+                 if(gps == NULL) {
+                         gps = new KLN89(instrument);
+                         globals->add_subsystem("kln89", gps);
+                 }
+                 //gps->init();  // init seems to get called automagically.
+                 FGSpecialInstrument* gpsinst = new FGSpecialInstrument(gps);
+          panel->addInstrument(gpsinst);
         } else {
           SG_LOG( SG_COCKPIT, SG_WARN, "Unknown special instrument found" );
         }
index 78a817f9e09d5c79c0c871464507d7cf2be3caa5..b491bcc3170acf7a2f973e3e733225c9be3cfbbf 100644 (file)
@@ -44,6 +44,7 @@
 #include <iostream>
 
 #include <ATC/ATCProjection.hxx>
+#include <Main/fg_props.hxx>
 #include <simgear/math/point3d.hxx>
 
 SG_USING_STD(cout);
index db283003e77082a5e8d34a9055b285dd0970cd66..1ea7022b00bca24f1f50e500ec9619923a08a459 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "kln89_page_apt.hxx"
 #include <ATC/commlist.hxx>
+#include <Main/globals.hxx>
 
 // This function is copied from Airports/runways.cxx
 // TODO - Make the original properly available and remove this instance!!!!
index 5074376c129cb181614f23108e003e9b820bf689..968c3bb4c31344a78e4d010ecbdc716d9cb36cca 100644 (file)
@@ -22,6 +22,7 @@
 // $Id$
 
 #include "kln89_page_nav.hxx"
+#include <Main/fg_props.hxx>
 
 KLN89NavPage::KLN89NavPage(KLN89* parent) 
 : KLN89Page(parent) {
index b78806b288732646e89bd6d6da9d7cf81d9e4680..d4084136f9a318a6359e7c9cc44b4f7efbd6926b 100644 (file)
@@ -26,6 +26,8 @@
 #include "dclgps.hxx"
 
 #include <simgear/sg_inlines.h>
+#include <simgear/structure/commands.hxx>
+#include <Main/fg_props.hxx>
 #include <iostream>
 SG_USING_STD(cout);
 
index 442105df8e0d357153380ba31af4a3c159ba02fa..3dce50401015ac2ff8e5ca49c147fdb191f7a888 100644 (file)
@@ -32,8 +32,6 @@
 #include <vector>
 #include <map>
 
-#include <Cockpit/panel.hxx>
-
 #include <Navaids/navrecord.hxx>
 #include <Navaids/navlist.hxx>
 #include <Navaids/fixlist.hxx>
@@ -203,7 +201,7 @@ typedef vector<GPSPage*> gps_page_list_type;
 typedef gps_page_list_type::iterator gps_page_list_itr;
 
 // TODO - merge generic GPS functions instead and split out KLN specific stuff.
-class DCLGPS : public SGSubsystem, public FGPanelInstrument {
+class DCLGPS : public SGSubsystem {
        
        friend class GPSPage;