finish assigned altitude in metric
This commit is contained in:
parent
ccd82a4cc4
commit
303134c4a2
@ -3,16 +3,13 @@
|
|||||||
|
|
||||||
TinyEurocat *pMyPlugIn = NULL;
|
TinyEurocat *pMyPlugIn = NULL;
|
||||||
|
|
||||||
void __declspec ( dllexport )
|
void __declspec ( dllexport ) EuroScopePlugInInit ( EuroScopePlugIn :: CPlugIn **ppPlugInInstance )
|
||||||
EuroScopePlugInInit ( EuroScopePlugIn :: CPlugIn ** ppPlugInInstance )
|
|
||||||
{
|
{
|
||||||
// allocate
|
// allocate
|
||||||
* ppPlugInInstance = pMyPlugIn =
|
* ppPlugInInstance = pMyPlugIn = new TinyEurocat ;
|
||||||
new TinyEurocat ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec ( dllexport )
|
void __declspec ( dllexport ) EuroScopePlugInExit ( void )
|
||||||
EuroScopePlugInExit ( void )
|
|
||||||
{
|
{
|
||||||
delete pMyPlugIn ;
|
delete pMyPlugIn ;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,60 @@
|
|||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#include "TinyEurocat.h"
|
#include "TinyEurocat.h"
|
||||||
|
#include <cstring>
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
TinyEurocat::TinyEurocat(void) : CPlugIn ( COMPATIBILITY_CODE,
|
||||||
TinyEurocat::TinyEurocat(void) : CPlugIn ( EuroScopePlugIn::COMPATIBILITY_CODE,
|
|
||||||
"TinyEurocat",
|
"TinyEurocat",
|
||||||
"1.0.0",
|
"1.0.0",
|
||||||
"Future Sim",
|
"Future Sim",
|
||||||
"Open-source" )
|
"Open-source" )
|
||||||
{
|
{
|
||||||
|
RegisterTagItemType("Metric / Current Altitude", TAG_ITEM_MET_CURR_ALT);
|
||||||
|
RegisterTagItemType("Metric / Cleared Altitude", TAG_ITEM_MET_ASS_ALT);
|
||||||
|
RegisterTagItemType("Metric / Current Speed", TAG_ITEM_MET_CURR_SPD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
|
||||||
|
CRadarTarget RadarTarget,
|
||||||
|
int ItemCode,
|
||||||
|
int TagData,
|
||||||
|
char sItemString [ 16 ],
|
||||||
|
int *pColorCode,
|
||||||
|
COLORREF *pRGB,
|
||||||
|
double *pFontSize )
|
||||||
|
{
|
||||||
|
int maalt, mcalt, mcspd;
|
||||||
|
switch (ItemCode)
|
||||||
|
{
|
||||||
|
case TAG_ITEM_MET_ASS_ALT:
|
||||||
|
maalt = FlightPlan.GetClearedAltitude() * 0.3048;
|
||||||
|
if(maalt != 0)
|
||||||
|
{
|
||||||
|
maalt /= 100;
|
||||||
|
if(maalt % 3 == 1)
|
||||||
|
maalt -= 1;
|
||||||
|
else if(maalt % 3 == 2)
|
||||||
|
maalt += 1;
|
||||||
|
char tmpstr[15];
|
||||||
|
itoa(maalt * 10, tmpstr, 10);
|
||||||
|
sprintf(sItemString, "%04s", tmpstr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(sItemString, " ");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TAG_ITEM_MET_CURR_ALT:
|
||||||
|
mcalt = 1;
|
||||||
|
itoa(mcalt, sItemString, 10);
|
||||||
|
break;
|
||||||
|
case TAG_ITEM_MET_CURR_SPD:
|
||||||
|
mcspd = RadarTarget.GetGS() * 1.852;
|
||||||
|
itoa(mcspd, sItemString, 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TinyEurocat::~TinyEurocat(void)
|
TinyEurocat::~TinyEurocat(void)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "..\lib\EuroScopePlugIn.h"
|
#include "..\lib\EuroScopePlugIn.h"
|
||||||
|
|
||||||
class TinyEurocat : public EuroScopePlugIn::CPlugIn
|
using namespace EuroScopePlugIn;
|
||||||
|
|
||||||
|
const int TAG_ITEM_MET_CURR_ALT = 1;
|
||||||
|
const int TAG_ITEM_MET_ASS_ALT = 2;
|
||||||
|
const int TAG_ITEM_MET_CURR_SPD = 3;
|
||||||
|
|
||||||
|
class TinyEurocat : public CPlugIn
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TinyEurocat(void);
|
TinyEurocat(void);
|
||||||
~TinyEurocat(void);
|
~TinyEurocat(void);
|
||||||
|
void OnGetTagItem( CFlightPlan FlightPlan,
|
||||||
|
CRadarTarget RadarTarget,
|
||||||
|
int ItemCode,
|
||||||
|
int TagData,
|
||||||
|
char sItemString [ 16 ],
|
||||||
|
int *pColorCode,
|
||||||
|
COLORREF *pRGB,
|
||||||
|
double *pFontSize );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@
|
|||||||
<ClCompile Include="TinyEurocat.cpp" />
|
<ClCompile Include="TinyEurocat.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\lib\EuroScopePlugIn.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="TinyEurocat.h" />
|
<ClInclude Include="TinyEurocat.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -35,5 +35,8 @@
|
|||||||
<ClInclude Include="TinyEurocat.h">
|
<ClInclude Include="TinyEurocat.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\lib\EuroScopePlugIn.h">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user