]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Wed, 12 Oct 2005 08:55:58 +0000 (08:55 +0000)
committerehofman <ehofman>
Wed, 12 Oct 2005 08:55:58 +0000 (08:55 +0000)
I stumbled across two memory errors with two wrong const references to
std::string.

As I fixed that, I also moved aircraft_dir which is only used from UIUC into
UIUC. With that uiuc_aircraftdir.h is empty and can be removed.

src/FDM/UIUCModel/Makefile.am
src/FDM/UIUCModel/uiuc_aircraftdir.h
src/FDM/UIUCModel/uiuc_wrapper.cpp
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/main.cxx
src/Main/options.cxx

index 56ccf9a854399fd722ec6466e7ddf8481de877cf..7ac5a00bb917dfb2712a81cba14d60c4bc2954ad 100644 (file)
@@ -9,7 +9,7 @@ libUIUCModel_a_SOURCES = \
                         uiuc_2Dinterpolation.cpp uiuc_2Dinterpolation.h \
                        uiuc_3Dinterpolation.cpp uiuc_3Dinterpolation.h \
                         uiuc_aerodeflections.cpp uiuc_aerodeflections.h \
-                       uiuc_aircraftdir.h uiuc_aircraft.h \
+                       uiuc_aircraft.h \
                        uiuc_alh_ap.cpp uiuc_alh_ap.h \
                        uiuc_auto_pilot.cpp uiuc_auto_pilot.h \
                         uiuc_betaprobe.cpp uiuc_betaprobe.h \
index 9432838daf7d0ad51fb36dc164f6cb4a40dd92bc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,80 +0,0 @@
-/**********************************************************************
-
- FILENAME:     uiuc_aircraftdir.h
-
-----------------------------------------------------------------------
-
- DESCRIPTION: Stores the name of the aircraft directory to be used
-
-----------------------------------------------------------------------
-
- STATUS:       alpha version
-
-----------------------------------------------------------------------
-
- REFERENCES:   
-
-----------------------------------------------------------------------
-
- HISTORY:      02/22/2000    initial release
-
-----------------------------------------------------------------------
-
- AUTHOR(S):    Bipin Sehgal       <bsehgal@uiuc.edu>
-
-----------------------------------------------------------------------
-
- VARIABLES:
-
-----------------------------------------------------------------------
-
- INPUTS:       *
-
-----------------------------------------------------------------------
-
- OUTPUTS:      *
-
-----------------------------------------------------------------------
-
- CALLED BY:    *
-
-----------------------------------------------------------------------
-
- CALLS TO:     *
-
-----------------------------------------------------------------------
-
- COPYRIGHT:    (C) 2000 by Michael Selig
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA or view http://www.gnu.org/copyleft/gpl.html.
-
-**********************************************************************/
-
-
-#ifndef _AIRCRAFTDIR_H_
-#define _AIRCRAFTDIR_H_
-
-#include <string>
-
-typedef struct 
-{
-    string aircraft_dir;
-    #define aircraft_dir aircraftdir_->aircraft_dir
-  
-} AIRCRAFTDIR;
-
-extern AIRCRAFTDIR *aircraftdir_;    // usually defined in the first program that includes uiuc_aircraft.h
-
-#endif  // endif _AIRCRAFTDIR_H
index 06be6b61b7c1db03c59317a30b140a8f2fb42ef0..a2e57c7ff0b8b0c216e608694628bf719cf70f8c 100644 (file)
@@ -89,7 +89,6 @@
 #include <Main/fg_props.hxx>
 
 #include "uiuc_aircraft.h"
-#include "uiuc_aircraftdir.h"
 #include "uiuc_coefficients.h"
 #include "uiuc_getwind.h"
 #include "uiuc_engine.h"
@@ -120,7 +119,6 @@ extern "C" void uiuc_network_recv_routine();
 extern "C" void uiuc_network_send_routine();
 
 AIRCRAFT *aircraft_ = new AIRCRAFT;
-AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR;
 
 // SendArray testarray(4950);
 
@@ -321,7 +319,7 @@ void uiuc_init_aeromodel ()
   // Initializes the UIUC aircraft model.
   // Called once from uiuc_init_2_wrapper
   SGPath path(globals->get_fg_root());
-  path.append(aircraft_dir);
+  path.append(fgGetString("/sim/aircraft-dir"));
   path.append("aircraft.dat");
   cout << "We are using "<< path.str() << endl;
   uiuc_initializemaps(); // Initialize the <string,int> maps
index 8cf6a435d086a264697f622ea922f83d2dd8605c..17ee5c5251700dfb30df48533809399b7c9190f4 100644 (file)
@@ -64,7 +64,6 @@
 #include <simgear/timing/lowleveltime.h>
 
 #include <Aircraft/aircraft.hxx>
-#include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #include <Airports/apt_loader.hxx>
 #include <Airports/runways.hxx>
 #include <Airports/simple.hxx>
@@ -1304,8 +1303,7 @@ void fgInitFDM() {
     }
 
     double dt = 1.0 / fgGetInt("/sim/model-hz");
-    aircraft_dir = fgGetString("/sim/aircraft-dir");
-    const string &model = fgGetString("/sim/flight-model");
+    string model = fgGetString("/sim/flight-model");
 
     try {
         if ( model == "larcsim" ) {
@@ -1466,7 +1464,7 @@ void fgInitTimeOffset() {
 
     // Okay, we now have several possible scenarios
     int offset = fgGetInt("/sim/startup/time-offset");
-    const string &offset_type = fgGetString("/sim/startup/time-offset-type");
+    string offset_type = fgGetString("/sim/startup/time-offset-type");
 
     int warp = 0;
     if ( offset_type == "real" ) {
index 8c603096eb7e6798823f1644e9f56b4e7221f23a..0a78154f99adf7be8b4afb78a5af3f4f20e6303c 100644 (file)
@@ -36,7 +36,6 @@
 #include <ATC/ATCdisplay.hxx>
 #include <Aircraft/aircraft.hxx>
 #include <Time/tmp.hxx>
-#include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #include <Environment/environment.hxx>
 
 #include <GUI/gui.h>
@@ -238,26 +237,6 @@ setFreeze (bool f)
 }
 
 
-/**
- * Return the current aircraft directory (UIUC) as a string.
- */
-static const char *
-getAircraftDir ()
-{
-  return aircraft_dir.c_str();
-}
-
-
-/**
- * Set the current aircraft directory (UIUC).
- */
-static void
-setAircraftDir (const char * dir)
-{
-  aircraft_dir = dir;
-}
-
-
 /**
  * Return the number of milliseconds elapsed since simulation started.
  */
@@ -477,7 +456,6 @@ FGProperties::bind ()
   fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
   fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
   fgTie("/sim/freeze/master", getFreeze, setFreeze);
-  fgTie("/sim/aircraft-dir", getAircraftDir, setAircraftDir);
 
   fgTie("/sim/time/elapsed-sec", getElapsedTime_sec);
   fgTie("/sim/time/gmt", getDateString, setDateString);
@@ -506,7 +484,6 @@ FGProperties::unbind ()
   fgUntie("/sim/logging/priority");
   fgUntie("/sim/logging/classes");
   fgUntie("/sim/freeze/master");
-  fgUntie("/sim/aircraft-dir");
 
   fgUntie("/sim/time/elapsed-sec");
   fgUntie("/sim/time/gmt");
index 257aa3c2bca7e7ea2ce286384c76348398a3a637..5bbd5c2860513d95f0038872065138ea82de830f 100644 (file)
@@ -65,7 +65,6 @@
 #include <Sound/beacon.hxx>
 #include <Sound/morse.hxx>
 #include <FDM/flight.hxx>
-#include <FDM/UIUCModel/uiuc_aircraftdir.h>
 // #include <FDM/ADA.hxx>
 #include <ATC/ATCdisplay.hxx>
 #include <ATC/ATCmgr.hxx>
@@ -962,9 +961,6 @@ bool fgMainInit( int argc, char **argv ) {
 
     sgUseDisplayList = fgGetBool( "/sim/rendering/use-display-list", true );
 
-    // Initialize the Aircraft directory to "" (UIUC)
-    aircraft_dir = "";
-
     // Load the configuration parameters.  (Command line options
     // overrides config file options.  Config file options override
     // defaults.)
index a6f6ea1625d1bee9b63dba4aec4e716ff1c7b382..24bac915245900cfa6bd4e3b4c34a8f2a053ee6d 100644 (file)
@@ -47,7 +47,6 @@
 // #include <Airports/simple.hxx>
 // #include <Cockpit/cockpit.hxx>
 // #include <FDM/flight.hxx>
-// #include <FDM/UIUCModel/uiuc_aircraftdir.h>
 
 #include <Autopilot/route_mgr.hxx>
 #include <GUI/gui.h>