diff --git a/package/Win32-Inno/FlightGear-1.9.iss b/package/Win32-Inno/FlightGear-1.9.iss old mode 100755 new mode 100644 diff --git a/projects/VC8/FGJS.vcproj b/projects/VC8/FGJS.vcproj old mode 100755 new mode 100644 diff --git a/projects/VC8/FlightGear.sln b/projects/VC8/FlightGear.sln old mode 100755 new mode 100644 diff --git a/projects/VC8/FlightGear.vcproj b/projects/VC8/FlightGear.vcproj old mode 100755 new mode 100644 diff --git a/projects/VC8/FlightGearLib.vcproj b/projects/VC8/FlightGearLib.vcproj old mode 100755 new mode 100644 diff --git a/projects/VC90/flightgear.ico b/projects/VC90/flightgear.ico old mode 100755 new mode 100644 diff --git a/projects/VC90/flightgear.rc b/projects/VC90/flightgear.rc old mode 100755 new mode 100644 diff --git a/src/AIModel/AIMultiplayer.cxx b/src/AIModel/AIMultiplayer.cxx index 476ddf205..0652dfef7 100644 --- a/src/AIModel/AIMultiplayer.cxx +++ b/src/AIModel/AIMultiplayer.cxx @@ -335,35 +335,13 @@ void FGAIMultiplayer::update(double dt) if (prevIt != mMotionInfo.begin()) { --prevIt; - - MotionInfo::iterator delIt; - delIt = mMotionInfo.begin(); - - while (delIt != prevIt) - { - std::vector::const_iterator propIt; - std::vector::const_iterator propItEnd; - propIt = delIt->second.properties.begin(); - propItEnd = delIt->second.properties.end(); - - //cout << "Deleting data\n"; - - while (propIt != propItEnd) - { - delete *propIt; - propIt++; - } - - delIt++; - } - mMotionInfo.erase(mMotionInfo.begin(), prevIt); } } } else { // Ok, we need to predict the future, so, take the best data we can have // and do some eom computation to guess that for now. - FGExternalMotionData motionInfo = it->second; + FGExternalMotionData& motionInfo = it->second; // The time to predict, limit to 5 seconds double t = tInterp - motionInfo.time; @@ -488,7 +466,7 @@ void FGAIMultiplayer::update(double dt) } void -FGAIMultiplayer::addMotionInfo(const FGExternalMotionData& motionInfo, +FGAIMultiplayer::addMotionInfo(FGExternalMotionData& motionInfo, long stamp) { mLastTimestamp = stamp; @@ -505,6 +483,9 @@ FGAIMultiplayer::addMotionInfo(const FGExternalMotionData& motionInfo, return; } mMotionInfo[motionInfo.time] = motionInfo; + // We just copied the property (pointer) list - they are ours now. Clear the + // properties list in given/returned object, so former owner won't deallocate them. + motionInfo.properties.clear(); } void diff --git a/src/AIModel/AIMultiplayer.hxx b/src/AIModel/AIMultiplayer.hxx index e484dacb0..d79f0c206 100644 --- a/src/AIModel/AIMultiplayer.hxx +++ b/src/AIModel/AIMultiplayer.hxx @@ -37,7 +37,7 @@ public: virtual void unbind(); virtual void update(double dt); - void addMotionInfo(const FGExternalMotionData& motionInfo, long stamp); + void addMotionInfo(FGExternalMotionData& motionInfo, long stamp); void setDoubleProperty(const std::string& prop, double val); long getLastTimestamp(void) const diff --git a/src/Airports/pavement.cxx b/src/Airports/pavement.cxx old mode 100755 new mode 100644 diff --git a/src/Airports/pavement.hxx b/src/Airports/pavement.hxx old mode 100755 new mode 100644 diff --git a/src/Environment/presets.cxx b/src/Environment/presets.cxx old mode 100755 new mode 100644 diff --git a/src/Environment/presets.hxx b/src/Environment/presets.hxx old mode 100755 new mode 100644 diff --git a/src/Environment/ridge_lift.cxx b/src/Environment/ridge_lift.cxx index 5f0bd2639..3b675a93f 100644 --- a/src/Environment/ridge_lift.cxx +++ b/src/Environment/ridge_lift.cxx @@ -36,25 +36,12 @@ #include #include #include - +#include using std::string; #include "ridge_lift.hxx" -static string CreateIndexedPropertyName(string Property, int index) -{ - std::stringstream str; - str << index; - string tmp; - str >> tmp; - return Property + "[" + tmp + "]"; -} - -static inline double sign(double x) { - return x == 0 ? 0 : x > 0 ? 1.0 : -1.0; -} - static const double BOUNDARY1_m = 40.0; const double FGRidgeLift::dist_probe_m[] = { // in meters @@ -172,7 +159,7 @@ void FGRidgeLift::update(double dt) { slope[3] = (probe_elev_m[4] - probe_elev_m[0]) / -dist_probe_m[4]; for (unsigned i = 0; i < sizeof(slope)/sizeof(slope[0]); i++) - adj_slope[i] = sin(atan(5.0 * pow ( (fabs(slope[i])),1.7) ) ) *sign(slope[i]); + adj_slope[i] = sin(atan(5.0 * pow ( (fabs(slope[i])),1.7) ) ) *SG_SIGN(slope[i]); //adjustment adj_slope[0] *= 0.2; diff --git a/src/FDM/JSBSim/input_output/FGPropertyManager.cpp b/src/FDM/JSBSim/input_output/FGPropertyManager.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGScript.cpp b/src/FDM/JSBSim/input_output/FGScript.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGXMLElement.cpp b/src/FDM/JSBSim/input_output/FGXMLElement.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGXMLElement.h b/src/FDM/JSBSim/input_output/FGXMLElement.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGXMLFileRead.h b/src/FDM/JSBSim/input_output/FGXMLFileRead.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGXMLParse.cpp b/src/FDM/JSBSim/input_output/FGXMLParse.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/input_output/FGXMLParse.h b/src/FDM/JSBSim/input_output/FGXMLParse.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGFunction.cpp b/src/FDM/JSBSim/math/FGFunction.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGFunction.h b/src/FDM/JSBSim/math/FGFunction.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGModelFunctions.cpp b/src/FDM/JSBSim/math/FGModelFunctions.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGModelFunctions.h b/src/FDM/JSBSim/math/FGModelFunctions.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGParameter.h b/src/FDM/JSBSim/math/FGParameter.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGPropertyValue.cpp b/src/FDM/JSBSim/math/FGPropertyValue.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGPropertyValue.h b/src/FDM/JSBSim/math/FGPropertyValue.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGRealValue.cpp b/src/FDM/JSBSim/math/FGRealValue.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/math/FGRealValue.h b/src/FDM/JSBSim/math/FGRealValue.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGAuxiliary.cpp b/src/FDM/JSBSim/models/FGAuxiliary.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGExternalForce.cpp b/src/FDM/JSBSim/models/FGExternalForce.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGExternalForce.h b/src/FDM/JSBSim/models/FGExternalForce.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGExternalReactions.cpp b/src/FDM/JSBSim/models/FGExternalReactions.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGExternalReactions.h b/src/FDM/JSBSim/models/FGExternalReactions.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGInput.cpp b/src/FDM/JSBSim/models/FGInput.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/FGInput.h b/src/FDM/JSBSim/models/FGInput.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp b/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/atmosphere/FGMSIS.h b/src/FDM/JSBSim/models/atmosphere/FGMSIS.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/atmosphere/FGMSISData.cpp b/src/FDM/JSBSim/models/atmosphere/FGMSISData.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/atmosphere/FGMars.cpp b/src/FDM/JSBSim/models/atmosphere/FGMars.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/atmosphere/FGMars.h b/src/FDM/JSBSim/models/atmosphere/FGMars.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGGyro.cpp b/src/FDM/JSBSim/models/flight_control/FGGyro.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGGyro.h b/src/FDM/JSBSim/models/flight_control/FGGyro.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp b/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGMagnetometer.h b/src/FDM/JSBSim/models/flight_control/FGMagnetometer.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGPID.cpp b/src/FDM/JSBSim/models/flight_control/FGPID.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGPID.h b/src/FDM/JSBSim/models/flight_control/FGPID.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGSensor.cpp b/src/FDM/JSBSim/models/flight_control/FGSensor.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGSensor.h b/src/FDM/JSBSim/models/flight_control/FGSensor.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/flight_control/FGSensorOrientation.h b/src/FDM/JSBSim/models/flight_control/FGSensorOrientation.h old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp b/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/JSBSim/models/propulsion/FGTurboProp.h b/src/FDM/JSBSim/models/propulsion/FGTurboProp.h old mode 100755 new mode 100644 diff --git a/src/FDM/YASim/Hitch.cpp b/src/FDM/YASim/Hitch.cpp old mode 100755 new mode 100644 diff --git a/src/FDM/YASim/Hitch.hpp b/src/FDM/YASim/Hitch.hpp old mode 100755 new mode 100644 diff --git a/src/Instrumentation/mk_viii.cxx b/src/Instrumentation/mk_viii.cxx old mode 100755 new mode 100644 diff --git a/src/Instrumentation/mk_viii.hxx b/src/Instrumentation/mk_viii.hxx old mode 100755 new mode 100644 diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index 4be95c416..5ae4e554f 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -61,28 +61,37 @@ static double sawtooth(double xx) return 4.0 * fabs(xx/4.0 + 0.25 - floor(xx/4.0 + 0.75)) - 1.0; } -// Calculate a unit vector in the horizontal tangent plane -// starting at the given "tail" of the vector and going off -// with the given heading. -static SGVec3d tangentVector(const SGGeod& tail, const SGVec3d& tail_xyz, - const double heading) +// Calculate a Cartesian unit vector in the +// local horizontal plane, i.e. tangent to the +// surface of the earth at the local ground zero. +// The tangent vector passes through the given +// and points forward along the given . +// The is given in degrees. +static SGVec3d tangentVector(const SGGeod& midpoint, const double heading) { -// The fudge factor here is presumably intended to improve -// numerical stability. I don't know if it is necessary. -// It gets divided out later. - double fudge(100.0); - SGGeod head; - double az2; // ignored - SGGeodesy::direct(tail, heading, fudge, head, az2); - head.setElevationM(tail.getElevationM()); +// The size of the delta is presumably chosen to give +// numerical stability. I don't know how the value was chosen. +// It probably doesn't matter much. It gets divided out. + double delta(100.0); // in meters + SGGeod head, tail; + double az2; // ignored + SGGeodesy::direct(midpoint, heading, delta, head, az2); + SGGeodesy::direct(midpoint, 180+heading, delta, tail, az2); + head.setElevationM(midpoint.getElevationM()); + tail.setElevationM(midpoint.getElevationM()); SGVec3d head_xyz = SGVec3d::fromGeod(head); - return (head_xyz - tail_xyz) * (1.0/fudge); + SGVec3d tail_xyz = SGVec3d::fromGeod(tail); +// Awkward formula here, needed because vector-by-scalar +// multiplication is defined, but not vector-by-scalar division. + return (head_xyz - tail_xyz) * (0.5/delta); } // Create a "serviceable" node with a default value of "true" -SGPropertyNode_ptr createServiceableProp(SGPropertyNode* aParent, const char* aName) +SGPropertyNode_ptr createServiceableProp(SGPropertyNode* aParent, + const char* aName) { - SGPropertyNode_ptr n = (aParent->getChild(aName, 0, true)->getChild("serviceable", 0, true)); + SGPropertyNode_ptr n = + aParent->getChild(aName, 0, true)->getChild("serviceable", 0, true); simgear::props::Type typ = n->getType(); if ((typ == simgear::props::NONE) || (typ == simgear::props::UNSPECIFIED)) { n->setBoolValue(true); @@ -231,6 +240,7 @@ FGNavRadio::init () gs_deflection_node = node->getChild("gs-needle-deflection", 0, true); gs_deflection_deg_node = node->getChild("gs-needle-deflection-deg", 0, true); gs_deflection_norm_node = node->getChild("gs-needle-deflection-norm", 0, true); + gs_direct_node = node->getChild("gs-direct-deg", 0, true); gs_rate_of_climb_node = node->getChild("gs-rate-of-climb", 0, true); gs_rate_of_climb_fpm_node = node->getChild("gs-rate-of-climb-fpm", 0, true); gs_dist_node = node->getChild("gs-distance", 0, true); @@ -393,6 +403,7 @@ void FGNavRadio::clearOutputs() gs_deflection_node->setDoubleValue( 0.0 ); gs_deflection_deg_node->setDoubleValue(0.0); gs_deflection_norm_node->setDoubleValue(0.0); + gs_direct_node->setDoubleValue(0.0); gs_inrange_node->setBoolValue( false ); loc_node->setBoolValue( false ); has_gs_node->setBoolValue(false); @@ -592,19 +603,27 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig bool gsInRange = (gsDist < (_gs->get_range() * SG_NM_TO_METER)); gs_inrange_node->setBoolValue(gsInRange); - if (!gsInRange) { - _gsNeedleDeflection = 0.0; - _gsNeedleDeflectionNorm = 0.0; - return; - } + if (!gsInRange) return; SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft // The positive GS axis points along the runway in the landing direction, // toward the far end, not toward the approach area, so we need a - sign here: - double dot_h = -dot(pos, _gsAxis); - double dot_v = dot(pos, _gsVertical); - double angle = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES; - double deflectionAngle = target_gs - angle; + double comp_h = -dot(pos, _gsAxis); // component in horiz direction + double comp_v = dot(pos, _gsVertical); // component in vertical direction + //double comp_b = dot(pos, _gsBaseline); // component in baseline direction + //if (comp_b) {} // ... (useful for debugging) + +// _gsDirect represents the angle of elevation of the aircraft +// as seen by the GS transmitter. + _gsDirect = atan2(comp_v, comp_h) * SGD_RADIANS_TO_DEGREES; +// At this point, if the aircraft is centered on the glide slope, +// _gsDirect will be a small positive number, e.g. 3.0 degrees + +// Aim the branch cut straight down +// into the ground below the GS transmitter: + if (_gsDirect < -90.0) _gsDirect += 360.0; + + double deflectionAngle = target_gs - _gsDirect; if (falseCoursesEnabledNode->getBoolValue()) { // Construct false glideslopes. The scale factor of 1.5 @@ -624,20 +643,27 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig } } +// GS is documented to be 1.4 degrees thick, +// i.e. plus or minus 0.7 degrees from the midline: + SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7); + +// Many older instrument xml frontends depend on +// the un-normalized gs-needle-deflection. +// Apparently the interface standard is plus or minus 3.5 "volts" +// for a full-scale deflection: _gsNeedleDeflection = deflectionAngle * 5.0; _gsNeedleDeflection *= signal_quality_norm; - SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7); _gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm; ////////////////////////////////////////////////////////// // Calculate desired rate of climb for intercepting the GS ////////////////////////////////////////////////////////// - double gs_diff = target_gs - angle; + double gs_diff = target_gs - _gsDirect; // convert desired vertical path angle into a climb rate - double des_angle = angle - 10 * gs_diff; + double des_angle = _gsDirect - 10 * gs_diff; /* printf("target_gs=%.1f angle=%.1f gs_diff=%.1f des_angle=%.1f\n", - target_gs, angle, gs_diff, des_angle); */ + target_gs, _gsDirect, gs_diff, des_angle); */ // estimate horizontal speed towards ILS in meters per minute double elapsedDistance = last_x - gsDist; @@ -798,7 +824,7 @@ void FGNavRadio::updateCDI(double dt) ////////////////////////////////////////////////////////// // compute the time to intercept selected radial (based on - // current and last cross track errors and dt + // current and last cross track errors and dt) ////////////////////////////////////////////////////////// double t = 0.0; if ( inrange && cdi_serviceable ) { @@ -819,6 +845,7 @@ void FGNavRadio::updateCDI(double dt) gs_deflection_node->setDoubleValue(_gsNeedleDeflection); gs_deflection_deg_node->setDoubleValue(_gsNeedleDeflectionNorm * 0.7); gs_deflection_norm_node->setDoubleValue(_gsNeedleDeflectionNorm); + gs_direct_node->setDoubleValue(_gsDirect); last_xtrack_error = _cdiCrossTrackErrorM; } @@ -939,24 +966,19 @@ void FGNavRadio::search() if (_gs) { int tmp = (int)(_gs->get_multiuse() / 1000.0); target_gs = (double)tmp / 100.0; - - // until penaltyForNav goes away, we cannot assume we always pick - // paired LOC/GS trasmsitters. As we pass over a runway threshold, we - // often end up picking the 'wrong' LOC, but the correct GS. To avoid - // breaking the basis computation, ensure we use the GS radial and not - // the (potentially reversed) LOC radial. + double gs_radial = fmod(_gs->get_multiuse(), 1000.0); SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0); - - // GS axis unit tangent vector - // (along the runway) _gsCart = _gs->cart(); - _gsAxis = tangentVector(_gs->geod(), _gsCart, gs_radial); + + // GS axis unit tangent vector + // (along the runway): + _gsAxis = tangentVector(_gs->geod(), gs_radial); // GS baseline unit tangent vector - // (perpendicular to the runay along the ground) - SGVec3d baseline = tangentVector(_gs->geod(), _gsCart, gs_radial + 90.0); - _gsVertical = cross(baseline, _gsAxis); + // (transverse to the runay along the ground) + _gsBaseline = tangentVector(_gs->geod(), gs_radial + 90.0); + _gsVertical = cross(_gsBaseline, _gsAxis); } // of have glideslope } // of found LOC or ILS diff --git a/src/Instrumentation/navradio.hxx b/src/Instrumentation/navradio.hxx index 5aa1c7229..96621b6d0 100644 --- a/src/Instrumentation/navradio.hxx +++ b/src/Instrumentation/navradio.hxx @@ -102,6 +102,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener SGPropertyNode_ptr gs_deflection_node; SGPropertyNode_ptr gs_deflection_deg_node; SGPropertyNode_ptr gs_deflection_norm_node; + SGPropertyNode_ptr gs_direct_node; SGPropertyNode_ptr gs_rate_of_climb_node; SGPropertyNode_ptr gs_rate_of_climb_fpm_node; SGPropertyNode_ptr gs_dist_node; @@ -152,7 +153,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener // internal periodic station search timer double _time_before_search_sec; - SGVec3d _gsCart, _gsAxis, _gsVertical; + SGVec3d _gsCart, _gsAxis, _gsVertical, _gsBaseline; FGNavRecordPtr _dme; bool _dmeInRange; @@ -163,6 +164,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener double _cdiCrossTrackErrorM; double _gsNeedleDeflection; double _gsNeedleDeflectionNorm; + double _gsDirect; SGSharedPtr _sgr; std::vector _tiedNodes; diff --git a/src/Instrumentation/tacan.cxx b/src/Instrumentation/tacan.cxx old mode 100755 new mode 100644 diff --git a/src/Instrumentation/tacan.hxx b/src/Instrumentation/tacan.hxx old mode 100755 new mode 100644 diff --git a/src/MultiPlayer/mpmessages.hxx b/src/MultiPlayer/mpmessages.hxx index dded2b3e2..f5b89eb82 100644 --- a/src/MultiPlayer/mpmessages.hxx +++ b/src/MultiPlayer/mpmessages.hxx @@ -141,7 +141,7 @@ struct FGExternalMotionData { // simulation time when this packet was generated double time; // the artificial lag the client should stay behind the average - // simulation time to arrival time diference + // simulation time to arrival time difference // FIXME: should be some 'per model' instead of 'per packet' property double lag; @@ -166,6 +166,20 @@ struct FGExternalMotionData { // The set of properties recieved for this timeslot std::vector properties; + + ~FGExternalMotionData() + { + std::vector::const_iterator propIt; + std::vector::const_iterator propItEnd; + propIt = properties.begin(); + propItEnd = properties.end(); + + while (propIt != propItEnd) + { + delete *propIt; + propIt++; + } + } }; #endif diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx index 7657ad4ee..9a5413827 100644 --- a/src/MultiPlayer/multiplaymgr.cxx +++ b/src/MultiPlayer/multiplaymgr.cxx @@ -923,19 +923,20 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg, goto noprops; } while (xdr < Msg.propsRecvdEnd()) { - FGPropertyData* pData = new FGPropertyData; // simgear::props::Type type = simgear::props::UNSPECIFIED; // First element is always the ID - pData->id = XDR_decode_uint32(*xdr); + unsigned id = XDR_decode_uint32(*xdr); //cout << pData->id << " "; xdr++; // Check the ID actually exists and get the type - const IdPropertyList* plist = findProperty(pData->id); + const IdPropertyList* plist = findProperty(id); if (plist) { + FGPropertyData* pData = new FGPropertyData; + pData->id = id; pData->type = plist->type; // How we decode the remainder of the property depends on the type switch (pData->type) { @@ -1001,7 +1002,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg, // We failed to find the property. We'll try the next packet immediately. SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::ProcessPosMsg - " "message from " << MsgHdr->Callsign << " has unknown property id " - << pData->id); + << id); } } noprops: @@ -1015,7 +1016,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg, ////////////////////////////////////////////////////////////////////// // // handle a chat message -// FIXME: display chat message withi flightgear +// FIXME: display chat message within flightgear // ////////////////////////////////////////////////////////////////////// void diff --git a/src/Navaids/awynet.cxx b/src/Navaids/awynet.cxx old mode 100755 new mode 100644 diff --git a/src/Navaids/awynet.hxx b/src/Navaids/awynet.hxx old mode 100755 new mode 100644 diff --git a/src/Network/multiplay.cxx b/src/Network/multiplay.cxx index a9cd32bf3..ddedccea8 100644 --- a/src/Network/multiplay.cxx +++ b/src/Network/multiplay.cxx @@ -283,20 +283,6 @@ bool FGMultiplay::process() { FGMultiplayMgr* mpmgr = (FGMultiplayMgr*) globals->get_subsystem("mp"); mpmgr->SendMyPosition(motionInfo); - - // Now remove the data - std::vector::const_iterator propIt; - std::vector::const_iterator propItEnd; - propIt = motionInfo.properties.begin(); - propItEnd = motionInfo.properties.end(); - - //cout << "Deleting data\n"; - - while (propIt != propItEnd) - { - delete *propIt; - propIt++; - } } return true;