Index: Airports/simple.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/simple.hxx,v
retrieving revision 1.34
diff -u -r1.34 simple.hxx
--- Airports/simple.hxx	13 Sep 2008 08:07:23 -0000	1.34
+++ Airports/simple.hxx	26 Nov 2008 06:40:54 -0000
@@ -56,7 +56,7 @@
 
 public:
     FGAirport(const std::string& id, const SGGeod& location, const SGGeod& tower, 
-            const std::string& name, bool has_metar, Type aType);
+            const std::string& name, bool has_metar, Type aType, int rwy_count = 0, int taxiway_count = 0);
     ~FGAirport();
 
     const std::string& getId() const { return ident(); }
@@ -90,6 +90,8 @@
     FGRunway* getTaxiwayByIndex(unsigned int aIndex) const;
     
     void addRunway(FGRunway* aRunway);
+	void addRunways(std::vector<FGRunwayPtr>& runways);
+
 private:
     typedef std::vector<FGRunwayPtr>::const_iterator Runway_iterator;
     /**
@@ -146,7 +148,7 @@
 
     // add an entry to the list
     FGAirport* add( const std::string& id, const SGGeod& location, const SGGeod& tower,
-              const std::string& name, bool has_metar, FGPositioned::Type aType);
+              const std::string& name, bool has_metar, FGPositioned::Type aType, int rwy_count = 0, int taxiway_count = 0);
 
     // search for the specified id.
     // Returns NULL if unsucessfull.
Index: Airports/apt_loader.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/apt_loader.cxx,v
retrieving revision 1.17
diff -u -r1.17 apt_loader.cxx
--- Airports/apt_loader.cxx	13 Sep 2008 08:07:22 -0000	1.17
+++ Airports/apt_loader.cxx	24 Nov 2008 18:38:02 -0000
@@ -58,7 +58,7 @@
 }
 
 FGAirport* addAirport(FGAirportList *airports, const string& apt_id, const string& apt_name,
-    int rwy_count, double rwy_lat_accum, double rwy_lon_accum, double last_rwy_heading,
+    int rwy_count, int taxiway_count, double rwy_lat_accum, double rwy_lon_accum, double last_rwy_heading,
     double apt_elev, SGGeod& tower, bool got_tower, int type)
 {
     if (apt_id.empty())
@@ -85,7 +85,7 @@
   
 
     return airports->add(apt_id, SGGeod::fromDegFt(lon, lat, apt_elev), tower, apt_name, false,
-        fptypeFromRobinType(type));
+        fptypeFromRobinType(type), rwy_count, taxiway_count);
 }
 
 // Load the airport data base from the specified aptdb file.  The
@@ -104,7 +104,7 @@
         exit(-1);
     }
 
-    vector<string> token;
+    vector<string> token(22);
     string last_apt_id = "";
     double last_apt_elev = 0.0;
     string last_apt_name = "";
@@ -116,12 +116,17 @@
     char tmp[2049];
     tmp[2048] = 0;
     vector<FGRunwayPtr> runways;
-    
+    string *rwy_displ_threshold;
+	string *rwy_stopway;
+    double displ_thresh1, displ_thresh2;
+	double stopway1, stopway2;
+
     unsigned int line_id = 0;
     unsigned int line_num = 0;
     double rwy_lon_accum = 0.0;
     double rwy_lat_accum = 0.0;
     int rwy_count = 0;
+	int taxiway_count = 0;
     double last_rwy_heading = 0.0;
 
     while ( ! in.eof() ) {
@@ -159,19 +164,18 @@
                     line_id == 16 /* Seaplane base */ ||
                     line_id == 17 /* Heliport */ ) {
 
-            token.clear();
-            token = simgear::strutils::split(line);
-            string id = token[4];
+            //token.clear();
+			int splits = simgear::strutils::split_aptdat(line,0,0,token);
+            string& id = token[4];
             double elev = atof( token[1].c_str() );
             SG_LOG( SG_GENERAL, SG_BULK, "Next airport = " << id << " "
                     << elev );
 
-            FGAirport* apt = addAirport(airports, last_apt_id, last_apt_name, rwy_count, rwy_lat_accum, rwy_lon_accum,
+            FGAirport* apt = addAirport(airports, last_apt_id, last_apt_name, rwy_count, taxiway_count, rwy_lat_accum, rwy_lon_accum,
                 last_rwy_heading, last_apt_elev, last_tower, got_tower, last_apt_type);
 
-            for (unsigned int r=0; r< runways.size(); ++r) {
-              apt->addRunway(runways[r]);
-            }
+			if( apt )
+				apt->addRunways( runways );
 
             runways.clear();
             
@@ -181,11 +185,11 @@
             got_tower = false;
 
             // build the name
-            for ( unsigned int i = 5; i < token.size() - 1; ++i ) {
+            for ( unsigned int i = 5; i < splits - 1; ++i ) {
                 last_apt_name += token[i];
                 last_apt_name += " ";
             }
-            last_apt_name += token[token.size() - 1];
+            last_apt_name += token[splits - 1];
 
             last_apt_info = line;
             last_apt_type = atoi( token[0].c_str() );
@@ -193,10 +197,10 @@
             // clear runway list for start of next airport
             rwy_lon_accum = 0.0;
             rwy_lat_accum = 0.0;
-            rwy_count = 0;
+            rwy_count = taxiway_count = 0;
         } else if ( line_id == 10 ) {
-            token.clear();
-            token = simgear::strutils::split(line);
+            //token.clear();
+			simgear::strutils::split_aptdat(line,0,0,token);
 
             // runway entry
             double lat = atof( token[1].c_str() );
@@ -205,7 +209,7 @@
             rwy_lon_accum += lon;
             rwy_count++;
 
-            string rwy_no = token[3];
+            string& rwy_no = token[3];
 
             double heading = atof( token[4].c_str() );
             double length = atoi( token[5].c_str() );
@@ -213,19 +217,29 @@
             
             last_rwy_heading = heading;
 
-            string rwy_displ_threshold = token[6];
-            vector<string> displ
-                = simgear::strutils::split( rwy_displ_threshold, "." );
-            double displ_thresh1 = atof( displ[0].c_str() );
-            double displ_thresh2 = atof( displ[1].c_str() );
-
-            string rwy_stopway = token[7];
-            vector<string> stop
-                = simgear::strutils::split( rwy_stopway, "." );
-            double stopway1 = atof( stop[0].c_str() );
-            double stopway2 = atof( stop[1].c_str() );
+			int surface_code = atoi( token[10].c_str() );
+
+            rwy_displ_threshold = &token[6];
+            rwy_stopway = &token[7];
+
+			// 0.0 is most likely (taxiway), 0000.0000 is 2nd most likely (real runway)
+			// consider massaging input file to shorten 0000.0000 to 0.0
+			if( rwy_displ_threshold->compare("0.0")
+				&& rwy_displ_threshold->compare("0000.0000") ) {
+		        simgear::strutils::split_aptdat( *rwy_displ_threshold, ".", 0, token );
+			    displ_thresh1 = atof( token[0].c_str() );
+				displ_thresh2 = atof( token[1].c_str() );
+			} else
+				displ_thresh1 = displ_thresh2 = 0.0;
+
+			if( rwy_stopway->compare("0.0")
+				&& rwy_stopway->compare("0000.0000") ) {
+				simgear::strutils::split_aptdat( *rwy_stopway, ".", 0, token);
+				stopway1 = atof( token[0].c_str() );
+				stopway2 = atof( token[1].c_str() );
+			} else
+				stopway1 = stopway2 = 0.0;
 
-            int surface_code = atoi( token[10].c_str() );
 
             FGRunway* rwy = new FGRunway(NULL, rwy_no, lon, lat, heading, length,
                           width, displ_thresh1, stopway1, surface_code, false);
@@ -235,13 +249,14 @@
                           displ_thresh2, stopway2, surface_code, true);
             runways.push_back(rwy);
             runways.push_back(reciprocal);
-            
+			if(rwy->isTaxiway())
+				taxiway_count++;
         } else if ( line_id == 18 ) {
             // beacon entry (ignore)
         } else if ( line_id == 14 ) {
             // control tower entry
-            token.clear();
-            token = simgear::strutils::split(line);
+            //token.clear();
+			simgear::strutils::split_aptdat(line,0,0,token);
 
             double lat = atof( token[1].c_str() );
             double lon = atof( token[2].c_str() );
@@ -266,9 +281,12 @@
     }
 
     // add the last airport being processed if any
-    addAirport(airports, last_apt_id, last_apt_name, rwy_count, rwy_lat_accum, rwy_lon_accum,
+    FGAirport* apt = addAirport(airports, last_apt_id, last_apt_name, rwy_count, taxiway_count, rwy_lat_accum, rwy_lon_accum,
         last_rwy_heading, last_apt_elev, last_tower, got_tower, last_apt_type);
 
+	if( apt )
+		apt->addRunways( runways );
+
 
     //
     // Load the metar.dat file and update apt db with stations that
Index: Airports/simple.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/simple.cxx,v
retrieving revision 1.51
diff -u -r1.51 simple.cxx
--- Airports/simple.cxx	14 Sep 2008 14:31:00 -0000	1.51
+++ Airports/simple.cxx	24 Nov 2008 16:32:25 -0000
@@ -60,12 +60,14 @@
  ***************************************************************************/
 
 FGAirport::FGAirport(const string &id, const SGGeod& location, const SGGeod& tower_location,
-        const string &name, bool has_metar, Type aType) :
+        const string &name, bool has_metar, Type aType, int rwy_count, int taxiway_count) :
     FGPositioned(aType, id, location),
     _tower_location(tower_location),
     _name(name),
     _has_metar(has_metar),
-    _dynamics(0)
+    _dynamics(0),
+	mRunways(rwy_count),
+	mTaxiways(taxiway_count)
 {
 }
 
@@ -203,6 +205,22 @@
   return mTaxiways[aIndex];
 }
 
+
+void FGAirport::addRunways(vector<FGRunwayPtr>& runways)
+{
+	int j=0,k=0;
+	FGRunway *rwy;
+	for (unsigned int r=0; r< runways.size(); ++r) {
+		//addRunway(runways[r]);
+		rwy = runways[r];
+		rwy->setAirport(this);
+		if ( rwy->isTaxiway() )
+			mTaxiways[j++] = rwy;
+		else
+			mRunways[k++] = rwy;
+	}
+}
+
 void FGAirport::addRunway(FGRunway* aRunway)
 {
   aRunway->setAirport(this);
@@ -272,9 +290,9 @@
 
 // add an entry to the list
 FGAirport* FGAirportList::add( const string &id, const SGGeod& location, const SGGeod& tower_location,
-                         const string &name, bool has_metar, FGPositioned::Type aType)
+                         const string &name, bool has_metar, FGPositioned::Type aType, int rwy_count, int taxiway_count)
 {
-    FGAirport* a = new FGAirport(id, location, tower_location, name, has_metar, aType);
+    FGAirport* a = new FGAirport(id, location, tower_location, name, has_metar, aType, 2*(rwy_count-taxiway_count), 2*taxiway_count);
     airports_by_id[a->getId()] = a;
     // try and read in an auxilary file
 
Index: Main/ViewPartitionNode.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/ViewPartitionNode.hxx,v
retrieving revision 1.3
diff -u -r1.3 ViewPartitionNode.hxx
--- Main/ViewPartitionNode.hxx	29 Jul 2008 11:18:21 -0000	1.3
+++ Main/ViewPartitionNode.hxx	14 Nov 2008 17:36:21 -0000
@@ -44,8 +44,8 @@
     virtual void traverse(osg::NodeVisitor &nv);
     void setVisibility(double vis) { visibility = vis; }
     double getVisibility() const { return visibility; }
-    static void makeNewProjMat(osg::Matrixd& oldProj, double znear, double zfar,
-                               osg::Matrixd& projection);
+    static void makeNewProjMat(osg::Matrix& oldProj, double znear, double zfar,
+                               osg::Matrix& projection);
 protected:
 
     typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList;
Index: Main/CameraGroup.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/CameraGroup.cxx,v
retrieving revision 1.7
diff -u -r1.7 CameraGroup.cxx
--- Main/CameraGroup.cxx	21 Nov 2008 23:11:27 -0000	1.7
+++ Main/CameraGroup.cxx	22 Nov 2008 20:07:06 -0000
@@ -418,8 +418,8 @@
     camera->setProjectionResizePolicy(Camera::FIXED);
     camera->setReferenceFrame(Transform::ABSOLUTE_RF);
     const int cameraFlags = GUI;
-    CameraInfo* result = addCamera(cameraFlags, camera, Matrixd::identity(),
-                                   Matrixd::identity(), false);
+    CameraInfo* result = addCamera(cameraFlags, camera, Matrix::identity(),
+                                   Matrix::identity(), false);
     SGPropertyNode* viewportNode = cameraNode->getNode("viewport", true);
     buildViewport(result, viewportNode, window->gc->getTraits());
 
Index: Main/ViewPartitionNode.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/ViewPartitionNode.cxx,v
retrieving revision 1.3
diff -u -r1.3 ViewPartitionNode.cxx
--- Main/ViewPartitionNode.cxx	31 Jul 2008 09:20:35 -0000	1.3
+++ Main/ViewPartitionNode.cxx	14 Nov 2008 17:35:57 -0000
@@ -159,8 +159,8 @@
 // Given a projection matrix, return a new one with the same frustum
 // sides and new near / far values.
 
-void ViewPartitionNode::makeNewProjMat(Matrixd& oldProj, double znear,
-                                       double zfar, Matrixd& projection)
+void ViewPartitionNode::makeNewProjMat(Matrix& oldProj, double znear,
+                                       double zfar, Matrix& projection)
 {
     projection = oldProj;
     // Slightly inflate the near & far planes to avoid objects at the
Index: Main/fg_os_osgviewer.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/fg_os_osgviewer.cxx,v
retrieving revision 1.23
diff -u -r1.23 fg_os_osgviewer.cxx
--- Main/fg_os_osgviewer.cxx	18 Nov 2008 22:45:57 -0000	1.23
+++ Main/fg_os_osgviewer.cxx	19 Nov 2008 01:11:56 -0000
@@ -96,7 +96,8 @@
     else if (mode == "CullThreadPerCameraDrawThreadPerContext")
       viewer->setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
     else
-      viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
+      viewer->setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
+	  //viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
     WindowBuilder::initWindowBuilder(stencil);
     WindowBuilder *windowBuilder = WindowBuilder::getWindowBuilder();
 
Index: Main/main.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/main.cxx,v
retrieving revision 1.276
diff -u -r1.276 main.cxx
--- Main/main.cxx	19 Nov 2008 07:46:10 -0000	1.276
+++ Main/main.cxx	20 Nov 2008 18:01:10 -0000
@@ -236,7 +236,9 @@
     }
 
     double throttle_hz = fgGetDouble("/sim/frame-rate-throttle-hz", 0.0);
-    if ( throttle_hz > 0.0 && !wait_for_scenery ) {
+	if( wait_for_scenery )
+			throttle_hz = 15.0;
+    if ( throttle_hz > 0.0 /*&& !wait_for_scenery */) {
         // optionally throttle the frame rate (to get consistent frame
         // rates or reduce cpu usage.
 
Index: Navaids/positioned.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/positioned.cxx,v
retrieving revision 1.2
diff -u -r1.2 positioned.cxx
--- Navaids/positioned.cxx	8 Sep 2008 19:25:45 -0000	1.2
+++ Navaids/positioned.cxx	28 Oct 2008 17:18:59 -0000
@@ -142,6 +142,11 @@
   {
     return a->type() < b;
   }
+
+  bool operator()(FGPositioned* a, FGPositioned* b) const
+  {
+    return a->type() < b->type();
+  }
   
   bool operator()(const FGPositioned::Type a, const FGPositioned* b) const
   {

