Skip to content

Commit

Permalink
Merge pull request #181 from TwinFan/Next
Browse files Browse the repository at this point in the history
v2.01 Next
  • Loading branch information
TwinFan authored May 2, 2020
2 parents 528b8f3 + aa543de commit e9ee5f3
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 172 deletions.
4 changes: 1 addition & 3 deletions Include/LTAircraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct BezierCurve
// Represents an aircraft as displayed in XP by use of the
// XP Multiplayer Lib
//
class LTAircraft : XPCAircraft
class LTAircraft : public XPCAircraft
{
public:
class FlightModel {
Expand Down Expand Up @@ -368,8 +368,6 @@ class LTAircraft : XPCAircraft
void LabelUpdate();
// stringify e.g. for debugging info purposes
operator std::string() const;
// the XPMP model used for displaying this aircraft
std::string GetModelName() const;
// change the model (e.g. when model-defining static data changed)
void ChangeModel (const LTFlightData::FDStaticData& statData);
// current position
Expand Down
3 changes: 2 additions & 1 deletion Include/LTOpenSky.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ constexpr double OPSKY_WAIT_BETWEEN = 0.5; // seconds to pause between
#define OPSKY_MD_AC_TYPE_ICAO "typecode"
#define OPSKY_MD_CAT_DESCR "categoryDescription"
#define OPSKY_MD_TEXT_VEHICLE "Surface Vehicle"
#define OPSKY_MD_TEX_NO_CAT "No ADS-B Emitter Category Information"
#define OPSKY_MD_TEXT_NO_CAT "No ADS-B Emitter Category Information"
#define OPSKY_MD_MDL_UNKNOWN "[?]"

#define OPSKY_ROUTE_URL "https://opensky-network.org/api/routes?callsign="
#define OPSKY_ROUTE_GROUP "ROUTE" // made-up group of route information fields
Expand Down
9 changes: 7 additions & 2 deletions Lib/XPMP2/XPMP2.framework/Versions/1.0/Headers/XPMPAircraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ class Aircraft {

/// return the XPMP2 plane id
XPMPPlaneID GetPlaneID () const { return mPlane; }
/// return the last used sim/multiplayer/plane-index
/// @brief return the current multiplayer-index
/// @note This is a 0-based index into our internal tables!
/// It is one less than the number used in sim/multiplayer/plane dataRefs,
/// use Aircraft::GetAIPlaneIdx() for that purpose.
int GetMultiIdx () const { return multiIdx; }
/// @brief return the plane's index in XP's sim/multiplayer/plane dataRefs
int GetAIPlaneIdx () const { return multiIdx >= 0 ? multiIdx+1 : -1; }
/// Is this plane currently also being tracked by X-Plane's AI/multiplayer, ie. will appear on TCAS?
bool IsCurrentlyShownAsAI () const { return multiIdx >= 0; }
/// Will this plane show up on TCAS / in multiplayer views? (It will if transponder is not switched off)
Expand All @@ -194,7 +199,7 @@ class Aircraft {
/// return a pointer to the CSL model in use (Note: The CSLModel structure is not public.)
XPMP2::CSLModel* GetModel () const { return pCSLMdl; }
/// return the name of the CSL model in use
std::string GetModelName () const;
const std::string& GetModelName () const;
/// quality of the match with the CSL model
int GetMatchQuality () const { return matchQuality; }
/// Vertical offset, ie. the value that needs to be added to drawInfo.y to make the aircraft appear on the ground
Expand Down
247 changes: 112 additions & 135 deletions Lib/XPMP2/XPMP2.framework/Versions/1.0/Headers/XPMPMultiplayer.h

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19D76</string>
<string>19E287</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand Down
Binary file modified Lib/XPMP2/XPMP2.framework/Versions/1.0/XPMP2
Binary file not shown.
Binary file modified Lib/XPMP2/libXPMP2.a
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
contextName = "Apt::FindEdgesForHeading(double, double, std::__1::vector&lt;unsigned long, std::__1::allocator&lt;unsigned long&gt; &gt;&amp;, TaxiEdge::edgeTy) const:LTApt.cpp">
<PersistentStrings>
<PersistentString
value = "vecTaxiEdges[222]">
value = "lst[1385]">
</PersistentString>
<PersistentString
value = "vecTaxiEdgesIdxHead[3321]">
</PersistentString>
<PersistentString
value = "lst[1385]">
value = "vecTaxiEdges[222]">
</PersistentString>
</PersistentStrings>
</ContextState>
Expand Down Expand Up @@ -84,10 +84,10 @@
contextName = "LTFlightData::AddDynData(LTFlightData::FDDynamicData const&amp;, int, int, positionTy*):LTFlightData.cpp">
<PersistentStrings>
<PersistentString
value = "posDeque">
value = "dynDataDeque">
</PersistentString>
<PersistentString
value = "dynDataDeque">
value = "posDeque">
</PersistentString>
<PersistentString
value = "currCycle">
Expand Down Expand Up @@ -215,10 +215,10 @@
value = "cull">
</PersistentString>
<PersistentString
value = "iter-&gt;second">
value = "tcas">
</PersistentString>
<PersistentString
value = "tcas">
value = "iter-&gt;second">
</PersistentString>
</PersistentStrings>
</ContextState>
Expand Down Expand Up @@ -313,6 +313,11 @@
</ContextState>
<ContextState
contextName = "OpenSkyAcMasterdata::ProcessFetchedData(std::__1::map&lt;LTFlightData::FDKeyTy, LTFlightData, std::__1::less&lt;LTFlightData::FDKeyTy&gt;, std::__1::allocator&lt;std::__1::pair&lt;LTFlightData::FDKeyTy const, LTFlightData&gt; &gt; &gt;&amp;):LTOpenSky.cpp">
<PersistentStrings>
<PersistentString
value = "ln">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "LTFlightData::AppendNewPos():LTFlightData.cpp">
Expand All @@ -335,6 +340,14 @@
<ContextState
contextName = "LTACMasterdataChannel::ClearMasterDataRequests()::$_0::operator()(acStatUpdateTy&amp;) const:LTChannel.cpp">
</ContextState>
<ContextState
contextName = "OpenSkyAcMasterdata::FetchAllData(positionTy const&amp;):LTOpenSky.cpp">
<PersistentStrings>
<PersistentString
value = "httpResponse">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "LTFlightDataConnection::ReceiveData(char const*, unsigned long, unsigned long, void*):LTFlightData.cpp">
<PersistentStrings>
Expand Down Expand Up @@ -381,7 +394,7 @@
value = "from">
</PersistentString>
<PersistentString
value = "ppos.v[6]">
value = "turn">
</PersistentString>
<PersistentString
value = "to">
Expand All @@ -390,7 +403,7 @@
value = "ppos">
</PersistentString>
<PersistentString
value = "turn">
value = "ppos.v[6]">
</PersistentString>
</PersistentStrings>
</ContextState>
Expand Down Expand Up @@ -480,10 +493,10 @@
value = "mapFd">
</PersistentString>
<PersistentString
value = "sizeof(bool)">
value = "dataRefs">
</PersistentString>
<PersistentString
value = "dataRefs">
value = "sizeof(bool)">
</PersistentString>
<PersistentString
value = "(int*)p">
Expand All @@ -505,13 +518,13 @@
contextName = "LTAircraft::GetPlanePosition(XPMPPlanePosition_t*):LTAircraft.cpp">
<PersistentStrings>
<PersistentString
value = "ppos">
value = "prevPos">
</PersistentString>
<PersistentString
value = "gearDeflection">
</PersistentString>
<PersistentString
value = "prevPos">
value = "ppos">
</PersistentString>
</PersistentStrings>
</ContextState>
Expand Down Expand Up @@ -960,10 +973,10 @@
value = "_startTime">
</PersistentString>
<PersistentString
value = "_targetTime">
value = "_deltaDist">
</PersistentString>
<PersistentString
value = "_deltaDist">
value = "_targetTime">
</PersistentString>
</PersistentStrings>
</ContextState>
Expand Down
2 changes: 1 addition & 1 deletion Src/ACInfoWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ void ACIWnd::UpdateStatValues()
stat.pDoc8643->classification.c_str() : "-");
XPSetWidgetDescriptor(widgetIds[ACI_TXT_MANU], strAtMost(stat.man, 25).c_str());
XPSetWidgetDescriptor(widgetIds[ACI_TXT_MODEL], strAtMost(stat.mdl, 25).c_str());
XPSetWidgetDescriptor(widgetIds[ACI_TXT_OP], strAtMost(stat.opIcao + " " + stat.op,25).c_str());
XPSetWidgetDescriptor(widgetIds[ACI_TXT_OP], strAtMost((stat.opIcao.empty() ? stat.op : stat.opIcao + ": " + stat.op),25).c_str());

XPSetWidgetDescriptor(widgetIds[ACI_TXT_CALLSIGN], stat.call.c_str());
XPSetWidgetDescriptor(widgetIds[ACI_TXT_FLIGHT_ROUTE], stat.flightRoute().c_str());
Expand Down
8 changes: 0 additions & 8 deletions Src/LTAircraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2803,14 +2803,6 @@ XPMPPlaneCallbackResult LTAircraft::GetInfoTexts(XPMPInfoTexts_t* outInfo)
return xpmpData_Unavailable;
}

// fetches and then returns the name of the aircraft model in use
std::string LTAircraft::GetModelName() const
{
char buf[256];
XPMPGetPlaneModelName(mPlane, buf, sizeof(buf));
return std::string(buf);
}

// change the model (e.g. when model-defining static data changed)
void LTAircraft::ChangeModel (const LTFlightData::FDStaticData& statData)
{
Expand Down
15 changes: 11 additions & 4 deletions Src/LTFlightData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,7 @@ bool LTFlightData::DetermineAcModel()
// pretty clear indicator for a ground vehicle
(statData.catDescr.find(OPSKY_MD_TEXT_VEHICLE) != std::string::npos ||
// I'm having the feeling that if nearly all is empty and the category description is "No Info" then it's often also a ground vehicle
(statData.catDescr.find(OPSKY_MD_TEX_NO_CAT) != std::string::npos &&
(statData.catDescr.find(OPSKY_MD_TEXT_NO_CAT) != std::string::npos &&
statData.man.empty() && statData.mdl.empty() && statData.opIcao.empty()) ||
// ADSBEx doesn't send as clear an indicator, but data analysis
// suggests that EngType/Mount == 0 is a good indicator
Expand All @@ -2304,9 +2304,16 @@ bool LTFlightData::DetermineAcModel()
(statData.op.empty() && statData.reg.empty() && statData.destAp.empty()))
)
{
// assume surface vehicle
statData.acTypeIcao = dataRefs.GetDefaultCarIcaoType();
return prevType != statData.acTypeIcao;
// We would now decide for surface vehicle
// but we only do so if we had no other type before
// (ie. if we previously had decided for standard a/c then we keep that!)
if (prevType.empty()) {
statData.acTypeIcao = dataRefs.GetDefaultCarIcaoType();
return true;
} else {
statData.acTypeIcao = std::move(prevType);
return false;
}
}

// we have no better idea than standard
Expand Down
10 changes: 10 additions & 0 deletions Src/LTOpenSky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ bool OpenSkyAcMasterdata::FetchAllData (const positionTy& /*pos*/)
break;
case HTTP_NOT_FOUND: // doesn't know a/c, don't query again
invIcaos.emplace_back(info.acKey.icao);

// We add "model=[?], owner=[?]". By this way we don't trigger the car detection,
// that means: If we don't know the transponder at all we'd rather decide on standard a/c but not car
if (data.length() > 1) // concatenate both JSON groups
data += ", ";
data += "\"" OPSKY_MD_GROUP "\": { \"" OPSKY_MD_TRANSP_ICAO "\": \"";
data += currKey;
data += "\", \"" OPSKY_MD_MDL "\": \"" OPSKY_MD_MDL_UNKNOWN "\", "
"\"" OPSKY_MD_OP "\": \"" OPSKY_MD_MDL_UNKNOWN "\" }";

bChannelOK = true; // but technically a valid response
break;
case HTTP_BAD_REQUEST: // uh uh...done something wrong, don't do that again
Expand Down
16 changes: 16 additions & 0 deletions docs/Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ LTApt
- Instead of wasting space with all nodes supporting Dijkstra,
consider a map holding Dijkstra info per visited node

Download History
==========
Download counter when providing v2.00: 77.048
Download counter when providing v1.52: 76.467
Download counter when providing v1.51: 75.073
Download counter when providing v1.50: 72.486
Download counter when providing v1.24: 64.921
Download counter when providing v1.23: 63.965
Download counter when providing v1.22: 39.778
Download counter when providing v1.21: 36.845
Download counter when providing v1.20: 32.592
Download counter when providing v1.16: 23.480
Download counter when providing v1.15: 21.292
Download counter when providing v1.10: 16.649
Download counter when providing v1.00: 12.192
Download counter when providing v0.94: 10.917

DOCUMENTATION
===========
Expand Down
52 changes: 49 additions & 3 deletions docs/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,58 @@ <h1>Release Notes</h1>

<h2>v2.0</h2>

<h3>v2.00</h3>
<h3>v2.01</h3>

<P>Please follow
<P>Please follow
<a href="https://twinfan.gitbook.io/livetraffic/setup/installation/upgrading-from-v1.5-to-v2.0">upgrade instructions</a>
for upgrading an existing LiveTraffic installation to version 2.0.
for upgrading an existing LiveTraffic v1.5 (or earlier) installation to version 2.0.
</P>

<P>For updating coming from v2.00 copy <code>lin|mac|win_x64/LiveTraffic.xpl</code>
and <code>Resources/NoPlane.acf</code></p>

<ul>
<li>CSL Models: If <code>VERT_OFFSET</code> is not specified in <code>xsb_aircraft.txt</code>
then it is extracted from the model's <code>.obj</code> file.
Will help some X-CSL models back onto the ground.</li>
<li>CHANGE <a href="https://github.com/TwinFan/XPMP2/issues/8">XPMP2 #8</a>
Matching now prefers a matching <i>related</i> a/c type <i>plus</i> matching livery
over a model with matching <i>exact</i> a/c type but without livery.<br>
This will show correct livery more often at the price of
picking a <i>related</i> a/c type only if nothing better is available.
<li>FIXED <a href="https://github.com/TwinFan/LiveTraffic/issues/178">#178</a>
planes transforming to cars on touch-down.</li>
<li>CHANGED identification of cars: If no info about an object is available
at all (e.g. not maintained yet at OpenSky), then will decide for
default plane, not car.</li>
<li><a href="https://twinfan.gitbook.io/livetraffic/using-lt/aircraft-information-window">Aircraft Info Window</a>
reports <i>CSL Model</i> again with last segment
of path where model is taken from, allows to identify the package used
(like Bluebell vs. X-CSL).</li>
<li>Removed residual jet smoke from under planes (by updating <code>NoPlane.acf</code>).</li>
<li>For plugin developers:
<ul>
<li>FIXED <a href="https://github.com/TwinFan/XPMP2/issues/7">XPMP2 #7</a>
multiplayer slot indexes returned to plugin being off by 1,
are now 1-based again</li>
<li>Y value published in <code>sim/multiplayer/plane...</code> datarefs
is in line again with altitude reported via LTAPI,
ie. <i>without</i> <code>VERT_OFFSET</code>.</li>
<li>ADDED <a href="https://github.com/TwinFan/LiveTraffic/issues/180">#180</a>:
LiveTraffic's version number and date are provided via
dataRefs <code>livetraffic/ver/nr</code> and <code>.../date</code>.</li>
<li><a href="https://github.com/TwinFan/LTAPI">LTAPI</a>
provides respective version number/date functions, too.</li>
<li><a href="https://github.com/TwinFan/LTAPI">LTAPI</a>
should also return last path segment together with model name
in <code>cslModel</code>.</li>
</ul>
</li>
</ul>


<h3>v2.00</h3>


<ul>
<li><strong>Supports X-Plane 11 only.</strong><br>
Expand Down

0 comments on commit e9ee5f3

Please sign in to comment.