Minor improvements to the handling of landing gear by the SetGear and HandlePOSI functions
This commit is contained in:
@@ -109,7 +109,7 @@ namespace XPC
|
||||
drefs.insert(make_pair(DREF_Latitude, XPLMFindDataRef("sim/flightmodel/position/latitude")));
|
||||
drefs.insert(make_pair(DREF_Longitude, XPLMFindDataRef("sim/flightmodel/position/longitude")));
|
||||
drefs.insert(make_pair(DREF_AGL, XPLMFindDataRef("sim/flightmodel/position/y_agl")));
|
||||
drefs.insert(make_pair(DREF_Elevation, XPLMFindDataRef("sim/flightmodel/position/elevation")));
|
||||
drefs.insert(make_pair(DREF_Elevation, XPLMFindDataRef("sim/flightmodel/position/elevation")));
|
||||
|
||||
drefs.insert(make_pair(DREF_LocalX, XPLMFindDataRef("sim/flightmodel/position/local_x")));
|
||||
drefs.insert(make_pair(DREF_LocalY, XPLMFindDataRef("sim/flightmodel/position/local_y")));
|
||||
@@ -629,11 +629,12 @@ namespace XPC
|
||||
|
||||
if ((gear < -8.5 && gear > -9.5) || IsDefault(gear))
|
||||
{
|
||||
Log::WriteLine(LOG_INFO, "DMAN", "Not actually setting gear because of default value");
|
||||
return;
|
||||
}
|
||||
if (isnan(gear) || gear < 0 || gear > 1)
|
||||
{
|
||||
Log::WriteLine(LOG_ERROR, "DMAN", "ERROR: Gear value must be 0 or 1");
|
||||
Log::WriteLine(LOG_ERROR, "DMAN", "ERROR: Gear value must be between 0 and 1");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -680,17 +681,17 @@ namespace XPC
|
||||
pos[2] = (float)GetDouble(DREF_Elevation, aircraft);
|
||||
}
|
||||
|
||||
// See: http://www.xsquawkbox.net/xpsdk/mediawiki/MovingThePlane
|
||||
// Need to get the aircraft's current orientation before moving and
|
||||
// reset the orientation after moving to update the quaternion
|
||||
float orient[3];
|
||||
orient[0] = GetFloat(DREF_Pitch, aircraft);
|
||||
orient[1] = GetFloat(DREF_Roll, aircraft);
|
||||
orient[2] = GetFloat(DREF_HeadingTrue, aircraft);
|
||||
// See: http://www.xsquawkbox.net/xpsdk/mediawiki/MovingThePlane
|
||||
// Need to get the aircraft's current orientation before moving and
|
||||
// reset the orientation after moving to update the quaternion
|
||||
float orient[3];
|
||||
orient[0] = GetFloat(DREF_Pitch, aircraft);
|
||||
orient[1] = GetFloat(DREF_Roll, aircraft);
|
||||
orient[2] = GetFloat(DREF_HeadingTrue, aircraft);
|
||||
|
||||
// Now set the aircraft's position. Need to set world position for
|
||||
// "long" moves, but since there isn't an easy way to calculate "long",
|
||||
// we just set it every time.
|
||||
// Now set the aircraft's position. Need to set world position for
|
||||
// "long" moves, but since there isn't an easy way to calculate "long",
|
||||
// we just set it every time.
|
||||
double local[3];
|
||||
XPLMWorldToLocal(pos[0], pos[1], pos[2], &local[0], &local[1], &local[2]);
|
||||
// If the sim is paused, setting global position won't update the
|
||||
@@ -703,8 +704,8 @@ namespace XPC
|
||||
Set(DREF_Longitude, (double)pos[1], aircraft);
|
||||
Set(DREF_Elevation, (double)pos[2], aircraft);
|
||||
|
||||
// Now reset orientation to update q
|
||||
SetOrientation(orient, aircraft);
|
||||
// Now reset orientation to update q
|
||||
SetOrientation(orient, aircraft);
|
||||
}
|
||||
|
||||
void DataManager::SetOrientation(float orient[3], char aircraft)
|
||||
|
||||
@@ -572,7 +572,7 @@ namespace XPC
|
||||
|
||||
DataManager::SetPosition(pos, aircraftNumber);
|
||||
DataManager::SetOrientation(orient, aircraftNumber);
|
||||
if (gear != -1)
|
||||
if (gear >= 0)
|
||||
{
|
||||
DataManager::SetGear(gear, true, aircraftNumber);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user