From 45e3b7e2d19e7b0d1201f849c852bae5b6b3005b Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Mon, 4 Mar 2013 16:31:37 +0100 Subject: [PATCH] Clean up/prepare for porting NasalPositioned to cppbind --- src/AIModel/AIEscort.cxx | 2 +- src/ATC/CommStation.hxx | 4 +- src/ATC/atc_mgr.hxx | 4 +- src/ATC/trafficcontrol.hxx | 39 ++++---- src/ATCDCL/atis.cxx | 4 +- src/Airports/CMakeLists.txt | 1 + src/Airports/airport.cxx | 155 ++++++++++++++++++++++++------ src/Airports/airport.hxx | 39 +++----- src/Airports/airports_fwd.hxx | 98 +++++++++++++++++++ src/Airports/dynamics.hxx | 10 +- src/Airports/gnnode.hxx | 4 - src/Airports/groundnetwork.cxx | 2 +- src/Airports/groundnetwork.hxx | 29 ------ src/Airports/parking.hxx | 5 - src/Airports/runwayprefs.cxx | 26 ++--- src/Airports/runwayprefs.hxx | 52 ++++------ src/Airports/runways.cxx | 26 ++--- src/Airports/runways.hxx | 24 ++--- src/Airports/sidstar.cxx | 6 +- src/Airports/sidstar.hxx | 26 +---- src/Airports/xmlloader.hxx | 4 +- src/Navaids/positioned.cxx | 6 ++ src/Navaids/positioned.hxx | 32 +++++- src/Navaids/procedure.cxx | 1 + src/Navaids/procedure.hxx | 3 +- src/Scripting/NasalCanvas.cxx | 6 +- src/Scripting/NasalPositioned.cxx | 39 ++------ src/Traffic/Schedule.hxx | 4 +- 28 files changed, 386 insertions(+), 265 deletions(-) create mode 100644 src/Airports/airports_fwd.hxx diff --git a/src/AIModel/AIEscort.cxx b/src/AIModel/AIEscort.cxx index 8012ae923..9a8166755 100644 --- a/src/AIModel/AIEscort.cxx +++ b/src/AIModel/AIEscort.cxx @@ -196,7 +196,7 @@ bool FGAIEscort::getGroundElev(SGGeod inpos) { _ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET; if (material) { - const vector& names = material->get_names(); + const std::vector& names = material->get_names(); _solid = material->get_solid(); diff --git a/src/ATC/CommStation.hxx b/src/ATC/CommStation.hxx index 04a7fe344..33019f980 100644 --- a/src/ATC/CommStation.hxx +++ b/src/ATC/CommStation.hxx @@ -29,8 +29,8 @@ private: int mRangeNM; int mFreqKhz; PositionedID mAirport; -}; - +}; + } // of namespace flightgear #endif // of FG_ATC_COMM_STATION_HXX diff --git a/src/ATC/atc_mgr.hxx b/src/ATC/atc_mgr.hxx index f169e3415..09d40197a 100644 --- a/src/ATC/atc_mgr.hxx +++ b/src/ATC/atc_mgr.hxx @@ -41,8 +41,8 @@ //class FGATCController; -typedef vector AtcVec; -typedef vector::iterator AtcVecIterator; +typedef std::vector AtcVec; +typedef std::vector::iterator AtcVecIterator; class FGATCManager : public SGSubsystem { diff --git a/src/ATC/trafficcontrol.hxx b/src/ATC/trafficcontrol.hxx index 3d58d5806..1a137d4a5 100644 --- a/src/ATC/trafficcontrol.hxx +++ b/src/ATC/trafficcontrol.hxx @@ -21,9 +21,7 @@ #ifndef _TRAFFIC_CONTROL_HXX_ #define _TRAFFIC_CONTROL_HXX_ -#include -#include -#include +#include #include #include @@ -37,14 +35,25 @@ #include #include -typedef std::vector intVec; -typedef std::vector::iterator intVecIterator; +class FGAIAircraft; +typedef std::vector AircraftVec; +typedef std::vector::iterator AircraftVecIterator; +class FGAIFlightPlan; +typedef std::vector FlightPlanVec; +typedef std::vector::iterator FlightPlanVecIterator; +typedef std::map FlightPlanVecMap; -class FGAIFlightPlan; // forward reference -class FGGroundNetwork; // forward reference -class FGAIAircraft; // forward reference -class FGAirportDynamics; +class FGTrafficRecord; +typedef std::list TrafficVector; +typedef std::list::iterator TrafficVectorIterator; + +class ActiveRunway; +typedef std::vector ActiveRunwayVec; +typedef std::vector::iterator ActiveRunwayVecIterator; + +typedef std::vector intVec; +typedef std::vector::iterator intVecIterator; /************************************************************************************** * class FGATCInstruction @@ -306,15 +315,6 @@ public: int getPriority() const { return priority; }; }; -typedef std::list TrafficVector; -typedef std::list::iterator TrafficVectorIterator; - -typedef std::vector TimeVector; -typedef std::vector::iterator TimeVectorIterator; - -typedef std::vector AircraftVec; -typedef std::vector::iterator AircraftVecIterator; - /*********************************************************************** * Active runway, a utility class to keep track of which aircraft has * clearance for a given runway. @@ -368,9 +368,6 @@ public: void printDepartureCue(); }; -typedef std::vector ActiveRunwayVec; -typedef std::vector::iterator ActiveRunwayVecIterator; - /** * class FGATCController * NOTE: this class serves as an abstraction layer for all sorts of ATC controllers. diff --git a/src/ATCDCL/atis.cxx b/src/ATCDCL/atis.cxx index 3bc9e2f1f..c637640fd 100644 --- a/src/ATCDCL/atis.cxx +++ b/src/ATCDCL/atis.cxx @@ -711,10 +711,10 @@ void FGATIS::genFacilityInfo(void) // Note that at this point, multi-word facility names // will sometimes contain hyphens, not spaces. - vector name_words; + std::vector name_words; boost::split(name_words, name, boost::is_any_of(" -")); - for (vector::const_iterator wordp = name_words.begin(); + for( std::vector::const_iterator wordp = name_words.begin(); wordp != name_words.end(); wordp++) { string word(*wordp); // Remap some abbreviations that occur in apt.dat, to diff --git a/src/Airports/CMakeLists.txt b/src/Airports/CMakeLists.txt index f0cde69e7..e83261507 100644 --- a/src/Airports/CMakeLists.txt +++ b/src/Airports/CMakeLists.txt @@ -18,6 +18,7 @@ set(SOURCES ) set(HEADERS + airports_fwd.hxx apt_loader.hxx dynamicloader.hxx dynamics.hxx diff --git a/src/Airports/airport.cxx b/src/Airports/airport.cxx index 2ba2fd8e9..508eb9934 100644 --- a/src/Airports/airport.cxx +++ b/src/Airports/airport.cxx @@ -58,15 +58,18 @@ using std::pair; using namespace flightgear; - /*************************************************************************** * FGAirport ***************************************************************************/ AirportCache FGAirport::airportCache; -FGAirport::FGAirport(PositionedID aGuid, const string &id, const SGGeod& location, - const string &name, bool has_metar, Type aType) : +FGAirport::FGAirport( PositionedID aGuid, + const std::string &id, + const SGGeod& location, + const std::string &name, + bool has_metar, + Type aType ): FGPositioned(aGuid, aType, id, location), _name(name), _has_metar(has_metar), @@ -126,45 +129,83 @@ FGAirportDynamics * FGAirport::getDynamics() return _dynamics; } +//------------------------------------------------------------------------------ unsigned int FGAirport::numRunways() const { loadRunways(); return mRunways.size(); } +//------------------------------------------------------------------------------ unsigned int FGAirport::numHelipads() const { loadHelipads(); return mHelipads.size(); } +//------------------------------------------------------------------------------ FGRunway* FGAirport::getRunwayByIndex(unsigned int aIndex) const { loadRunways(); - - assert(aIndex >= 0 && aIndex < mRunways.size()); - return (FGRunway*) flightgear::NavDataCache::instance()->loadById(mRunways[aIndex]); + return loadById(mRunways, aIndex); } +//------------------------------------------------------------------------------ FGHelipad* FGAirport::getHelipadByIndex(unsigned int aIndex) const { loadHelipads(); + return loadById(mHelipads, aIndex); +} + +//------------------------------------------------------------------------------ +FGRunwayMap FGAirport::getRunwayMap() const +{ + loadRunways(); + FGRunwayMap map; + + double minLengthFt = fgGetDouble("/sim/navdb/min-runway-length-ft"); + + BOOST_FOREACH(PositionedID id, mRunways) + { + FGRunway* rwy = loadById(id); + + // ignore unusably short runways + // TODO other methods don't check this... + if( rwy->lengthFt() >= minLengthFt ) + map[ rwy->ident() ] = rwy; + } + + return map; +} + +//------------------------------------------------------------------------------ +FGHelipadMap FGAirport::getHelipadMap() const +{ + loadHelipads(); + FGHelipadMap map; - assert(aIndex >= 0 && aIndex < mHelipads.size()); - return (FGHelipad*) flightgear::NavDataCache::instance()->loadById(mHelipads[aIndex]); + BOOST_FOREACH(PositionedID id, mHelipads) + { + FGHelipad* rwy = loadById(id); + map[ rwy->ident() ] = rwy; + } + + return map; } -bool FGAirport::hasRunwayWithIdent(const string& aIdent) const +//------------------------------------------------------------------------------ +bool FGAirport::hasRunwayWithIdent(const std::string& aIdent) const { return flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::RUNWAY, aIdent) != 0; } -bool FGAirport::hasHelipadWithIdent(const string& aIdent) const +bool FGAirport::hasHelipadWithIdent(const std::string& aIdent) const { return flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::HELIPAD, aIdent) != 0; } -FGRunway* FGAirport::getRunwayByIdent(const string& aIdent) const +//------------------------------------------------------------------------------ +FGRunway* FGAirport::getRunwayByIdent(const std::string& aIdent) const { PositionedID id = flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::RUNWAY, aIdent); if (id == 0) { @@ -172,10 +213,11 @@ FGRunway* FGAirport::getRunwayByIdent(const string& aIdent) const throw sg_range_exception("unknown runway " + aIdent + " at airport:" + ident(), "FGAirport::getRunwayByIdent"); } - return (FGRunway*) flightgear::NavDataCache::instance()->loadById(id); + return loadById(id); } -FGHelipad* FGAirport::getHelipadByIdent(const string& aIdent) const +//------------------------------------------------------------------------------ +FGHelipad* FGAirport::getHelipadByIdent(const std::string& aIdent) const { PositionedID id = flightgear::NavDataCache::instance()->airportItemWithIdent(guid(), FGPositioned::HELIPAD, aIdent); if (id == 0) { @@ -183,10 +225,10 @@ FGHelipad* FGAirport::getHelipadByIdent(const string& aIdent) const throw sg_range_exception("unknown helipad " + aIdent + " at airport:" + ident(), "FGAirport::getRunwayByIdent"); } - return (FGHelipad*) flightgear::NavDataCache::instance()->loadById(id); + return loadById(id); } - +//------------------------------------------------------------------------------ FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const { loadRunways(); @@ -201,7 +243,7 @@ FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const double deviationWeight = param->getDoubleValue("deviation-weight", 1); BOOST_FOREACH(PositionedID id, mRunways) { - FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id); + FGRunway* rwy = loadById(id); double good = rwy->score(lengthWeight, widthWeight, surfaceWeight); double dev = aHeading - rwy->headingDeg(); SG_NORMALIZE_RANGE(dev, -180.0, 180.0); @@ -217,6 +259,7 @@ FGRunway* FGAirport::findBestRunwayForHeading(double aHeading) const return result; } +//------------------------------------------------------------------------------ FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const { loadRunways(); @@ -225,7 +268,7 @@ FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const double currentLowestDev = 180.0; BOOST_FOREACH(PositionedID id, mRunways) { - FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id); + FGRunway* rwy = loadById(id); double inboundCourse = SGGeodesy::courseDeg(aPos, rwy->end()); double dev = inboundCourse - rwy->headingDeg(); @@ -242,12 +285,13 @@ FGRunway* FGAirport::findBestRunwayForPos(const SGGeod& aPos) const } +//------------------------------------------------------------------------------ bool FGAirport::hasHardRunwayOfLengthFt(double aLengthFt) const { loadRunways(); BOOST_FOREACH(PositionedID id, mRunways) { - FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id); + FGRunway* rwy = loadById(id); if (rwy->isHardSurface() && (rwy->lengthFt() >= aLengthFt)) { return true; // we're done! } @@ -256,6 +300,7 @@ bool FGAirport::hasHardRunwayOfLengthFt(double aLengthFt) const return false; } +//------------------------------------------------------------------------------ FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const { loadRunways(); @@ -263,7 +308,7 @@ FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const FGRunwayList r; BOOST_FOREACH(PositionedID id, mRunways) { - FGRunway* rwy = (FGRunway*) flightgear::NavDataCache::instance()->loadById(id); + FGRunway* rwy = loadById(id); FGRunway* recip = rwy->reciprocalRunway(); if (recip) { FGRunwayList::iterator it = std::find(r.begin(), r.end(), recip); @@ -278,33 +323,49 @@ FGRunwayList FGAirport::getRunwaysWithoutReciprocals() const return r; } +//------------------------------------------------------------------------------ unsigned int FGAirport::numTaxiways() const { loadTaxiways(); return mTaxiways.size(); } +//------------------------------------------------------------------------------ FGTaxiway* FGAirport::getTaxiwayByIndex(unsigned int aIndex) const { loadTaxiways(); - - assert(aIndex >= 0 && aIndex < mTaxiways.size()); - return (FGTaxiway*) flightgear::NavDataCache::instance()->loadById(mTaxiways[aIndex]); + return loadById(mTaxiways, aIndex); +} + +//------------------------------------------------------------------------------ +FGTaxiwayList FGAirport::getTaxiways() const +{ + loadTaxiways(); + return loadAllById(mTaxiways); } +//------------------------------------------------------------------------------ unsigned int FGAirport::numPavements() const { loadTaxiways(); return mPavements.size(); } +//------------------------------------------------------------------------------ FGPavement* FGAirport::getPavementByIndex(unsigned int aIndex) const { loadTaxiways(); - assert(aIndex >= 0 && aIndex < mPavements.size()); - return (FGPavement*) flightgear::NavDataCache::instance()->loadById(mPavements[aIndex]); + return loadById(mPavements, aIndex); } +//------------------------------------------------------------------------------ +FGPavementList FGAirport::getPavements() const +{ + loadTaxiways(); + return loadAllById(mPavements); +} + +//------------------------------------------------------------------------------ FGRunway* FGAirport::getActiveRunwayForUsage() const { FGEnvironmentMgr* envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment"); @@ -383,7 +444,7 @@ char** FGAirport::searchNamesAndIdents(const std::string& aFilter) } // find basic airport location info from airport database -const FGAirport *fgFindAirportID( const string& id) +const FGAirport *fgFindAirportID( const std::string& id) { if ( id.empty() ) { return NULL; @@ -482,7 +543,7 @@ void FGAirport::readThresholdData(SGPropertyNode* aRoot) void FGAirport::processThreshold(SGPropertyNode* aThreshold) { // first, let's identify the current runway - string rwyIdent(aThreshold->getStringValue("rwy")); + std::string rwyIdent(aThreshold->getStringValue("rwy")); NavDataCache* cache = NavDataCache::instance(); PositionedID id = cache->airportItemWithIdent(guid(), FGPositioned::RUNWAY, rwyIdent); if (id == 0) { @@ -642,18 +703,21 @@ void FGAirport::addApproach(Approach* aApp) mApproaches.push_back(aApp); } +//------------------------------------------------------------------------------ unsigned int FGAirport::numSIDs() const { loadProcedures(); return mSIDs.size(); } +//------------------------------------------------------------------------------ flightgear::SID* FGAirport::getSIDByIndex(unsigned int aIndex) const { loadProcedures(); return mSIDs[aIndex]; } +//------------------------------------------------------------------------------ flightgear::SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const { loadProcedures(); @@ -666,18 +730,28 @@ flightgear::SID* FGAirport::findSIDWithIdent(const std::string& aIdent) const return NULL; } +//------------------------------------------------------------------------------ +flightgear::SIDList FGAirport::getSIDs() const +{ + loadProcedures(); + return flightgear::SIDList(mSIDs.begin(), mSIDs.end()); +} + +//------------------------------------------------------------------------------ unsigned int FGAirport::numSTARs() const { loadProcedures(); return mSTARs.size(); } +//------------------------------------------------------------------------------ STAR* FGAirport::getSTARByIndex(unsigned int aIndex) const { loadProcedures(); return mSTARs[aIndex]; } +//------------------------------------------------------------------------------ STAR* FGAirport::findSTARWithIdent(const std::string& aIdent) const { loadProcedures(); @@ -690,18 +764,27 @@ STAR* FGAirport::findSTARWithIdent(const std::string& aIdent) const return NULL; } +//------------------------------------------------------------------------------ +STARList FGAirport::getSTARs() const +{ + loadProcedures(); + return STARList(mSTARs.begin(), mSTARs.end()); +} + unsigned int FGAirport::numApproaches() const { loadProcedures(); return mApproaches.size(); } +//------------------------------------------------------------------------------ Approach* FGAirport::getApproachByIndex(unsigned int aIndex) const { loadProcedures(); return mApproaches[aIndex]; } +//------------------------------------------------------------------------------ Approach* FGAirport::findApproachWithIdent(const std::string& aIdent) const { loadProcedures(); @@ -714,6 +797,22 @@ Approach* FGAirport::findApproachWithIdent(const std::string& aIdent) const return NULL; } +//------------------------------------------------------------------------------ +ApproachList FGAirport::getApproaches(ProcedureType type) const +{ + loadProcedures(); + if( type == PROCEDURE_INVALID ) + return ApproachList(mApproaches.begin(), mApproaches.end()); + + ApproachList ret; + for(size_t i = 0; i < mApproaches.size(); ++i) + { + if( mApproaches[i]->type() == type ) + ret.push_back(mApproaches[i]); + } + return ret; +} + CommStationList FGAirport::commStations() const { @@ -742,7 +841,7 @@ FGAirport::commStationsOfType(FGPositioned::Type aTy) const } // get airport elevation -double fgGetAirportElev( const string& id ) +double fgGetAirportElev( const std::string& id ) { const FGAirport *a=fgFindAirportID( id); if (a) { @@ -754,7 +853,7 @@ double fgGetAirportElev( const string& id ) // get airport position -SGGeod fgGetAirportPos( const string& id ) +SGGeod fgGetAirportPos( const std::string& id ) { const FGAirport *a = fgFindAirportID( id); diff --git a/src/Airports/airport.hxx b/src/Airports/airport.hxx index c715c7232..3ca4d62c7 100644 --- a/src/Airports/airport.hxx +++ b/src/Airports/airport.hxx @@ -34,33 +34,10 @@ #include #include -#include - -// forward decls -class FGAirportDynamics; -class FGRunway; -class FGHelipad; -class FGTaxiway; -class FGPavement; -class SGPropertyNode; -class FGAirport; - -namespace flightgear { - class SID; - class STAR; - class Approach; - class Waypt; - class CommStation; - - typedef SGSharedPtr WayptRef; - typedef std::vector WayptVec; - - typedef std::vector CommStationList; - typedef std::map AirportCache; -} - -typedef std::vector FGRunwayList; +#include +#include "airports_fwd.hxx" +#include "runways.hxx" /*************************************************************************************** * @@ -108,6 +85,8 @@ public: unsigned int numHelipads() const; FGRunway* getRunwayByIndex(unsigned int aIndex) const; FGHelipad* getHelipadByIndex(unsigned int aIndex) const; + FGRunwayMap getRunwayMap() const; + FGHelipadMap getHelipadMap() const; bool hasRunwayWithIdent(const std::string& aIdent) const; bool hasHelipadWithIdent(const std::string& aIdent) const; @@ -145,9 +124,11 @@ public: unsigned int numTaxiways() const; FGTaxiway* getTaxiwayByIndex(unsigned int aIndex) const; + FGTaxiwayList getTaxiways() const; unsigned int numPavements() const; FGPavement* getPavementByIndex(unsigned int aIndex) const; + FGPavementList getPavements() const; class AirportFilter : public Filter { @@ -203,14 +184,20 @@ public: unsigned int numSIDs() const; flightgear::SID* getSIDByIndex(unsigned int aIndex) const; flightgear::SID* findSIDWithIdent(const std::string& aIdent) const; + flightgear::SIDList getSIDs() const; unsigned int numSTARs() const; flightgear::STAR* getSTARByIndex(unsigned int aIndex) const; flightgear::STAR* findSTARWithIdent(const std::string& aIdent) const; + flightgear::STARList getSTARs() const; unsigned int numApproaches() const; flightgear::Approach* getApproachByIndex(unsigned int aIndex) const; flightgear::Approach* findApproachWithIdent(const std::string& aIdent) const; + flightgear::ApproachList getApproaches + ( + flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID + ) const; /** * Syntactic wrapper around FGPositioned::findClosest - find the closest diff --git a/src/Airports/airports_fwd.hxx b/src/Airports/airports_fwd.hxx new file mode 100644 index 000000000..ecb76a50f --- /dev/null +++ b/src/Airports/airports_fwd.hxx @@ -0,0 +1,98 @@ +/* + * airports_fwd.hxx + * + * Created on: 04.03.2013 + * Author: tom + */ + +#ifndef AIRPORTS_FWD_HXX_ +#define AIRPORTS_FWD_HXX_ + +#include + +#include +#include +#include +#include + +// forward decls +class FGAirport; +class FGAirportDynamics; +class FGRunway; +class FGHelipad; +class FGTaxiway; +class FGPavement; + +class FGNavRecord; + +class Block; +class FGTaxiNode; +class FGParking; +class FGTaxiSegment; +class FGTaxiRoute; +class FGGroundNetwork; + +class RunwayList; +class RunwayGroup; +class FGRunwayPreference; + +class FGSidStar; + +class SGPropertyNode; + +namespace flightgear { + class SID; + class STAR; + class Approach; + class Waypt; + class CommStation; + + typedef std::vector SIDList; + typedef std::vector STARList; + typedef std::vector ApproachList; + + typedef SGSharedPtr WayptRef; + typedef std::vector WayptVec; + + typedef SGSharedPtr CommStationRef; + typedef std::vector CommStationList; + typedef std::map AirportCache; +} + +typedef std::vector FGRunwayList; +typedef std::map FGRunwayMap; +typedef std::map FGHelipadMap; + +typedef std::vector FGTaxiwayList; +typedef std::vector FGPavementList; + +typedef std::vector FGTaxiSegmentVector; +typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator; + +typedef SGSharedPtr FGTaxiNodeRef; +typedef std::vector FGTaxiNodeVector; +typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator; +typedef std::map IndexTaxiNodeMap; + +typedef std::vector BlockList; +typedef BlockList::iterator BlockListIterator; + +typedef std::vector TimeVector; +typedef std::vector::iterator TimeVectorIterator; + +typedef std::vector TaxiRouteVector; +typedef std::vector::iterator TaxiRouteVectorIterator; + +typedef std::vector FGParkingVec; +typedef FGParkingVec::iterator FGParkingVecIterator; +typedef FGParkingVec::const_iterator FGParkingVecConstIterator; + +typedef std::vector RunwayListVec; +typedef std::vector::iterator RunwayListVectorIterator; +typedef std::vector::const_iterator RunwayListVecConstIterator; + +typedef std::vector PreferenceList; +typedef std::vector::iterator PreferenceListIterator; +typedef std::vector::const_iterator PreferenceListConstIterator; + +#endif /* AIRPORTS_FWD_HXX_ */ diff --git a/src/Airports/dynamics.hxx b/src/Airports/dynamics.hxx index 007c8a780..b2ee16fdd 100644 --- a/src/Airports/dynamics.hxx +++ b/src/Airports/dynamics.hxx @@ -25,14 +25,11 @@ #include #include +#include "airports_fwd.hxx" #include "parking.hxx" #include "groundnetwork.hxx" #include "runwayprefs.hxx" -// forward decls -class FGAirport; -class FGEnvironment; - class ParkingAssignment { public: @@ -125,7 +122,10 @@ public: FGAirport* parent() const { return _ap; } - void getActiveRunway(const string& trafficType, int action, string& runway, double heading); + void getActiveRunway( const std::string& trafficType, + int action, + std::string& runway, + double heading ); /** * retrieve an available parking by GateID, or -1 if no suitable diff --git a/src/Airports/gnnode.hxx b/src/Airports/gnnode.hxx index 2ade6673d..2d4c16a9e 100644 --- a/src/Airports/gnnode.hxx +++ b/src/Airports/gnnode.hxx @@ -41,8 +41,4 @@ public: bool getIsOnRunway() const { return isOnRunway; }; }; -typedef SGSharedPtr FGTaxiNode_ptr; -typedef std::vector FGTaxiNodeVector; -typedef FGTaxiNodeVector::iterator FGTaxiNodeVectorIterator; - #endif diff --git a/src/Airports/groundnetwork.cxx b/src/Airports/groundnetwork.cxx index 3ea86f979..344161172 100644 --- a/src/Airports/groundnetwork.cxx +++ b/src/Airports/groundnetwork.cxx @@ -394,7 +394,7 @@ public: {} double score; - FGTaxiNode_ptr previousNode; + FGTaxiNodeRef previousNode; }; FGTaxiRoute FGGroundNetwork::findShortestRoute(PositionedID start, PositionedID end, diff --git a/src/Airports/groundnetwork.hxx b/src/Airports/groundnetwork.hxx index de8d94ed4..2c7884bf2 100644 --- a/src/Airports/groundnetwork.hxx +++ b/src/Airports/groundnetwork.hxx @@ -27,26 +27,11 @@ #include #include -#include -#include -#include #include "gnnode.hxx" #include "parking.hxx" #include - -class Block; -class FGRunway; -class FGTaxiSegment; // forward reference -class FGAIFlightPlan; // forward reference -class FGAirport; // forward reference - -typedef std::vector FGTaxiSegmentVector; -typedef FGTaxiSegmentVector::iterator FGTaxiSegmentVectorIterator; - -typedef std::map IndexTaxiNodeMap; - class Block { private: @@ -63,9 +48,6 @@ public: bool operator< (const Block &other) const { return blocktime < other.blocktime; }; }; -typedef std::vector BlockList; -typedef BlockList::iterator BlockListIterator; - /*************************************************************************************** * class FGTaxiSegment **************************************************************************************/ @@ -119,14 +101,6 @@ public: }; }; - - - -typedef std::vector intVec; -typedef std::vector::iterator intVecIterator; - - - /*************************************************************************************** * class FGTaxiRoute **************************************************************************************/ @@ -181,9 +155,6 @@ public: }; }; -typedef std::vector TaxiRouteVector; -typedef std::vector::iterator TaxiRouteVectorIterator; - /************************************************************************************** * class FGGroundNetWork *************************************************************************************/ diff --git a/src/Airports/parking.hxx b/src/Airports/parking.hxx index ff466d256..6d8892c80 100644 --- a/src/Airports/parking.hxx +++ b/src/Airports/parking.hxx @@ -33,7 +33,6 @@ #include #include -#include #include // for std::auto_ptr #include "gnnode.hxx" @@ -79,8 +78,4 @@ public: return radius < other.radius; }; }; -typedef std::vector FGParkingVec; -typedef FGParkingVec::iterator FGParkingVecIterator; -typedef FGParkingVec::const_iterator FGParkingVecConstIterator; - #endif diff --git a/src/Airports/runwayprefs.cxx b/src/Airports/runwayprefs.cxx index 2a2fceb0f..4ee6ac7b3 100644 --- a/src/Airports/runwayprefs.cxx +++ b/src/Airports/runwayprefs.cxx @@ -90,7 +90,7 @@ ScheduleTime & ScheduleTime::operator=(const ScheduleTime & other) return *this; } -string ScheduleTime::getName(time_t dayStart) +std::string ScheduleTime::getName(time_t dayStart) { if ((start.size() != end.size()) || (start.size() != scheduleNames.size())) { @@ -109,7 +109,7 @@ string ScheduleTime::getName(time_t dayStart) //couldn't find one so return 0; //cerr << "Returning 0 " << endl; } - return string(""); + return std::string(""); } /****************************************************************************** @@ -136,15 +136,15 @@ RunwayList & RunwayList::operator=(const RunwayList & other) return *this; } -void RunwayList::set(const string & tp, const string & lst) +void RunwayList::set(const std::string & tp, const std::string & lst) { //weekday = atoi(timeCopy.substr(0,1).c_str()); // timeOffsetInDays = weekday - currTimeDate->getGmt()->tm_wday; // timeCopy = timeCopy.substr(2,timeCopy.length()); type = tp; - string rwys = lst; - string rwy; - while (rwys.find(",") != string::npos) { + std::string rwys = lst; + std::string rwy; + while (rwys.find(",") != std::string::npos) { rwy = rwys.substr(0, rwys.find(",", 0)); //cerr << "adding runway [" << rwy << "] to the list " << endl; preferredRunways.push_back(rwy); @@ -206,7 +206,7 @@ void RunwayGroup::setActive(const FGAirport * airport, double hdgDiff; double crossWind; double tailWind; - string name; + std::string name; //stringVec names; int bestMatch = 0, bestChoice = 0; @@ -229,7 +229,7 @@ void RunwayGroup::setActive(const FGAirport * airport, validSelection = true; for (int j = 0; j < activeRwys; j++) { - string ident(rwyList[j].getRwyList(i)); + std::string ident(rwyList[j].getRwyList(i)); if (!airport->hasRunwayWithIdent(ident)) { SG_LOG(SG_GENERAL, SG_WARN, "no such runway:" << ident << " at " << @@ -290,9 +290,9 @@ void RunwayGroup::setActive(const FGAirport * airport, choice[0] = 0; choice[1] = 0; for (int i = activeRwys - 1; i; i--) { - if (rwyList[i].getType() == string("landing")) + if (rwyList[i].getType() == std::string("landing")) choice[0] = i; - if (rwyList[i].getType() == string("takeoff")) + if (rwyList[i].getType() == std::string("takeoff")) choice[1] = i; } //cerr << "Choosing " << choice[0] << " for landing and " << choice[1] << "for takeoff" << endl; @@ -327,7 +327,7 @@ void RunwayGroup::setActive(const FGAirport * airport, nrActive = 0; } -void RunwayGroup::getActive(int i, string & name, string & type) +void RunwayGroup::getActive(int i, std::string & name, std::string & type) { if (i == -1) { return; @@ -394,7 +394,7 @@ ScheduleTime *FGRunwayPreference::getSchedule(const char *trafficType) return 0; } -RunwayGroup *FGRunwayPreference::getGroup(const string & groupName) +RunwayGroup *FGRunwayPreference::getGroup(const std::string & groupName) { PreferenceListIterator i = preferences.begin(); if (preferences.begin() == preferences.end()) @@ -407,7 +407,7 @@ RunwayGroup *FGRunwayPreference::getGroup(const string & groupName) return 0; } -string FGRunwayPreference::getId() +std::string FGRunwayPreference::getId() { return _ap->getId(); }; diff --git a/src/Airports/runwayprefs.hxx b/src/Airports/runwayprefs.hxx index c9ac72709..7e2eced2f 100644 --- a/src/Airports/runwayprefs.hxx +++ b/src/Airports/runwayprefs.hxx @@ -24,23 +24,18 @@ #ifndef _RUNWAYPREFS_HXX_ #define _RUNWAYPREFS_HXX_ -#include -#include -#include +#include "airports_fwd.hxx" #include +#include -using std::vector; -using std::string; - -typedef vector timeVec; -typedef vector::const_iterator timeVecConstIterator; +typedef std::vector timeVec; +typedef std::vector::const_iterator timeVecConstIterator; -typedef vector stringVec; -typedef vector::iterator stringVecIterator; -typedef vector::const_iterator stringVecConstIterator; +typedef std::vector stringVec; +typedef std::vector::iterator stringVecIterator; +typedef std::vector::const_iterator stringVecConstIterator; -class FGAirport; /***************************************************************************/ class ScheduleTime { @@ -54,12 +49,12 @@ public: ScheduleTime() : tailWind(0), crssWind(0) {}; ScheduleTime(const ScheduleTime &other); ScheduleTime &operator= (const ScheduleTime &other); - string getName(time_t dayStart); + std::string getName(time_t dayStart); void clear(); void addStartTime(time_t time) { start.push_back(time); }; void addEndTime (time_t time) { end. push_back(time); }; - void addScheduleName(const string& sched) { scheduleNames.push_back(sched); }; + void addScheduleName(const std::string& sched) { scheduleNames.push_back(sched); }; void setTailWind(double wnd) { tailWind = wnd; }; void setCrossWind(double wnd) { tailWind = wnd; }; @@ -73,32 +68,27 @@ public: class RunwayList { private: - string type; + std::string type; stringVec preferredRunways; public: RunwayList() {}; RunwayList(const RunwayList &other); RunwayList& operator= (const RunwayList &other); - void set(const string&, const string&); + void set(const std::string&, const std::string&); void clear(); - string getType() { return type; }; + std::string getType() { return type; }; stringVec *getRwyList() { return &preferredRunways; }; - string getRwyList(int j) { return preferredRunways[j]; }; + std::string getRwyList(int j) { return preferredRunways[j]; }; }; -typedef vector RunwayListVec; -typedef vector::iterator RunwayListVectorIterator; -typedef vector::const_iterator RunwayListVecConstIterator; - - /*****************************************************************************/ class RunwayGroup { private: - string name; + std::string name; RunwayListVec rwyList; int active; //stringVec runwayNames; @@ -110,22 +100,18 @@ public: RunwayGroup(const RunwayGroup &other); RunwayGroup &operator= (const RunwayGroup &other); - void setName(const string& nm) { name = nm; }; + void setName(const std::string& nm) { name = nm; }; void add(const RunwayList& list) { rwyList.push_back(list);}; void setActive(const FGAirport* airport, double windSpeed, double windHeading, double maxTail, double maxCross, stringVec *curr); int getNrActiveRunways() { return nrActive;}; - void getActive(int i, string& name, string& type); + void getActive(int i, std::string& name, std::string& type); - string getName() { return name; }; + std::string getName() { return name; }; void clear() { rwyList.clear(); }; //void add(string, string); }; -typedef vector PreferenceList; -typedef vector::iterator PreferenceListIterator; -typedef vector::const_iterator PreferenceListConstIterator; - /******************************************************************************/ class FGRunwayPreference { @@ -148,9 +134,9 @@ public: FGRunwayPreference & operator= (const FGRunwayPreference &other); ScheduleTime *getSchedule(const char *trafficType); - RunwayGroup *getGroup(const string& groupName); + RunwayGroup *getGroup(const std::string& groupName); - string getId(); + std::string getId(); bool available() { return initialized; }; void setInitialized(bool state) { initialized = state; }; diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index 66f2407a2..e63fb9d73 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -130,12 +130,12 @@ void FGRunway::setReciprocalRunway(PositionedID other) FGAirport* FGRunway::airport() const { - return (FGAirport*) flightgear::NavDataCache::instance()->loadById(_airport); + return loadById(_airport); } FGRunway* FGRunway::reciprocalRunway() const { - return (FGRunway*) flightgear::NavDataCache::instance()->loadById(_reciprocal); + return loadById(_reciprocal); } FGNavRecord* FGRunway::ILS() const @@ -144,7 +144,7 @@ FGNavRecord* FGRunway::ILS() const return NULL; } - return (FGNavRecord*) flightgear::NavDataCache::instance()->loadById(_ils); + return loadById(_ils); } FGNavRecord* FGRunway::glideslope() const @@ -158,10 +158,10 @@ FGNavRecord* FGRunway::glideslope() const return (FGNavRecord*) cache->loadById(gsId); } -std::vector FGRunway::getSIDs() const +flightgear::SIDList FGRunway::getSIDs() const { FGAirport* apt = airport(); - std::vector result; + flightgear::SIDList result; for (unsigned int i=0; inumSIDs(); ++i) { flightgear::SID* s = apt->getSIDByIndex(i); if (s->isForRunway(this)) { @@ -172,10 +172,10 @@ std::vector FGRunway::getSIDs() const return result; } -std::vector FGRunway::getSTARs() const +flightgear::STARList FGRunway::getSTARs() const { FGAirport* apt = airport(); - std::vector result; + flightgear::STARList result; for (unsigned int i=0; inumSTARs(); ++i) { flightgear::STAR* s = apt->getSTARByIndex(i); if (s->isForRunway(this)) { @@ -186,13 +186,17 @@ std::vector FGRunway::getSTARs() const return result; } -std::vector FGRunway::getApproaches() const +flightgear::ApproachList +FGRunway::getApproaches(flightgear::ProcedureType type) const { FGAirport* apt = airport(); - std::vector result; - for (unsigned int i=0; inumApproaches(); ++i) { + flightgear::ApproachList result; + for (unsigned int i=0; inumApproaches(); ++i) + { flightgear::Approach* s = apt->getApproachByIndex(i); - if (s->runway() == this) { + if( s->runway() == this + && (type == flightgear::PROCEDURE_INVALID || type == s->type()) ) + { result.push_back(s); } } // of approaches at the airport iteration diff --git a/src/Airports/runways.hxx b/src/Airports/runways.hxx index 216875c41..03434ab8e 100644 --- a/src/Airports/runways.hxx +++ b/src/Airports/runways.hxx @@ -26,18 +26,9 @@ #include -#include - -// forward decls -class FGAirport; -class FGNavRecord; -class SGPropertyNode; - -namespace flightgear { - class SID; - class STAR; - class Approach; -} +#include +#include "runwaybase.hxx" +#include "airports_fwd.hxx" class FGRunway : public FGRunwayBase { @@ -113,15 +104,18 @@ public: /** * Get SIDs (DPs) associated with this runway */ - std::vector getSIDs() const; + flightgear::SIDList getSIDs() const; /** * Get STARs associared with this runway */ - std::vector getSTARs() const; + flightgear::STARList getSTARs() const; - std::vector getApproaches() const; + flightgear::ApproachList getApproaches + ( + flightgear::ProcedureType type = flightgear::PROCEDURE_INVALID + ) const; }; diff --git a/src/Airports/sidstar.cxx b/src/Airports/sidstar.cxx index 93360b432..a95119482 100644 --- a/src/Airports/sidstar.cxx +++ b/src/Airports/sidstar.cxx @@ -28,11 +28,9 @@ #include #include - - +#include #include - #include "sidstar.hxx" using std::cerr; @@ -119,4 +117,4 @@ FGAIFlightPlan *FGSidStar::getBest(string activeRunway, double heading) } else { return 0; } -} \ No newline at end of file +} diff --git a/src/Airports/sidstar.hxx b/src/Airports/sidstar.hxx index ad8d10e94..c7e8f93d3 100644 --- a/src/Airports/sidstar.hxx +++ b/src/Airports/sidstar.hxx @@ -23,29 +23,13 @@ #ifndef _SIDSTAR_HXX_ #define _SIDSTAR_HXX_ -#include -#include +#include "airports_fwd.hxx" +#include #include - #include -#include -#include -#include "parking.hxx" -#include "groundnetwork.hxx" -#include "runwayprefs.hxx" - - -class FGAirport; - -typedef std::vector FlightPlanVec; -typedef std::vector::iterator FlightPlanVecIterator; - -typedef std::map < std::string, FlightPlanVec > FlightPlanVecMap; - - -class FGSidStar +class FGSidStar { private: std::string id; @@ -61,6 +45,4 @@ class FGSidStar FGAIFlightPlan *getBest(std::string activeRunway, double heading); }; - - -#endif \ No newline at end of file +#endif diff --git a/src/Airports/xmlloader.hxx b/src/Airports/xmlloader.hxx index 47e34daaf..e303fbeb2 100644 --- a/src/Airports/xmlloader.hxx +++ b/src/Airports/xmlloader.hxx @@ -16,9 +16,7 @@ #ifndef _XML_LOADER_HXX_ #define _XML_LOADER_HXX_ -class FGAirportDynamics; -class FGRunwayPreference; -class FGSidStar; +#include "airports_fwd.hxx" class XMLVisitor; // ffrom easyxml.hxx diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index 450c755d9..f6b706fd3 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -326,6 +326,12 @@ void FGPositioned::modifyPosition(const SGGeod& newPos) const_cast(mCart) = SGVec3d::fromGeod(newPos); } +//------------------------------------------------------------------------------ +FGPositioned* FGPositioned::loadByIdImpl(PositionedID id) +{ + return flightgear::NavDataCache::instance()->loadById(id); +} + FGPositioned::TypeFilter::TypeFilter(Type aTy) : mMinType(aTy), mMaxType(aTy) diff --git a/src/Navaids/positioned.hxx b/src/Navaids/positioned.hxx index 4943c964b..8341c22f1 100644 --- a/src/Navaids/positioned.hxx +++ b/src/Navaids/positioned.hxx @@ -21,6 +21,7 @@ #ifndef FG_POSITIONED_HXX #define FG_POSITIONED_HXX +#include #include #include #include @@ -128,6 +129,9 @@ public: double elevation() const { return mPosition.getElevationFt(); } + double elevationM() const + { return mPosition.getElevationM(); } + /** * Predicate class to support custom filtering of FGPositioned queries * Default implementation of this passes any FGPositioned instance. @@ -243,7 +247,33 @@ protected: FGPositioned(PositionedID aGuid, Type ty, const std::string& aIdent, const SGGeod& aPos); void modifyPosition(const SGGeod& newPos); - + + static FGPositioned* loadByIdImpl(PositionedID id); + + template + static T* loadById(PositionedID id) + { + return static_cast( loadByIdImpl(id) ); + } + + template + static T* loadById(const PositionedIDVec& id_vec, size_t index) + { + assert(index >= 0 && index < id_vec.size()); + return loadById(id_vec[index]); + } + + template + static std::vector loadAllById(const PositionedIDVec& id_vec) + { + std::vector vec(id_vec.size()); + + for(size_t i = 0; i < id_vec.size(); ++i) + vec[i] = loadById(id_vec[i]); + + return vec; + } + const PositionedID mGuid; const SGGeod mPosition; const SGVec3d mCart; diff --git a/src/Navaids/procedure.cxx b/src/Navaids/procedure.cxx index f94ec0cc1..96f8a77d7 100644 --- a/src/Navaids/procedure.cxx +++ b/src/Navaids/procedure.cxx @@ -24,6 +24,7 @@ #include +#include #include using std::string; diff --git a/src/Navaids/procedure.hxx b/src/Navaids/procedure.hxx index 1a4ce1229..146e237ad 100644 --- a/src/Navaids/procedure.hxx +++ b/src/Navaids/procedure.hxx @@ -23,9 +23,8 @@ #include #include // for string_list - +#include #include -#include typedef SGSharedPtr FGRunwayRef; diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx index b12643e22..3a1c263ef 100644 --- a/src/Scripting/NasalCanvas.cxx +++ b/src/Scripting/NasalCanvas.cxx @@ -164,16 +164,16 @@ naRef f_groupGetElementById(sc::Group& group, const nasal::CallContext& ctx) ); } -naRef f_eventGetTarget(naContext c, sc::Event& event) +naRef to_nasal_helper(naContext c, const sc::ElementWeakPtr& el) { - return NasalElement::create(c, event.getTarget().lock()); + return NasalElement::create(c, el.lock()); } naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave) { NasalEvent::init("canvas.Event") .member("type", &sc::Event::getTypeString) - .member("target", &f_eventGetTarget) + .member("target", &sc::Event::getTarget) .method("stopPropagation", &sc::Event::stopPropagation); NasalMouseEvent::init("canvas.MouseEvent") .bases() diff --git a/src/Scripting/NasalPositioned.cxx b/src/Scripting/NasalPositioned.cxx index 1f10e5baf..f4eeb8444 100644 --- a/src/Scripting/NasalPositioned.cxx +++ b/src/Scripting/NasalPositioned.cxx @@ -462,7 +462,7 @@ static const char* wayptGhostGetMember(naContext c, void* g, naRef field, naRef* static RouteRestriction routeRestrictionFromString(const char* s) { - string u(s); + std::string u(s); boost::to_lower(u); if (u == "computed") return RESTRICT_COMPUTED; if (u == "at") return RESTRICT_AT; @@ -728,7 +728,7 @@ static const char* procedureGhostGetMember(naContext c, void* g, naRef field, na ArrivalDeparture* ad = static_cast(proc); *out = naNewVector(c); - BOOST_FOREACH(string id, ad->transitionIdents()) { + BOOST_FOREACH(std::string id, ad->transitionIdents()) { naVec_append(*out, stringToNasal(c, id)); } } else { @@ -1112,7 +1112,7 @@ static naRef f_findAirportsByICAO(naContext c, naRef me, int argc, naRef* args) } int argOffset = 0; - string prefix(naStr_data(args[argOffset++])); + std::string prefix(naStr_data(args[argOffset++])); AirportInfoFilter filter; // defaults to airports only if (argOffset < argc) { filter.fromArg(args[argOffset++]); @@ -1213,26 +1213,6 @@ static naRef f_airport_runwaysWithoutReciprocals(naContext c, naRef me, int argc return runways; } -static naRef f_airport_taxiway(naContext c, naRef me, int argc, naRef* args) -{ - FGAirport* apt = airportGhost(me); - if (!apt) { - naRuntimeError(c, "airport.taxiway called on non-airport object"); - } - - if ((argc < 1) || !naIsString(args[0])) { - naRuntimeError(c, "airport.taxiway expects a taxiway ident argument"); - } - - naRef taxiways = naNewVector(c); - - for (unsigned int i = 0; i < apt->numTaxiways(); i++) { - naVec_append(taxiways, ghostForTaxiway(c, apt->getTaxiwayByIndex(i))); - } - - return taxiways; -} - static naRef f_airport_sids(naContext c, naRef me, int argc, naRef* args) { FGAirport* apt = airportGhost(me); @@ -1417,7 +1397,7 @@ static naRef f_airport_getSid(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "airport.getSid passed invalid argument"); } - string ident = naStr_data(args[0]); + std::string ident = naStr_data(args[0]); return ghostForProcedure(c, apt->findSIDWithIdent(ident)); } @@ -1432,7 +1412,7 @@ static naRef f_airport_getStar(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "airport.getStar passed invalid argument"); } - string ident = naStr_data(args[0]); + std::string ident = naStr_data(args[0]); return ghostForProcedure(c, apt->findSTARWithIdent(ident)); } @@ -1447,7 +1427,7 @@ static naRef f_airport_getApproach(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "airport.getIAP passed invalid argument"); } - string ident = naStr_data(args[0]); + std::string ident = naStr_data(args[0]); return ghostForProcedure(c, apt->findApproachWithIdent(ident)); } @@ -1621,7 +1601,7 @@ static naRef f_findNavaidsByIdent(naContext c, naRef me, int argc, naRef* args) } FGPositioned::Type type = FGPositioned::INVALID; - string ident = naStr_data(args[argOffset++]); + std::string ident = naStr_data(args[argOffset++]); if (argOffset < argc) { type = FGPositioned::typeFromName(naStr_data(args[argOffset])); } @@ -1647,7 +1627,7 @@ static naRef f_findFixesByIdent(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "findFixesByIdent expectes ident string as arg %d", argOffset); } - string ident(naStr_data(args[argOffset])); + std::string ident(naStr_data(args[argOffset])); naRef r = naNewVector(c); FGPositioned::TypeFilter filter(FGPositioned::FIX); @@ -1954,7 +1934,7 @@ static naRef f_createWP(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "createWP: no identifier supplied"); } - string ident = naStr_data(args[argOffset++]); + std::string ident = naStr_data(args[argOffset++]); WayptRef wpt = new BasicWaypt(pos, ident, NULL); // set waypt flags - approach, departure, pseudo, etc @@ -2430,7 +2410,6 @@ naRef initNasalPositioned(naRef globals, naContext c, naRef gcSave) hashset(c, airportPrototype, "runway", naNewFunc(c, naNewCCode(c, f_airport_runway))); hashset(c, airportPrototype, "runwaysWithoutReciprocals", naNewFunc(c, naNewCCode(c, f_airport_runwaysWithoutReciprocals))); hashset(c, airportPrototype, "helipad", naNewFunc(c, naNewCCode(c, f_airport_runway))); - hashset(c, airportPrototype, "taxiway", naNewFunc(c, naNewCCode(c, f_airport_taxiway))); hashset(c, airportPrototype, "tower", naNewFunc(c, naNewCCode(c, f_airport_tower))); hashset(c, airportPrototype, "comms", naNewFunc(c, naNewCCode(c, f_airport_comms))); hashset(c, airportPrototype, "sids", naNewFunc(c, naNewCCode(c, f_airport_sids))); diff --git a/src/Traffic/Schedule.hxx b/src/Traffic/Schedule.hxx index 016c12c60..7a705cae5 100644 --- a/src/Traffic/Schedule.hxx +++ b/src/Traffic/Schedule.hxx @@ -140,8 +140,8 @@ class FGAISchedule }; -typedef vector ScheduleVector; -typedef vector::iterator ScheduleVectorIterator; +typedef std::vector ScheduleVector; +typedef std::vector::iterator ScheduleVectorIterator; bool compareSchedules(FGAISchedule*a, FGAISchedule*b); -- 2.39.5