1
0
Fork 0
This commit is contained in:
Torsten Dreyer 2011-02-20 11:12:22 +01:00
commit 031ed14fb2
70 changed files with 97 additions and 104 deletions

0
package/Win32-Inno/FlightGear-1.9.iss Executable file → Normal file
View file

0
projects/VC8/FGJS.vcproj Executable file → Normal file
View file

0
projects/VC8/FlightGear.sln Executable file → Normal file
View file

0
projects/VC8/FlightGear.vcproj Executable file → Normal file
View file

0
projects/VC8/FlightGearLib.vcproj Executable file → Normal file
View file

0
projects/VC90/flightgear.ico Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

0
projects/VC90/flightgear.rc Executable file → Normal file
View file

View file

@ -335,35 +335,13 @@ void FGAIMultiplayer::update(double dt)
if (prevIt != mMotionInfo.begin()) if (prevIt != mMotionInfo.begin())
{ {
--prevIt; --prevIt;
MotionInfo::iterator delIt;
delIt = mMotionInfo.begin();
while (delIt != prevIt)
{
std::vector<FGPropertyData*>::const_iterator propIt;
std::vector<FGPropertyData*>::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); mMotionInfo.erase(mMotionInfo.begin(), prevIt);
} }
} }
} else { } else {
// Ok, we need to predict the future, so, take the best data we can have // 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. // 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 // The time to predict, limit to 5 seconds
double t = tInterp - motionInfo.time; double t = tInterp - motionInfo.time;
@ -488,7 +466,7 @@ void FGAIMultiplayer::update(double dt)
} }
void void
FGAIMultiplayer::addMotionInfo(const FGExternalMotionData& motionInfo, FGAIMultiplayer::addMotionInfo(FGExternalMotionData& motionInfo,
long stamp) long stamp)
{ {
mLastTimestamp = stamp; mLastTimestamp = stamp;
@ -505,6 +483,9 @@ FGAIMultiplayer::addMotionInfo(const FGExternalMotionData& motionInfo,
return; return;
} }
mMotionInfo[motionInfo.time] = motionInfo; 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 void

View file

@ -37,7 +37,7 @@ public:
virtual void unbind(); virtual void unbind();
virtual void update(double dt); 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); void setDoubleProperty(const std::string& prop, double val);
long getLastTimestamp(void) const long getLastTimestamp(void) const

0
src/Airports/pavement.cxx Executable file → Normal file
View file

0
src/Airports/pavement.hxx Executable file → Normal file
View file

0
src/Environment/presets.cxx Executable file → Normal file
View file

0
src/Environment/presets.hxx Executable file → Normal file
View file

View file

@ -36,25 +36,12 @@
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <string> #include <string>
#include <math.h> #include <math.h>
#include <simgear/sg_inlines.h>
using std::string; using std::string;
#include "ridge_lift.hxx" #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; static const double BOUNDARY1_m = 40.0;
const double FGRidgeLift::dist_probe_m[] = { // in meters 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]; 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++) 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<double>(slope[i]);
//adjustment //adjustment
adj_slope[0] *= 0.2; adj_slope[0] *= 0.2;

0
src/FDM/JSBSim/input_output/FGPropertyManager.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGScript.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGXMLElement.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGXMLElement.h Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGXMLFileRead.h Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGXMLParse.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/input_output/FGXMLParse.h Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGFunction.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGFunction.h Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGModelFunctions.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGModelFunctions.h Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGParameter.h Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGPropertyValue.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGPropertyValue.h Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGRealValue.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/math/FGRealValue.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGAuxiliary.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalForce.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalForce.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalReactions.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGExternalReactions.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGInput.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/FGInput.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/atmosphere/FGMSIS.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/atmosphere/FGMSISData.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/atmosphere/FGMars.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/atmosphere/FGMars.h Executable file → Normal file
View file

View file

0
src/FDM/JSBSim/models/flight_control/FGAccelerometer.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGFCSFunction.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGGyro.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGGyro.h Executable file → Normal file
View file

View file

0
src/FDM/JSBSim/models/flight_control/FGMagnetometer.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGPID.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGPID.h Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGSensor.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/flight_control/FGSensor.h Executable file → Normal file
View file

View file

0
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp Executable file → Normal file
View file

0
src/FDM/JSBSim/models/propulsion/FGTurboProp.h Executable file → Normal file
View file

0
src/FDM/YASim/Hitch.cpp Executable file → Normal file
View file

0
src/FDM/YASim/Hitch.hpp Executable file → Normal file
View file

0
src/Instrumentation/mk_viii.cxx Executable file → Normal file
View file

0
src/Instrumentation/mk_viii.hxx Executable file → Normal file
View file

View file

@ -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; 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 // Calculate a Cartesian unit vector in the
// starting at the given "tail" of the vector and going off // local horizontal plane, i.e. tangent to the
// with the given heading. // surface of the earth at the local ground zero.
static SGVec3d tangentVector(const SGGeod& tail, const SGVec3d& tail_xyz, // The tangent vector passes through the given <midpoint>
const double heading) // and points forward along the given <heading>.
// The <heading> is given in degrees.
static SGVec3d tangentVector(const SGGeod& midpoint, const double heading)
{ {
// The fudge factor here is presumably intended to improve // The size of the delta is presumably chosen to give
// numerical stability. I don't know if it is necessary. // numerical stability. I don't know how the value was chosen.
// It gets divided out later. // It probably doesn't matter much. It gets divided out.
double fudge(100.0); double delta(100.0); // in meters
SGGeod head; SGGeod head, tail;
double az2; // ignored double az2; // ignored
SGGeodesy::direct(tail, heading, fudge, head, az2); SGGeodesy::direct(midpoint, heading, delta, head, az2);
head.setElevationM(tail.getElevationM()); SGGeodesy::direct(midpoint, 180+heading, delta, tail, az2);
head.setElevationM(midpoint.getElevationM());
tail.setElevationM(midpoint.getElevationM());
SGVec3d head_xyz = SGVec3d::fromGeod(head); 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" // 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(); simgear::props::Type typ = n->getType();
if ((typ == simgear::props::NONE) || (typ == simgear::props::UNSPECIFIED)) { if ((typ == simgear::props::NONE) || (typ == simgear::props::UNSPECIFIED)) {
n->setBoolValue(true); n->setBoolValue(true);
@ -231,6 +240,7 @@ FGNavRadio::init ()
gs_deflection_node = node->getChild("gs-needle-deflection", 0, true); gs_deflection_node = node->getChild("gs-needle-deflection", 0, true);
gs_deflection_deg_node = node->getChild("gs-needle-deflection-deg", 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_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_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_rate_of_climb_fpm_node = node->getChild("gs-rate-of-climb-fpm", 0, true);
gs_dist_node = node->getChild("gs-distance", 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_node->setDoubleValue( 0.0 );
gs_deflection_deg_node->setDoubleValue(0.0); gs_deflection_deg_node->setDoubleValue(0.0);
gs_deflection_norm_node->setDoubleValue(0.0); gs_deflection_norm_node->setDoubleValue(0.0);
gs_direct_node->setDoubleValue(0.0);
gs_inrange_node->setBoolValue( false ); gs_inrange_node->setBoolValue( false );
loc_node->setBoolValue( false ); loc_node->setBoolValue( false );
has_gs_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)); bool gsInRange = (gsDist < (_gs->get_range() * SG_NM_TO_METER));
gs_inrange_node->setBoolValue(gsInRange); gs_inrange_node->setBoolValue(gsInRange);
if (!gsInRange) { if (!gsInRange) return;
_gsNeedleDeflection = 0.0;
_gsNeedleDeflectionNorm = 0.0;
return;
}
SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft
// The positive GS axis points along the runway in the landing direction, // 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: // toward the far end, not toward the approach area, so we need a - sign here:
double dot_h = -dot(pos, _gsAxis); double comp_h = -dot(pos, _gsAxis); // component in horiz direction
double dot_v = dot(pos, _gsVertical); double comp_v = dot(pos, _gsVertical); // component in vertical direction
double angle = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES; //double comp_b = dot(pos, _gsBaseline); // component in baseline direction
double deflectionAngle = target_gs - angle; //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()) { if (falseCoursesEnabledNode->getBoolValue()) {
// Construct false glideslopes. The scale factor of 1.5 // 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 = deflectionAngle * 5.0;
_gsNeedleDeflection *= signal_quality_norm; _gsNeedleDeflection *= signal_quality_norm;
SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7);
_gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm; _gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm;
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// Calculate desired rate of climb for intercepting the GS // 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 // 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", /* 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 // estimate horizontal speed towards ILS in meters per minute
double elapsedDistance = last_x - gsDist; double elapsedDistance = last_x - gsDist;
@ -798,7 +824,7 @@ void FGNavRadio::updateCDI(double dt)
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// compute the time to intercept selected radial (based on // 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; double t = 0.0;
if ( inrange && cdi_serviceable ) { if ( inrange && cdi_serviceable ) {
@ -819,6 +845,7 @@ void FGNavRadio::updateCDI(double dt)
gs_deflection_node->setDoubleValue(_gsNeedleDeflection); gs_deflection_node->setDoubleValue(_gsNeedleDeflection);
gs_deflection_deg_node->setDoubleValue(_gsNeedleDeflectionNorm * 0.7); gs_deflection_deg_node->setDoubleValue(_gsNeedleDeflectionNorm * 0.7);
gs_deflection_norm_node->setDoubleValue(_gsNeedleDeflectionNorm); gs_deflection_norm_node->setDoubleValue(_gsNeedleDeflectionNorm);
gs_direct_node->setDoubleValue(_gsDirect);
last_xtrack_error = _cdiCrossTrackErrorM; last_xtrack_error = _cdiCrossTrackErrorM;
} }
@ -940,23 +967,18 @@ void FGNavRadio::search()
int tmp = (int)(_gs->get_multiuse() / 1000.0); int tmp = (int)(_gs->get_multiuse() / 1000.0);
target_gs = (double)tmp / 100.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); double gs_radial = fmod(_gs->get_multiuse(), 1000.0);
SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0); SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0);
_gsCart = _gs->cart();
// GS axis unit tangent vector // GS axis unit tangent vector
// (along the runway) // (along the runway):
_gsCart = _gs->cart(); _gsAxis = tangentVector(_gs->geod(), gs_radial);
_gsAxis = tangentVector(_gs->geod(), _gsCart, gs_radial);
// GS baseline unit tangent vector // GS baseline unit tangent vector
// (perpendicular to the runay along the ground) // (transverse to the runay along the ground)
SGVec3d baseline = tangentVector(_gs->geod(), _gsCart, gs_radial + 90.0); _gsBaseline = tangentVector(_gs->geod(), gs_radial + 90.0);
_gsVertical = cross(baseline, _gsAxis); _gsVertical = cross(_gsBaseline, _gsAxis);
} // of have glideslope } // of have glideslope
} // of found LOC or ILS } // of found LOC or ILS

View file

@ -102,6 +102,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
SGPropertyNode_ptr gs_deflection_node; SGPropertyNode_ptr gs_deflection_node;
SGPropertyNode_ptr gs_deflection_deg_node; SGPropertyNode_ptr gs_deflection_deg_node;
SGPropertyNode_ptr gs_deflection_norm_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_node;
SGPropertyNode_ptr gs_rate_of_climb_fpm_node; SGPropertyNode_ptr gs_rate_of_climb_fpm_node;
SGPropertyNode_ptr gs_dist_node; SGPropertyNode_ptr gs_dist_node;
@ -152,7 +153,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
// internal periodic station search timer // internal periodic station search timer
double _time_before_search_sec; double _time_before_search_sec;
SGVec3d _gsCart, _gsAxis, _gsVertical; SGVec3d _gsCart, _gsAxis, _gsVertical, _gsBaseline;
FGNavRecordPtr _dme; FGNavRecordPtr _dme;
bool _dmeInRange; bool _dmeInRange;
@ -163,6 +164,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
double _cdiCrossTrackErrorM; double _cdiCrossTrackErrorM;
double _gsNeedleDeflection; double _gsNeedleDeflection;
double _gsNeedleDeflectionNorm; double _gsNeedleDeflectionNorm;
double _gsDirect;
SGSharedPtr<SGSampleGroup> _sgr; SGSharedPtr<SGSampleGroup> _sgr;
std::vector<SGPropertyNode_ptr> _tiedNodes; std::vector<SGPropertyNode_ptr> _tiedNodes;

0
src/Instrumentation/tacan.cxx Executable file → Normal file
View file

0
src/Instrumentation/tacan.hxx Executable file → Normal file
View file

View file

@ -141,7 +141,7 @@ struct FGExternalMotionData {
// simulation time when this packet was generated // simulation time when this packet was generated
double time; double time;
// the artificial lag the client should stay behind the average // 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 // FIXME: should be some 'per model' instead of 'per packet' property
double lag; double lag;
@ -166,6 +166,20 @@ struct FGExternalMotionData {
// The set of properties recieved for this timeslot // The set of properties recieved for this timeslot
std::vector<FGPropertyData*> properties; std::vector<FGPropertyData*> properties;
~FGExternalMotionData()
{
std::vector<FGPropertyData*>::const_iterator propIt;
std::vector<FGPropertyData*>::const_iterator propItEnd;
propIt = properties.begin();
propItEnd = properties.end();
while (propIt != propItEnd)
{
delete *propIt;
propIt++;
}
}
}; };
#endif #endif

View file

@ -923,19 +923,20 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
goto noprops; goto noprops;
} }
while (xdr < Msg.propsRecvdEnd()) { while (xdr < Msg.propsRecvdEnd()) {
FGPropertyData* pData = new FGPropertyData;
// simgear::props::Type type = simgear::props::UNSPECIFIED; // simgear::props::Type type = simgear::props::UNSPECIFIED;
// First element is always the ID // First element is always the ID
pData->id = XDR_decode_uint32(*xdr); unsigned id = XDR_decode_uint32(*xdr);
//cout << pData->id << " "; //cout << pData->id << " ";
xdr++; xdr++;
// Check the ID actually exists and get the type // Check the ID actually exists and get the type
const IdPropertyList* plist = findProperty(pData->id); const IdPropertyList* plist = findProperty(id);
if (plist) if (plist)
{ {
FGPropertyData* pData = new FGPropertyData;
pData->id = id;
pData->type = plist->type; pData->type = plist->type;
// How we decode the remainder of the property depends on the type // How we decode the remainder of the property depends on the type
switch (pData->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. // We failed to find the property. We'll try the next packet immediately.
SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::ProcessPosMsg - " SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::ProcessPosMsg - "
"message from " << MsgHdr->Callsign << " has unknown property id " "message from " << MsgHdr->Callsign << " has unknown property id "
<< pData->id); << id);
} }
} }
noprops: noprops:
@ -1015,7 +1016,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// handle a chat message // handle a chat message
// FIXME: display chat message withi flightgear // FIXME: display chat message within flightgear
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
void void

0
src/Navaids/awynet.cxx Executable file → Normal file
View file

0
src/Navaids/awynet.hxx Executable file → Normal file
View file

View file

@ -283,20 +283,6 @@ bool FGMultiplay::process() {
FGMultiplayMgr* mpmgr = (FGMultiplayMgr*) globals->get_subsystem("mp"); FGMultiplayMgr* mpmgr = (FGMultiplayMgr*) globals->get_subsystem("mp");
mpmgr->SendMyPosition(motionInfo); mpmgr->SendMyPosition(motionInfo);
// Now remove the data
std::vector<FGPropertyData*>::const_iterator propIt;
std::vector<FGPropertyData*>::const_iterator propItEnd;
propIt = motionInfo.properties.begin();
propItEnd = motionInfo.properties.end();
//cout << "Deleting data\n";
while (propIt != propItEnd)
{
delete *propIt;
propIt++;
}
} }
return true; return true;