diff --git a/src/ATC/tower.cxx b/src/ATC/tower.cxx index 25801f5d6..4b8115df6 100644 --- a/src/ATC/tower.cxx +++ b/src/ATC/tower.cxx @@ -1109,6 +1109,8 @@ void FGTower::CheckCircuitList(double dt) { circuitListItr = circuitList.erase(circuitListItr); if(circuitListItr == circuitList.end() ) { circuitListItr = circuitList.begin(); + // avoid increment of circuitListItr (would increment to second element, or crash if no element left) + return; } } ++circuitListItr; diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index f6c526403..75a9b6417 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -263,7 +263,7 @@ void FGClouds::buildMETAR(void) { // copy from FGMetarEnvironmentCtrl until better void -FGClouds::update_metar_properties( FGMetar *m ) +FGClouds::update_metar_properties( const FGMetar *m ) { int i; double d; diff --git a/src/Environment/fgclouds.hxx b/src/Environment/fgclouds.hxx index e5840fbe1..ae555b363 100644 --- a/src/Environment/fgclouds.hxx +++ b/src/Environment/fgclouds.hxx @@ -51,7 +51,7 @@ private: void setLayer( int iLayer, float alt_m, const string& coverage, const string& layer_type ); - void update_metar_properties( FGMetar *m ); + void update_metar_properties( const FGMetar *m ); void FGClouds::update_env_config (); diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index 1e3b73a2c..3d7fe4d79 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -85,7 +85,6 @@ void FGTrafficManager::init() { currAircraft=scheduledAircraft.erase(currAircraft); //cerr << "Erasing " << currAircraft->getRegistration() << endl; - currAircraft--; } else { @@ -102,6 +101,8 @@ void FGTrafficManager::init() void FGTrafficManager::update(double something) { time_t now = time(NULL) + fgGetLong("/sim/time/warp"); + if (scheduledAircraft.size() == 0) + return; if(currAircraft == scheduledAircraft.end()) { //cerr << "resetting schedule " << endl;