Changed Lat/Lon/h to double in GetP
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
#include "XPLMScenery.h"
|
#include "XPLMScenery.h"
|
||||||
#include "XPLMGraphics.h"
|
#include "XPLMGraphics.h"
|
||||||
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -32,7 +31,6 @@
|
|||||||
#define MULTICAST_GROUP "239.255.1.1"
|
#define MULTICAST_GROUP "239.255.1.1"
|
||||||
#define MULITCAST_PORT 49710
|
#define MULITCAST_PORT 49710
|
||||||
|
|
||||||
|
|
||||||
namespace XPC
|
namespace XPC
|
||||||
{
|
{
|
||||||
std::map<std::string, MessageHandlers::ConnectionInfo> MessageHandlers::connections;
|
std::map<std::string, MessageHandlers::ConnectionInfo> MessageHandlers::connections;
|
||||||
@@ -560,21 +558,20 @@ namespace XPC
|
|||||||
unsigned char aircraft = buffer[5];
|
unsigned char aircraft = buffer[5];
|
||||||
Log::FormatLine(LOG_TRACE, "GPOS", "Getting position information for aircraft %u", aircraft);
|
Log::FormatLine(LOG_TRACE, "GPOS", "Getting position information for aircraft %u", aircraft);
|
||||||
|
|
||||||
unsigned char response[34] = "POSI";
|
unsigned char response[46] = "POSI";
|
||||||
response[5] = (char)DataManager::GetInt(DREF_GearHandle, aircraft);
|
response[5] = (char)DataManager::GetInt(DREF_GearHandle, aircraft);
|
||||||
// TODO change lat/lon/h to double?
|
*((double*)(response + 6)) = DataManager::GetDouble(DREF_Latitude, aircraft);
|
||||||
*((float*)(response + 6)) = (float)DataManager::GetDouble(DREF_Latitude, aircraft);
|
*((double*)(response + 14)) = DataManager::GetDouble(DREF_Longitude, aircraft);
|
||||||
*((float*)(response + 10)) = (float)DataManager::GetDouble(DREF_Longitude, aircraft);
|
*((double*)(response + 22)) = DataManager::GetDouble(DREF_Elevation, aircraft);
|
||||||
*((float*)(response + 14)) = (float)DataManager::GetDouble(DREF_Elevation, aircraft);
|
*((float*)(response + 30)) = DataManager::GetFloat(DREF_Pitch, aircraft);
|
||||||
*((float*)(response + 18)) = DataManager::GetFloat(DREF_Pitch, aircraft);
|
*((float*)(response + 34)) = DataManager::GetFloat(DREF_Roll, aircraft);
|
||||||
*((float*)(response + 22)) = DataManager::GetFloat(DREF_Roll, aircraft);
|
*((float*)(response + 38)) = DataManager::GetFloat(DREF_HeadingTrue, aircraft);
|
||||||
*((float*)(response + 26)) = DataManager::GetFloat(DREF_HeadingTrue, aircraft);
|
|
||||||
|
|
||||||
float gear[10];
|
float gear[10];
|
||||||
DataManager::GetFloatArray(DREF_GearDeploy, gear, 10, aircraft);
|
DataManager::GetFloatArray(DREF_GearDeploy, gear, 10, aircraft);
|
||||||
*((float*)(response + 30)) = gear[0];
|
*((float*)(response + 42)) = gear[0];
|
||||||
|
|
||||||
sock->SendTo(response, 34, &connection.addr);
|
sock->SendTo(response, 46, &connection.addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandlers::HandlePosi(const Message& msg)
|
void MessageHandlers::HandlePosi(const Message& msg)
|
||||||
@@ -594,6 +591,7 @@ namespace XPC
|
|||||||
{
|
{
|
||||||
float posd_32[3];
|
float posd_32[3];
|
||||||
memcpy(posd_32, buffer + 6, 12);
|
memcpy(posd_32, buffer + 6, 12);
|
||||||
|
/* convert float to double */
|
||||||
posd[0] = posd_32[0];
|
posd[0] = posd_32[0];
|
||||||
posd[1] = posd_32[1];
|
posd[1] = posd_32[1];
|
||||||
posd[2] = posd_32[2];
|
posd[2] = posd_32[2];
|
||||||
@@ -612,7 +610,6 @@ namespace XPC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert float to double */
|
|
||||||
DataManager::SetPosition(posd, aircraftNumber);
|
DataManager::SetPosition(posd, aircraftNumber);
|
||||||
DataManager::SetOrientation(orient, aircraftNumber);
|
DataManager::SetOrientation(orient, aircraftNumber);
|
||||||
if (gear >= 0)
|
if (gear >= 0)
|
||||||
@@ -632,7 +629,7 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandlers::HandleGetT(const Message& msg)
|
void MessageHandlers::HandleGetT(const Message& msg)
|
||||||
{
|
{
|
||||||
const unsigned char* buffer = msg.GetBuffer();
|
const unsigned char* buffer = msg.GetBuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user