diff --git a/CMakeLists.txt b/CMakeLists.txt index db0f8e7b3..1fde17c9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") if (FG_DATA_DIR) message(STATUS "Using explicit data-dir: ${FG_DATA_DIR}") else() - set(FG_DATA_DIR "${CMAKE_INSTALL_PREFIX}/lib/FlightGear") + set(FG_DATA_DIR "${CMAKE_INSTALL_PREFIX}/lib/FlightGear" CACHE PATH "Default location where data files are located") message(STATUS "Using default data-dir: ${FG_DATA_DIR}") endif() @@ -94,7 +94,7 @@ option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support" ON) option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF) option(WITH_FGPANEL "Set to ON to build the fgpanel application" ON) - +option(JPEG_FACTORY "Enable JPEG-factory support" OFF) if (MSVC) GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH) @@ -191,6 +191,26 @@ endif(ENABLE_LIBSVN) find_package(PLIB REQUIRED puaux pu js fnt) find_package(SimGear 2.5.0 REQUIRED) +if (JPEG_FACTORY) + # check simgear was built with JPEG-factory support + find_package(JPEG REQUIRED) + include_directories(${JPEG_INCLUDE_DIR}) + + set(CMAKE_REQUIRED_INCLUDES + ${SIMGEAR_INCLUDE_DIR} + ${JPEG_INCLUDE_DIR} + ${OPENSCENEGRAPH_INCLUDE_DIRS}) + + check_cxx_source_compiles( + "#include + int main() { return 0; } " + FG_JPEG_SERVER) + + if (NOT FG_JPEG_SERVER) + message(STATUS "JPEG server support requested, but SimGear was built without JPEG support") + endif() +endif() + check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) check_include_file(windows.h HAVE_WINDOWS_H) diff --git a/README.OSG b/README.OSG index b44695ad3..d547ffecc 100644 --- a/README.OSG +++ b/README.OSG @@ -3,11 +3,7 @@ You *must* have OpenSceneGraph (OSG) installed to build this version of FlightGear. -Notice that from FlightGear version 1.9.0, OSG version 2.7.8 or later -is required. Using earlier versions of OSG will yield serious -rendering bugs. If you are using an 'older' distribution, this may mean -a suitable version of OSG may not be availble through the usual package -repositories. +Notice that FlightGear 2.6.0 requires at least version 3.0.0. You can get the latest version of OSG from: diff --git a/README.cmake b/README.cmake index c74b4a558..f03333f5b 100644 --- a/README.cmake +++ b/README.cmake @@ -1,5 +1,7 @@ Getting started with CMake +[Windows instructions at the end of this document] + (These instructions apply to Unix-like systems, including Cygwin and Mac. To build using Visual Studio or some other IDE supported by CMake, most of the information below still applies) @@ -8,7 +10,7 @@ Always compile in a separate directory to the code. For example, if the code (eg, from Git) is at /home/curt/projects/flightgear, you might create /home/curt/projects/fgbuild. Change into the new directory, and run - cmake ../flightger + cmake ../flightgear To generate standard Unix Makefiles in fgbuild. @@ -153,3 +155,71 @@ If you add an additional line Then running 'make test' will run your executable as a unit test. The executable should return either a success or failure result code. + + + +SPECIAL INSTRUCTIONS TO BUILD UNDER WINDOWS WITH VISUAL STUDIO +============================================================== + +On Windows, assumptions on the directory structure are made to automate the discovery of dependencies. +This recommended directory structure is described below: + +${MSVC_3RDPARTY_ROOT} / + 3rdParty / ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ... + bin / + include / + lib / + 3rdParty.x64 / ( 64 bit version ) + ... + boost_1_44_0 / + boost / + install / + msvc100 / ( for VS2010 32 bits, or msvc90, msvc90-64 or msvc100-64 for VS2008 32, VS2008 64 and VS2010 64 ) + OpenSceneGraph / ( OSG CMake install + bin / + include / + lib / + SimGear / + include / + lib / + +If you do not use the recommended structure you will need to enter paths by hand. Source and build directories can be located anywhere. + +The suggested inputs to cmake are : + MSVC_3RDPARTY_ROOT : location of the above directory structure + CMAKE_INSTALL_PREFIX : ${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear (or any variation for the compiler version described above ) + + +1. Set up a work directory as described above. + +2. Open the Cmake gui. + +3. Set "Where is the source code" to wherever you put the FlightGear sources (from the released tarball or the git repository). + +4. Set "Where to build the binaries" to an empty directory. + +5. Press the "Configure" button. The first time that the project is configured, Cmake will bring up a window asking which compiler you wish to use. Normally just accept Cmakes suggestion, and press Finish. Cmake will now do a check on your system and will produce a preliminary build configuration. + +6. Cmake adds new configuration variables in red. Some have a value ending with -NOTFOUND. These variables should receive your attention. Some errors will prevent FlightGear to build and others will simply invalidate some options without provoking build errors. First check the MSVC_3RDPARTY_ROOT variable. If it is not set, chances are that there will be a lot of -NOTFOUND errors. Instead of trying to fix every error individually, set that variable and press the "Configure" button again. + +7. Also check the lines with a checkbox. These are build options and may impact the feature set of the built program. + +8. Change the CMAKE_INSTALL_PREFIX to ${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear because C:\Program Files is likely unwritable to ordinary Windows users and will integrate better with the above directory structure (this is mandatory for SimGear if you don't want to solve errors by hand). + +10. Repeat the process until the "Generate" button is enabled. + +11. Press the "Generate" button. + +12. Start Visual Studio 2010 and load the FlightGear solution (FlightGear.sln) located in "Where to build the binaries" (point 4.) + +13. Choose the "Release" build in the VS2010 "Generation" toolbar + +14. Generate the solution. + +15. If there are build errors, return to Cmake, clear remaining errors, "Configure" and "Generate" + +16. When Visual Studio is able to build everything without errors, build the INSTALL project to put the product files in ${CMAKE_INSTALL_PREFIX} + +17. Enjoy! + +PS: When updating the source from git, it is usually unnecessary to restart Cmake as the solution is able to reconfigure itself when Cmake files are changed. Simply rebuild the solution from Visual Studio and accept the reload of updated projects. It also possible to edit CMakeList.txt files directly in Visual Studio as they also appear in the solution, and projects will be reconfigured on the next generation. To change build options or directory path, it is mandatory to use the Cmake Gui. In case of problems, locate the CMakeCache.txt in "Where to build the binaries” directory and delete it to reconfigure from scratch or use the menu item File->Delete Cache. diff --git a/package/Win-NSIS/flightgear-nightly-vs2010.nsi b/package/Win-NSIS/flightgear-nightly-vs2010.nsi index 95f5ad90e..a6ce5f80c 100644 --- a/package/Win-NSIS/flightgear-nightly-vs2010.nsi +++ b/package/Win-NSIS/flightgear-nightly-vs2010.nsi @@ -89,7 +89,7 @@ Section "" ;No components page, name is not important ; VC runtime redistributables File "$%VCINSTALLDIR%\redist\x86\Microsoft.VC100.CRT\*.dll" - File /r ${FGRunDir}\share + File /r ${FGRunDir}\share\locale SetOutPath $INSTDIR\osgPlugins-${OSGVersion} File ${OSGPluginsDir}\osgdb_ac.dll @@ -102,6 +102,7 @@ Section "" ;No components page, name is not important File ${OSGPluginsDir}\osgdb_png.dll File ${OSGPluginsDir}\osgdb_dds.dll File ${OSGPluginsDir}\osgdb_txf.dll + File ${OSGPluginsDir}\osgdb_freetype.dll File ${OSGPluginsDir}\osgdb_serializers_osg.dll File ${OSGPluginsDir}\osgdb_serializers_osganimation.dll File ${OSGPluginsDir}\osgdb_serializers_osgfx.dll diff --git a/package/make-base-package.noarch.sh b/package/make-base-package.noarch.sh new file mode 100755 index 000000000..740f5ad2c --- /dev/null +++ b/package/make-base-package.noarch.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +echo $1 $2 + +if [ "x$1" != "x" ]; then + BASE="$1" +else + BASE="/home/curt/Projects/FlightGear/" +fi + +if [ "x$2" != "x" ]; then + VERSION="$2" +else + VERSION="2.5" +fi + +echo base dir = $BASE, version = $VERSION + +cd $BASE + +tar \ + --exclude=CVS \ + --exclude='*~' \ + --exclude='*.bak' \ + --exclude='*.tex' \ + --exclude='*.xcf' \ + --exclude='*/c172/Instruments.high' \ + --exclude='*/Textures/Unused' \ + --exclude='*/Textures/*.orig' \ + --exclude='*/Textures.high/*.new' \ + --exclude='*/Textures.high/*.orig' \ + --exclude='*/Textures.high/*.save' \ + --exclude='*/data/Data' \ + --exclude='*/Docs/source' \ + --exclude='*/Models/MNUAV' \ + --exclude='*/Models/Airspace' \ + -cjvf FlightGear-data-${VERSION}.tar.bz2 \ + data/AI \ + data/Aircraft/Generic \ + data/Aircraft/Instruments \ + data/Aircraft/Instruments-3d \ + data/Aircraft/UIUC \ + data/Aircraft/777-200 \ + data/Aircraft/A6M2 \ + data/Aircraft/ASK13 \ + data/Aircraft/b1900d \ + data/Aircraft/bo105 \ + data/Aircraft/c172p \ + data/Aircraft/CitationX \ + data/Aircraft/Dragonfly \ + data/Aircraft/dhc2 \ + data/Aircraft/f-14b \ + data/Aircraft/Cub \ + data/Aircraft/SenecaII \ + data/Aircraft/sopwithCamel \ + data/Aircraft/ufo \ + data/Aircraft/ZLT-NT \ + data/Airports \ + data/Astro \ + data/ATC \ + data/AUTHORS \ + data/ChangeLog \ + data/COPYING \ + data/D* \ + data/Effects \ + data/Environment \ + data/Fonts \ + data/gui \ + data/HLA \ + data/Huds \ + data/Input \ + data/joysticks.xml \ + data/keyboard.xml \ + data/Lighting \ + data/materials.dtd \ + data/materials.xml \ + data/mice.xml \ + data/Models \ + data/MP \ + data/N* \ + data/options.xml \ + data/preferences.xml \ + data/Protocol \ + data/README \ + data/Scenery/Airports \ + data/Scenery/Objects \ + data/Scenery/Terrain \ + data/Shaders \ + data/Sounds \ + data/T* \ + data/version diff --git a/projects/VC90/FlightGear/FlightGear.vcproj b/projects/VC90/FlightGear/FlightGear.vcproj index 58633d244..364454c1b 100644 --- a/projects/VC90/FlightGear/FlightGear.vcproj +++ b/projects/VC90/FlightGear/FlightGear.vcproj @@ -385,14 +385,6 @@ RelativePath="..\..\..\src\Aircraft\controls.hxx" > - - - - @@ -401,6 +393,14 @@ RelativePath="..\..\..\src\Aircraft\flightrecorder.hxx" > + + + + + + + + + + + + + + + + + + + + @@ -3753,6 +3785,14 @@ RelativePath="..\..\..\src\Instrumentation\mrg.hxx" > + + + + @@ -3777,14 +3817,6 @@ RelativePath="..\..\..\src\Instrumentation\od_gauge.hxx" > - - - - diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 2722886c6..69c519f63 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -820,10 +820,10 @@ bool FGAIAircraft::leadPointReached(FGAIWaypoint* curr) { } if (trafficRef) { //cerr << "Tracking callsign : \"" << fgGetString("/ai/track-callsign") << "\"" << endl; -/* if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) { - cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " " - << _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << " " << curr->name << " " << vs << " " << tgt_vs << " " << bearing << " " << minBearing << " " << speedFraction << endl; - }*/ + //if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) { + //cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " " + // << _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << " " << curr->getName() << " " << vs << " " << //tgt_vs << " " << bearing << " " << minBearing << " " << speedFraction << endl; + //} } if ((dist_to_go < lead_dist) || ((dist_to_go > prev_dist_to_go) && (bearing > (minBearing * 1.1))) ) { @@ -1275,9 +1275,9 @@ void FGAIAircraft::updateActualState() { updatePosition(); if (onGround()) - speed = _performance->actualSpeed(this, groundTargetSpeed, dt); + speed = _performance->actualSpeed(this, groundTargetSpeed, dt, holdPos); else - speed = _performance->actualSpeed(this, (tgt_speed *speedFraction), dt); + speed = _performance->actualSpeed(this, (tgt_speed *speedFraction), dt, false); //assertSpeed(speed); updateHeading(); roll = _performance->actualBankAngle(this, tgt_roll, dt); diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 93b8c1760..69442229c 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -267,7 +267,7 @@ bool FGAIBase::init(bool search_in_AI_path) { else _installed = true; - osg::Node * mdl = SGModelLib::loadPagedModel(f, props, new FGNasalModelData(props)); + osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, new FGNasalModelData(props)); if (_model.valid()) { diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index d50ff58da..8375c854e 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -357,7 +357,7 @@ void FGAIFlightPlan::createDefaultLandingTaxi(FGAIAircraft * ac, double heading, lat, lon; aAirport->getDynamics()->getParking(gateId, &lat, &lon, &heading); wpt = - createOnGround(ac, "END", SGGeod::fromDeg(lon, lat), airportElev, + createOnGround(ac, "ENDtaxi", SGGeod::fromDeg(lon, lat), airportElev, ac->getPerformance()->vTaxi()); pushBackWaypoint(wpt); } @@ -1039,7 +1039,7 @@ bool FGAIFlightPlan::createParking(FGAIAircraft * ac, FGAirport * apt, pushBackWaypoint(wpt); wpt = - createOnGround(ac, "END", SGGeod::fromDeg(lon, lat), aptElev, + createOnGround(ac, "END-Parking", SGGeod::fromDeg(lon, lat), aptElev, vTaxiReduced); pushBackWaypoint(wpt); return true; diff --git a/src/AIModel/AIFlightPlanCreatePushBack.cxx b/src/AIModel/AIFlightPlanCreatePushBack.cxx index c1da283ad..d5c79356e 100644 --- a/src/AIModel/AIFlightPlanCreatePushBack.cxx +++ b/src/AIModel/AIFlightPlanCreatePushBack.cxx @@ -38,13 +38,13 @@ // TODO: Use James Turner's createOnGround functions. bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, - bool firstFlight, FGAirport *dep, - double latitude, - double longitude, - double radius, - const string& fltType, - const string& aircraftType, - const string& airline) + bool firstFlight, FGAirport *dep, + double latitude, + double longitude, + double radius, + const string& fltType, + const string& aircraftType, + const string& airline) { double lat, lon, heading; double vTaxi = ac->getPerformance()->vTaxi(); @@ -56,185 +56,185 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, activeRunway.clear(); if (!(dep->getDynamics()->getGroundNetwork()->exists())) { - //cerr << "Push Back fallback" << endl; - createPushBackFallBack(ac, firstFlight, dep, latitude, longitude, - radius, fltType, aircraftType, airline); + //cerr << "Push Back fallback" << endl; + createPushBackFallBack(ac, firstFlight, dep, latitude, longitude, + radius, fltType, aircraftType, airline); } else { - if (firstFlight) { - - if (!(dep->getDynamics()->getAvailableParking(&lat, &lon, - &heading, &gateId, - radius, fltType, - aircraftType, airline))) { - SG_LOG(SG_INPUT, SG_WARN, "Warning: Could not find parking for a " << - aircraftType << - " of flight type " << fltType << - " of airline " << airline << - " at airport " << dep->getId()); - return false; - char buffer[10]; - snprintf (buffer, 10, "%d", gateId); - SGGeod coord = coord.fromDeg(lon, lat); - //FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(node); - FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiBackward); - wpt->setRouteIndex(-1); - pushBackWaypoint(wpt); - } - //cerr << "Success : GateId = " << gateId << endl; - SG_LOG(SG_INPUT, SG_WARN, "Warning: Succesfully found a parking for a " << - aircraftType << - " of flight type " << fltType << - " of airline " << airline << - " at airport " << dep->getId()); - } else { - //cerr << "Push Back follow-up Flight" << endl; - dep->getDynamics()->getParking(gateId, &lat, &lon, &heading); - } - if (gateId < 0) { - createPushBackFallBack(ac, firstFlight, dep, latitude, longitude, - radius, fltType, aircraftType, airline); - return true; + if (firstFlight) { - } - //cerr << "getting parking " << gateId; - //cerr << " for a " << - // aircraftType << - // " of flight type " << fltType << - // " of airline " << airline << - // " at airport " << dep->getId() << endl; - FGParking *parking = dep->getDynamics()->getParking(gateId); - int pushBackNode = parking->getPushBackPoint(); + if (!(dep->getDynamics()->getAvailableParking(&lat, &lon, + &heading, &gateId, + radius, fltType, + aircraftType, airline))) { + SG_LOG(SG_INPUT, SG_WARN, "Warning: Could not find parking for a " << + aircraftType << + " of flight type " << fltType << + " of airline " << airline << + " at airport " << dep->getId()); + return false; + char buffer[10]; + snprintf (buffer, 10, "%d", gateId); + SGGeod coord = coord.fromDeg(lon, lat); + //FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(node); + FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiBackward); + wpt->setRouteIndex(-1); + pushBackWaypoint(wpt); + } + //cerr << "Success : GateId = " << gateId << endl; + SG_LOG(SG_INPUT, SG_WARN, "Warning: Succesfully found a parking for a " << + aircraftType << + " of flight type " << fltType << + " of airline " << airline << + " at airport " << dep->getId()); + } else { + //cerr << "Push Back follow-up Flight" << endl; + dep->getDynamics()->getParking(gateId, &lat, &lon, &heading); + } + if (gateId < 0) { + createPushBackFallBack(ac, firstFlight, dep, latitude, longitude, + radius, fltType, aircraftType, airline); + return true; + + } + //cerr << "getting parking " << gateId; + //cerr << " for a " << + // aircraftType << + // " of flight type " << fltType << + // " of airline " << airline << + // " at airport " << dep->getId() << endl; + FGParking *parking = dep->getDynamics()->getParking(gateId); + int pushBackNode = parking->getPushBackPoint(); - pushBackRoute = parking->getPushBackRoute(); - if ((pushBackNode > 0) && (pushBackRoute == 0)) { // Load the already established route for this gate - int node, rte; - FGTaxiRoute route; - //cerr << "Creating push-back for " << gateId << " (" << parking->getName() << ") using push-back point " << pushBackNode << endl; - route = dep->getDynamics()->getGroundNetwork()->findShortestRoute(gateId, pushBackNode, false); - parking->setPushBackRoute(new FGTaxiRoute(route)); - + pushBackRoute = parking->getPushBackRoute(); + if ((pushBackNode > 0) && (pushBackRoute == 0)) { // Load the already established route for this gate + int node, rte; + FGTaxiRoute route; + //cerr << "Creating push-back for " << gateId << " (" << parking->getName() << ") using push-back point " << pushBackNode << endl; + route = dep->getDynamics()->getGroundNetwork()->findShortestRoute(gateId, pushBackNode, false); + parking->setPushBackRoute(new FGTaxiRoute(route)); - pushBackRoute = parking->getPushBackRoute(); - int size = pushBackRoute->size(); - if (size < 2) { - SG_LOG(SG_GENERAL, SG_WARN, "Push back route from gate " << gateId << " has only " << size << " nodes."); - SG_LOG(SG_GENERAL, SG_WARN, "Using " << pushBackNode); - } - pushBackRoute->first(); - while(pushBackRoute->next(&node, &rte)) - { - //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findSegment(node)->getEnd(); - char buffer[10]; - snprintf (buffer, 10, "%d", node); - FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(node); - //ids.pop_back(); - //wpt = new waypoint; - SGGeod coord = coord.fromDeg(tn->getLongitude(), tn->getLatitude()); - FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiBackward); - wpt->setRouteIndex(rte); - pushBackWaypoint(wpt); - } - // some special considerations for the last point: - waypoints.back()->setName(string("PushBackPoint")); - waypoints.back()->setSpeed(vTaxi); - ac->setTaxiClearanceRequest(true); - } else { // In case of a push forward departure... - ac->setTaxiClearanceRequest(false); - double lat2 = 0.0, lon2 = 0.0, az2 = 0.0; + pushBackRoute = parking->getPushBackRoute(); + int size = pushBackRoute->size(); + if (size < 2) { + SG_LOG(SG_GENERAL, SG_WARN, "Push back route from gate " << gateId << " has only " << size << " nodes."); + SG_LOG(SG_GENERAL, SG_WARN, "Using " << pushBackNode); + } + pushBackRoute->first(); + while (pushBackRoute->next(&node, &rte)) + { + //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findSegment(node)->getEnd(); + char buffer[10]; + snprintf (buffer, 10, "%d", node); + FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(node); + //ids.pop_back(); + //wpt = new waypoint; + SGGeod coord = coord.fromDeg(tn->getLongitude(), tn->getLatitude()); + FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiBackward); - //cerr << "Creating final push forward point for gate " << gateId << endl; - FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(gateId); - FGTaxiSegmentVectorIterator ts = tn->getBeginRoute(); - FGTaxiSegmentVectorIterator te = tn->getEndRoute(); - // if the starting node equals the ending node, then there aren't any routes for this parking. - // in cases like these we should flag the gate as being inoperative and return false - if (ts == te) { - SG_LOG(SG_GENERAL, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it."); - parking->setAvailable(false); - return false; - } - tn = (*ts)->getEnd(); - lastNodeVisited = tn->getIndex(); - if (tn == NULL) { - SG_LOG(SG_GENERAL, SG_ALERT, "No valid taxinode found"); - exit(1); - } - double distance = (*ts)->getLength(); - //cerr << "Length of push forward route = " << distance << " and heading is " << heading << endl; - lat2 = tn->getLatitude(); - lon2 = tn->getLongitude(); + wpt->setRouteIndex(rte); + pushBackWaypoint(wpt); + } + // some special considerations for the last point: + waypoints.back()->setName(string("PushBackPoint")); + waypoints.back()->setSpeed(vTaxi); + ac->setTaxiClearanceRequest(true); + } else { // In case of a push forward departure... + ac->setTaxiClearanceRequest(false); + double lat2 = 0.0, lon2 = 0.0, az2 = 0.0; - for (int i = 1; i < 10; i++) { - geo_direct_wgs_84 ( 0, lat, lon, heading, - ((i / 10.0) * distance), &lat2, &lon2, &az2 ); - char buffer[16]; - snprintf(buffer, 16, "pushback-%02d", i); - SGGeod coord = coord.fromDeg(lon2, lat2); - //cerr << i << endl; - FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiReduced); + //cerr << "Creating final push forward point for gate " << gateId << endl; + FGTaxiNode *tn = dep->getDynamics()->getGroundNetwork()->findNode(gateId); + FGTaxiSegmentVectorIterator ts = tn->getBeginRoute(); + FGTaxiSegmentVectorIterator te = tn->getEndRoute(); + // if the starting node equals the ending node, then there aren't any routes for this parking. + // in cases like these we should flag the gate as being inoperative and return false + if (ts == te) { + SG_LOG(SG_GENERAL, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it."); + parking->setAvailable(false); + return false; + } + tn = (*ts)->getEnd(); + lastNodeVisited = tn->getIndex(); + if (tn == NULL) { + SG_LOG(SG_GENERAL, SG_ALERT, "No valid taxinode found"); + exit(1); + } + double distance = (*ts)->getLength(); + //cerr << "Length of push forward route = " << distance << " and heading is " << heading << endl; + lat2 = tn->getLatitude(); + lon2 = tn->getLongitude(); - wpt->setRouteIndex((*ts)->getIndex()); - pushBackWaypoint(wpt); - } - // cerr << "Done " << endl; - waypoints.back()->setName(string("PushBackPoint")); - // cerr << "Done assinging new name" << endl; - } + for (int i = 1; i < 10; i++) { + geo_direct_wgs_84 ( 0, lat, lon, heading, + ((i / 10.0) * distance), &lat2, &lon2, &az2 ); + char buffer[16]; + snprintf(buffer, 16, "pushback-%02d", i); + SGGeod coord = coord.fromDeg(lon2, lat2); + //cerr << i << endl; + FGAIWaypoint *wpt = createOnGround(ac, string(buffer), coord, dep->getElevation(), vTaxiReduced); + + wpt->setRouteIndex((*ts)->getIndex()); + pushBackWaypoint(wpt); + } + // cerr << "Done " << endl; + waypoints.back()->setName(string("PushBackPoint")); + // cerr << "Done assinging new name" << endl; + } } return true; } /******************************************************************* * createPushBackFallBack -* This is the backup function for airports that don't have a -* network yet. +* This is the backup function for airports that don't have a +* network yet. ******************************************************************/ -void FGAIFlightPlan::createPushBackFallBack(FGAIAircraft *ac, bool firstFlight, FGAirport *dep, - double latitude, - double longitude, - double radius, - const string& fltType, - const string& aircraftType, - const string& airline) +void FGAIFlightPlan::createPushBackFallBack(FGAIAircraft *ac, bool firstFlight, FGAirport *dep, + double latitude, + double longitude, + double radius, + const string& fltType, + const string& aircraftType, + const string& airline) { - double heading; - double lat; - double lon; - double lat2 = 0.0; - double lon2 = 0.0; - double az2 = 0.0; + double heading; + double lat; + double lon; + double lat2 = 0.0; + double lon2 = 0.0; + double az2 = 0.0; - double vTaxi = ac->getPerformance()->vTaxi(); - double vTaxiBackward = vTaxi * (-2.0/3.0); - double vTaxiReduced = vTaxi * (2.0/3.0); + double vTaxi = ac->getPerformance()->vTaxi(); + double vTaxiBackward = vTaxi * (-2.0/3.0); + double vTaxiReduced = vTaxi * (2.0/3.0); - dep->getDynamics()->getParking(-1, &lat, &lon, &heading); + dep->getDynamics()->getParking(-1, &lat, &lon, &heading); - heading += 180.0; - if (heading > 360) - heading -= 360; + heading += 180.0; + if (heading > 360) + heading -= 360; - SGGeod coord = coord.fromDeg(lon, lat); - FGAIWaypoint *wpt = createOnGround(ac, string("park"), coord, dep->getElevation(), vTaxiBackward); + SGGeod coord = coord.fromDeg(lon, lat); + FGAIWaypoint *wpt = createOnGround(ac, string("park"), coord, dep->getElevation(), vTaxiBackward); - pushBackWaypoint(wpt); + pushBackWaypoint(wpt); - geo_direct_wgs_84 ( 0, lat, lon, heading, - 10, - &lat2, &lon2, &az2 ); - coord = coord.fromDeg(lon2, lat2); - wpt = createOnGround(ac, string("park2"), coord, dep->getElevation(), vTaxiBackward); + geo_direct_wgs_84 ( 0, lat, lon, heading, + 10, + &lat2, &lon2, &az2 ); + coord = coord.fromDeg(lon2, lat2); + wpt = createOnGround(ac, string("park2"), coord, dep->getElevation(), vTaxiBackward); - pushBackWaypoint(wpt); + pushBackWaypoint(wpt); - geo_direct_wgs_84 ( 0, lat, lon, heading, - 2.2*radius, - &lat2, &lon2, &az2 ); - coord = coord.fromDeg(lon2, lat2); - wpt = createOnGround(ac, string("taxiStart"), coord, dep->getElevation(), vTaxiReduced); - pushBackWaypoint(wpt); + geo_direct_wgs_84 ( 0, lat, lon, heading, + 2.2*radius, + &lat2, &lon2, &az2 ); + coord = coord.fromDeg(lon2, lat2); + wpt = createOnGround(ac, string("taxiStart"), coord, dep->getElevation(), vTaxiReduced); + pushBackWaypoint(wpt); } diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 2ad548371..731983f25 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -146,7 +146,7 @@ FGAIManager::update(double dt) { if (!enabled) return; - FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("Traffic Manager"); + FGTrafficManager *tmgr = (FGTrafficManager*) globals->get_subsystem("traffic-manager"); _dt = dt; ai_list_iterator ai_list_itr = ai_list.begin(); diff --git a/src/AIModel/performancedata.cxx b/src/AIModel/performancedata.cxx index 1c7b02912..f8da70de6 100644 --- a/src/AIModel/performancedata.cxx +++ b/src/AIModel/performancedata.cxx @@ -49,7 +49,7 @@ PerformanceData::PerformanceData( const std::string& filename) PerformanceData::~PerformanceData() {} -double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt) { +double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool maxBrakes) { // if (tgt_speed > _vTaxi & ac->onGround()) // maximum taxi speed on ground // tgt_speed = _vTaxi; // bad idea for a take off roll :-) @@ -66,7 +66,13 @@ double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double d } else if (speed_diff < 0.0) { // decelerate if (ac->onGround()) { // deceleration performance is better due to wheel brakes. - speed -= BRAKE_SETTING * _deceleration * dt; + double brakePower = 0; + if (maxBrakes) { + brakePower = 3; + } else { + brakePower = BRAKE_SETTING; + } + speed -= brakePower * _deceleration * dt; } else { speed -= _deceleration * dt; } diff --git a/src/AIModel/performancedata.hxx b/src/AIModel/performancedata.hxx index a966b5776..41b89ca7c 100644 --- a/src/AIModel/performancedata.hxx +++ b/src/AIModel/performancedata.hxx @@ -29,7 +29,7 @@ public: PerformanceData(const std::string& filename); ~PerformanceData(); - double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt); + double actualSpeed(FGAIAircraft* ac, double tgt_speed, double dt, bool needMaxBrake); double actualBankAngle(FGAIAircraft* ac, double tgt_roll, double dt); double actualPitch(FGAIAircraft* ac, double tgt_pitch, double dt); double actualHeading(FGAIAircraft* ac, double tgt_heading, double dt); diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index a25212198..83bb681b0 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -45,7 +45,7 @@ FGSubmodelMgr::~FGSubmodelMgr() FGAIManager* FGSubmodelMgr::aiManager() { - return (FGAIManager*)globals->get_subsystem("ai_model"); + return (FGAIManager*)globals->get_subsystem("ai-model"); } void FGSubmodelMgr::init() diff --git a/src/ATC/atc_mgr.cxx b/src/ATC/atc_mgr.cxx index 22e5db5e8..33d90a9a4 100644 --- a/src/ATC/atc_mgr.cxx +++ b/src/ATC/atc_mgr.cxx @@ -100,7 +100,7 @@ void FGATCManager::init() { FGAirport *apt = FGAirport::findByIdent(airport); - if (apt && onGround) { + if (apt && onGround && !runway.empty()) { FGAirportDynamics* dcs = apt->getDynamics(); int park_index = dcs->getNrOfParkings() - 1; //cerr << "found information: " << runway << " " << airport << ": parking = " << parking << endl; diff --git a/src/ATC/atcdialog.cxx b/src/ATC/atcdialog.cxx index d2aad836e..5185ee0c0 100644 --- a/src/ATC/atcdialog.cxx +++ b/src/ATC/atcdialog.cxx @@ -18,8 +18,13 @@ // // $Id$ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include
#include
+#include
#include #include diff --git a/src/ATCDCL/ATCDialogOld.cxx b/src/ATCDCL/ATCDialogOld.cxx index bb3cc1650..b1824180c 100644 --- a/src/ATCDCL/ATCDialogOld.cxx +++ b/src/ATCDCL/ATCDialogOld.cxx @@ -30,6 +30,7 @@ #include
#include // mkDialog #include +#include
#include "ATCDialogOld.hxx" #include "ATC.hxx" @@ -205,7 +206,13 @@ void FGATCDialog::PopupDialog() { button_group->removeChildren("button", false); string label; - FGATC* atcptr = globals->get_ATC_mgr()->GetComm1ATCPointer(); // Hardwired to comm1 at the moment + FGATCMgr* pAtcMgr = globals->get_ATC_mgr(); + if (!pAtcMgr) + { + SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops..."); + return; + } + FGATC* atcptr = pAtcMgr->GetComm1ATCPointer(); // Hardwired to comm1 at the moment if (!atcptr) { label = "Not currently tuned to any ATC service"; @@ -260,7 +267,13 @@ void FGATCDialog::PopupDialog() { } void FGATCDialog::PopupCallback(int num) { - FGATC* atcptr = globals->get_ATC_mgr()->GetComm1ATCPointer(); // FIXME - Hardwired to comm1 at the moment + FGATCMgr* pAtcMgr = globals->get_ATC_mgr(); + if (!pAtcMgr) + { + SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops..."); + return; + } + FGATC* atcptr = pAtcMgr->GetComm1ATCPointer(); // FIXME - Hardwired to comm1 at the moment if (!atcptr) return; diff --git a/src/ATCDCL/ATCmgr.cxx b/src/ATCDCL/ATCmgr.cxx index dc0901153..69a0b1179 100644 --- a/src/ATCDCL/ATCmgr.cxx +++ b/src/ATCDCL/ATCmgr.cxx @@ -48,9 +48,11 @@ FGATCMgr::FGATCMgr() : voice(false), #endif { + globals->set_ATC_mgr(this); } FGATCMgr::~FGATCMgr() { + globals->set_ATC_mgr(NULL); delete v1; } diff --git a/src/ATCDCL/atis.cxx b/src/ATCDCL/atis.cxx index dad36fb0a..b87369e1a 100644 --- a/src/ATCDCL/atis.cxx +++ b/src/ATCDCL/atis.cxx @@ -76,7 +76,14 @@ FGATIS::FGATIS() : _prev_display(0), refname("atis") { - _vPtr = globals->get_ATC_mgr()->GetVoicePointer(ATIS); + FGATCMgr* pAtcMgr = globals->get_ATC_mgr(); + if (!pAtcMgr) + { + SG_LOG(SG_ATC, SG_ALERT, "ERROR! No ATC manager! Oops..."); + _vPtr = NULL; + } + else + _vPtr = pAtcMgr->GetVoicePointer(ATIS); _voiceOK = (_vPtr == NULL ? false : true); if (!(_type != ATIS || _type == AWOS)) { SG_LOG(SG_ATC, SG_ALERT, "ERROR - _type not ATIS or AWOS in atis.cxx"); diff --git a/src/Aircraft/flightrecorder.cxx b/src/Aircraft/flightrecorder.cxx index 6c3efc0a5..dd4ccc15f 100644 --- a/src/Aircraft/flightrecorder.cxx +++ b/src/Aircraft/flightrecorder.cxx @@ -20,6 +20,10 @@ // /////////////////////////////////////////////////////////////////////////////// +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include diff --git a/src/Airports/dynamics.cxx b/src/Airports/dynamics.cxx index 293d2ff6a..5a077968d 100644 --- a/src/Airports/dynamics.cxx +++ b/src/Airports/dynamics.cxx @@ -102,6 +102,7 @@ bool FGAirportDynamics::getAvailableParking(double *lat, double *lon, //cerr << "Could not find parking spot at " << _ap->getId() << endl; *lat = _ap->getLatitude(); *lon = _ap->getLongitude(); + * gateId = -1; *heading = 0; found = true; } else { diff --git a/src/Airports/groundnetwork.cxx b/src/Airports/groundnetwork.cxx index f817e3035..d722b86ab 100644 --- a/src/Airports/groundnetwork.cxx +++ b/src/Airports/groundnetwork.cxx @@ -26,6 +26,7 @@ #include #include +#include #include diff --git a/src/Airports/xmlloader.cxx b/src/Airports/xmlloader.cxx index 273e2f67f..b2ce07ed4 100644 --- a/src/Airports/xmlloader.cxx +++ b/src/Airports/xmlloader.cxx @@ -13,6 +13,10 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 916771726..6cdce3d70 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -57,7 +57,7 @@ #include
#include
#include