From f5058574d0fd02975b8ec36456a7dd406624bc7c Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Mon, 16 Jan 2017 14:32:26 +0100 Subject: [PATCH] Add isVatsimVersion to build configuration This build configuration enables Vatsim specific features. refs #860 --- mkspecs/features/config.pri | 1 + mkspecs/features/vatsim.pri | 7 +++++++ src/blackconfig/buildconfig.h | 3 +++ src/blackconfig/buildconfig_gen.cpp.in | 10 ++++++++++ src/blackcore/vatsim/networkvatlib.cpp | 3 ++- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/config.pri b/mkspecs/features/config.pri index 93151ae24..4e9c901dd 100644 --- a/mkspecs/features/config.pri +++ b/mkspecs/features/config.pri @@ -42,6 +42,7 @@ include(vatsim.pri) !contains(BLACK_CONFIG, XPlane) { DEFINE_WITH_XPLANE = "//" } !contains(BLACK_CONFIG, SwiftBeta) { DEFINE_SWIFT_BETA = "//" } !contains(BLACK_CONFIG, SwiftShipped) { DEFINE_SWIFT_SHIPPED = "//" } +!contains(BLACK_CONFIG, SwiftVatsimSupport) { DEFINE_SWIFT_VATSIM_SUPPORT = "//" } # Global compiler Macros contains(BLACK_CONFIG, Static) { DEFINES *= WITH_STATIC } diff --git a/mkspecs/features/vatsim.pri b/mkspecs/features/vatsim.pri index 99d7ebb24..ceffe66d8 100644 --- a/mkspecs/features/vatsim.pri +++ b/mkspecs/features/vatsim.pri @@ -1,4 +1,11 @@ # This is in a separate file to allow easy patching. +# VATSIM client id as assigned by VATSIM Network team. The one below is a test key. +# It is working only with VATGER test server. VATSIM_CLIENT_ID = "0xb9ba" + +# VATSIM private key, which belongs to the id above. VATSIM_CLIENT_PRIVATE_KEY = "727d1efd5cb9f8d2c28372469d922bb4" + +# Uncomment the section below to build a version with VATSIM features enabled +#BLACK_CONFIG *= SwiftVatsimSupport diff --git a/src/blackconfig/buildconfig.h b/src/blackconfig/buildconfig.h index e01eff5d3..e8fe8eb86 100644 --- a/src/blackconfig/buildconfig.h +++ b/src/blackconfig/buildconfig.h @@ -69,6 +69,9 @@ namespace BlackConfig //! Shipped version? static bool isShippedVersion(); + //! Vatsim enabled version? + static bool isVatsimVersion(); + //! Running on Windows NT platform? static bool isRunningOnWindowsNtPlatform(); diff --git a/src/blackconfig/buildconfig_gen.cpp.in b/src/blackconfig/buildconfig_gen.cpp.in index 997aca323..2df4fe4eb 100644 --- a/src/blackconfig/buildconfig_gen.cpp.in +++ b/src/blackconfig/buildconfig_gen.cpp.in @@ -23,6 +23,7 @@ $$DEFINE_WITH_FS9#define WITH_FS9 $$DEFINE_WITH_XPLANE#define WITH_XPLANE $$DEFINE_SWIFT_BETA#define SWIFT_BETA $$DEFINE_SWIFT_SHIPPED#define SWIFT_SHIPPED +$$DEFINE_SWIFT_VATSIM_SUPPORT#define SWIFT_VATSIM_SUPPORT bool BlackConfig::CBuildConfig::isCompiledWithBlackCore() { @@ -105,6 +106,15 @@ bool BlackConfig::CBuildConfig::isShippedVersion() #endif } +bool BlackConfig::CBuildConfig::isVatsimVersion() +{ +#ifdef SWIFT_VATSIM_SUPPORT + return true; +#else + return false; +#endif +} + const QDateTime &BlackConfig::CBuildConfig::getEol() { static const QString eol(\"$$BLACK_EOL\"); diff --git a/src/blackcore/vatsim/networkvatlib.cpp b/src/blackcore/vatsim/networkvatlib.cpp index 5c9d310e7..4b38cb74b 100644 --- a/src/blackcore/vatsim/networkvatlib.cpp +++ b/src/blackcore/vatsim/networkvatlib.cpp @@ -117,7 +117,8 @@ namespace BlackCore clientKey = CBuildConfig::vatsimPrivateKey(); } - m_net.reset(Vat_CreateNetworkSession(vatServerLegacyFsd, sApp->swiftVersionChar(), + VatServerType serverType = CBuildConfig::isVatsimVersion() ? vatServerVatsim : vatServerLegacyFsd; + m_net.reset(Vat_CreateNetworkSession(serverType, sApp->swiftVersionChar(), CVersion::versionMajor(), CVersion::versionMinor(), "None", clientId, clientKey.toLocal8Bit().constData(), clientCapabilities));