Header only SImDatabase
This commit is contained in:
parent
488fcb87cc
commit
ace71d7670
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@ -6,6 +6,7 @@
|
|||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"LIN",
|
"LIN",
|
||||||
|
"XP",
|
||||||
"XPLM200",
|
"XPLM200",
|
||||||
"XPLM210"
|
"XPLM210"
|
||||||
],
|
],
|
||||||
@ -20,6 +21,7 @@
|
|||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"IBM",
|
"IBM",
|
||||||
|
"XP",
|
||||||
"XPLM200",
|
"XPLM200",
|
||||||
"XPLM210"
|
"XPLM210"
|
||||||
],
|
],
|
||||||
@ -35,6 +37,7 @@
|
|||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"APL",
|
"APL",
|
||||||
|
"XP",
|
||||||
"XPLM200",
|
"XPLM200",
|
||||||
"XPLM210"
|
"XPLM210"
|
||||||
],
|
],
|
||||||
|
|||||||
1
TODO.md
1
TODO.md
@ -2,3 +2,4 @@
|
|||||||
- Potentially revert to Header only File lib (NO LINKING)
|
- Potentially revert to Header only File lib (NO LINKING)
|
||||||
- Update OSXCross Docker image to SDK 11
|
- Update OSXCross Docker image to SDK 11
|
||||||
- Implement ARM64 arch for Plugin
|
- Implement ARM64 arch for Plugin
|
||||||
|
- Implement Logbook PHP
|
||||||
|
|||||||
5
build.sh
5
build.sh
@ -27,6 +27,10 @@ case $1 in
|
|||||||
\cp -rf /opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll X-Plane/GAConnector/64
|
\cp -rf /opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll X-Plane/GAConnector/64
|
||||||
\cp -rf /opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll X-Plane/GAConnector/64
|
\cp -rf /opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll X-Plane/GAConnector/64
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown platform, choose one of mac, lin, win64, win32"
|
||||||
|
exit 22
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
make -j
|
make -j
|
||||||
@ -38,6 +42,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" = "mac" ] && [ "$DEBUG" = "1" ]
|
if [ "$1" = "mac" ] && [ "$DEBUG" = "1" ]
|
||||||
then
|
then
|
||||||
|
echo "Building dSYM"
|
||||||
/opt/osxcross/target/bin/osxcross-llvm-dsymutil X-Plane/GAConnector/mac.xpl
|
/opt/osxcross/target/bin/osxcross-llvm-dsymutil X-Plane/GAConnector/mac.xpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -1,47 +0,0 @@
|
|||||||
#include "config/config.h"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace config
|
|
||||||
{
|
|
||||||
void Config::writeFile() const
|
|
||||||
{
|
|
||||||
std::ofstream out(XPLANE_PLUGIN_DIRECTORY CONFIG);
|
|
||||||
out << "scenery=" << this->scenery << "\n";
|
|
||||||
out << "user=" << this->user << "\n";
|
|
||||||
out << "token=" << this->token << "\n";
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::Config()
|
|
||||||
{
|
|
||||||
std::ifstream in(XPLANE_PLUGIN_DIRECTORY CONFIG);
|
|
||||||
std::string line;
|
|
||||||
while (std::getline(in, line)) {
|
|
||||||
std::vector<std::string> fields = util::split(line, '=');
|
|
||||||
if (fields.size() >= 2) {
|
|
||||||
util::trim(fields[0]);
|
|
||||||
util::trim(fields[1]);
|
|
||||||
if (fields[0] == "scenery") {
|
|
||||||
this->scenery = fields[1];
|
|
||||||
} else if (fields[0] == "user") {
|
|
||||||
this->user = fields[1];
|
|
||||||
} else if (fields[0] == "token") {
|
|
||||||
this->token = fields[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Config::updateScenery(std::string scenery)
|
|
||||||
{
|
|
||||||
this->scenery = scenery;
|
|
||||||
|
|
||||||
this->writeFile();
|
|
||||||
}
|
|
||||||
} // namespace config
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
#include "simdata/gate.h"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace simdata
|
|
||||||
{
|
|
||||||
Gate::Gate(std::string designator,
|
|
||||||
double latitude,
|
|
||||||
double longitude,
|
|
||||||
std::uint8_t radius)
|
|
||||||
{
|
|
||||||
this->designator = designator;
|
|
||||||
this->center = {latitude, longitude};
|
|
||||||
this->radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
Gate::Gate(std::string designator,
|
|
||||||
struct geodata::point center,
|
|
||||||
std::uint8_t radius)
|
|
||||||
{
|
|
||||||
this->designator = designator;
|
|
||||||
this->center = center;
|
|
||||||
this->radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Gate::toFile(std::ofstream &out) const
|
|
||||||
{
|
|
||||||
writeString(out, this->designator);
|
|
||||||
write<decltype(this->center)>(out, this->center);
|
|
||||||
write<decltype(this->radius)>(out, this->radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Gate::contains(geodata::point coordinates) const
|
|
||||||
{
|
|
||||||
return geodata::distanceEarthP(this->center, coordinates);
|
|
||||||
}
|
|
||||||
} // namespace simdata
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
#ifndef GERMANAIRLINESVA_FILE_CONFIG_H
|
|
||||||
#define GERMANAIRLINESVA_FILE_CONFIG_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "constants.h"
|
|
||||||
#include "util.hpp"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace config
|
|
||||||
{
|
|
||||||
class Config
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::string user;
|
|
||||||
std::string scenery;
|
|
||||||
std::string token;
|
|
||||||
|
|
||||||
void writeFile() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Config();
|
|
||||||
|
|
||||||
void updateScenery(std::string scenery);
|
|
||||||
|
|
||||||
inline const std::string getUser() const { return this->user; }
|
|
||||||
inline const std::string getScenery() const { return this->scenery; }
|
|
||||||
inline const std::string getToken() const { return this->token; }
|
|
||||||
};
|
|
||||||
} // namespace config
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
|
|
||||||
#endif
|
|
||||||
73
file/include/config/config.hpp
Normal file
73
file/include/config/config.hpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#ifndef GERMANAIRLINESVA_FILE_CONFIG_H
|
||||||
|
#define GERMANAIRLINESVA_FILE_CONFIG_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "constants.h"
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
|
namespace germanairlinesva
|
||||||
|
{
|
||||||
|
namespace file
|
||||||
|
{
|
||||||
|
namespace config
|
||||||
|
{
|
||||||
|
class Config
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string user;
|
||||||
|
std::string scenery;
|
||||||
|
std::string token;
|
||||||
|
|
||||||
|
inline void writeFile() const
|
||||||
|
{
|
||||||
|
std::ofstream out(BASE_DIRECTORY CONFIG);
|
||||||
|
out << "scenery=" << this->scenery << "\n";
|
||||||
|
out << "user=" << this->user << "\n";
|
||||||
|
out << "token=" << this->token << "\n";
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline Config()
|
||||||
|
{
|
||||||
|
std::ifstream in(BASE_DIRECTORY CONFIG);
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(in, line)) {
|
||||||
|
std::vector<std::string> fields = util::split(line, '=');
|
||||||
|
if (fields.size() >= 2) {
|
||||||
|
util::trim(fields[0]);
|
||||||
|
util::trim(fields[1]);
|
||||||
|
if (fields[0] == "scenery") {
|
||||||
|
this->scenery = fields[1];
|
||||||
|
} else if (fields[0] == "user") {
|
||||||
|
this->user = fields[1];
|
||||||
|
} else if (fields[0] == "token") {
|
||||||
|
this->token = fields[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void updateScenery(std::string scenery)
|
||||||
|
{
|
||||||
|
this->scenery = scenery;
|
||||||
|
|
||||||
|
this->writeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const std::string getUser() const { return this->user; }
|
||||||
|
inline const std::string getScenery() const { return this->scenery; }
|
||||||
|
inline const std::string getToken() const { return this->token; }
|
||||||
|
};
|
||||||
|
} // namespace config
|
||||||
|
} // namespace file
|
||||||
|
} // namespace germanairlinesva
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -37,17 +37,29 @@ namespace file
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// From X-Plane or MakeRwys
|
// From X-Plane or MakeRwys
|
||||||
Gate(std::string designator,
|
inline Gate(std::string designator,
|
||||||
double latitude,
|
double latitude,
|
||||||
double longitude,
|
double longitude,
|
||||||
std::uint8_t radius);
|
std::uint8_t radius)
|
||||||
|
: designator(designator), center({latitude, longitude}),
|
||||||
|
radius(radius){};
|
||||||
// From Database
|
// From Database
|
||||||
Gate(std::string designator,
|
inline Gate(std::string designator,
|
||||||
struct geodata::point center,
|
struct geodata::point center,
|
||||||
std::uint8_t radius);
|
std::uint8_t radius)
|
||||||
|
: designator(designator), center(center), radius(radius){};
|
||||||
|
|
||||||
void toFile(std::ofstream &out) const;
|
inline void toFile(std::ofstream &out) const
|
||||||
bool contains(geodata::point coordinates) const;
|
{
|
||||||
|
writeString(out, this->designator);
|
||||||
|
write<decltype(this->center)>(out, this->center);
|
||||||
|
write<decltype(this->radius)>(out, this->radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool contains(geodata::point coordinates) const
|
||||||
|
{
|
||||||
|
return geodata::distanceEarthP(this->center, coordinates);
|
||||||
|
}
|
||||||
|
|
||||||
inline const std::string to_string() const
|
inline const std::string to_string() const
|
||||||
{
|
{
|
||||||
@ -40,20 +40,45 @@ namespace file
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// From X-Plane or MakeRwys
|
// From X-Plane or MakeRwys
|
||||||
Runway(std::string designator,
|
inline Runway(std::string designator,
|
||||||
double latitudeStart,
|
double latitudeStart,
|
||||||
double longitudeStart,
|
double longitudeStart,
|
||||||
double latitudeEnd,
|
double latitudeEnd,
|
||||||
double longitudeEnd,
|
double longitudeEnd,
|
||||||
double width);
|
double width)
|
||||||
|
: designator(designator), width(width)
|
||||||
|
{
|
||||||
|
this->length = geodata::distanceEarthD(latitudeStart,
|
||||||
|
longitudeStart,
|
||||||
|
latitudeEnd,
|
||||||
|
longitudeEnd);
|
||||||
|
this->trueHeading = geodata::bearingDD(latitudeStart,
|
||||||
|
longitudeStart,
|
||||||
|
latitudeEnd,
|
||||||
|
longitudeEnd);
|
||||||
|
this->bounds =
|
||||||
|
geodata::calculateBoxDD({latitudeStart, longitudeStart},
|
||||||
|
{latitudeEnd, longitudeEnd},
|
||||||
|
this->trueHeading,
|
||||||
|
this->width);
|
||||||
|
};
|
||||||
// From database
|
// From database
|
||||||
Runway(std::string designator,
|
inline Runway(std::string designator,
|
||||||
struct geodata::box bounds,
|
struct geodata::box bounds,
|
||||||
std::uint8_t width,
|
std::uint8_t width,
|
||||||
std::uint16_t length,
|
std::uint16_t length,
|
||||||
double trueHeading);
|
double trueHeading)
|
||||||
|
: designator(designator), bounds(bounds), width(width),
|
||||||
|
length(length), trueHeading(trueHeading){};
|
||||||
|
|
||||||
void toFile(std::ofstream &out) const;
|
inline void toFile(std::ofstream &out) const
|
||||||
|
{
|
||||||
|
writeString(out, this->designator);
|
||||||
|
write<decltype(this->bounds)>(out, this->bounds);
|
||||||
|
write<decltype(this->width)>(out, this->width);
|
||||||
|
write<decltype(this->length)>(out, this->length);
|
||||||
|
write<decltype(this->trueHeading)>(out, this->trueHeading);
|
||||||
|
}
|
||||||
|
|
||||||
inline const std::string to_string() const
|
inline const std::string to_string() const
|
||||||
{
|
{
|
||||||
@ -1,76 +0,0 @@
|
|||||||
#ifndef GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
|
||||||
#define GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstring>
|
|
||||||
#include <fstream>
|
|
||||||
#include <functional>
|
|
||||||
#include <iostream>
|
|
||||||
#include <map>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "config/config.h"
|
|
||||||
#include "constants.h"
|
|
||||||
#include "simdata/gate.h"
|
|
||||||
#include "simdata/runway.h"
|
|
||||||
#include "simdata/simdataXP.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Header
|
|
||||||
*
|
|
||||||
* CHAR[5] | UINT8
|
|
||||||
* --------+--------
|
|
||||||
* VGAS | VERSION
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Airport
|
|
||||||
*
|
|
||||||
* UINT8 | CHAR[] | UINT16 | GATE[] | UINT8 | RUNWAY[]
|
|
||||||
* --------+--------+----------+--------+---------+---------
|
|
||||||
* STRLEN | ICAO | NUMGATES | GATES | NUMRWYS | RUNWAYS
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace simdata
|
|
||||||
{
|
|
||||||
class SimDatabase
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
||||||
airports;
|
|
||||||
|
|
||||||
void fromFile();
|
|
||||||
void readVersion1(std::ifstream &in);
|
|
||||||
|
|
||||||
public:
|
|
||||||
SimDatabase(int xPlaneVersion,
|
|
||||||
const char *hash,
|
|
||||||
std::unique_ptr<config::Config> &configuration,
|
|
||||||
std::function<void(const std::string)> toLog);
|
|
||||||
|
|
||||||
void toFile() const;
|
|
||||||
|
|
||||||
inline std::size_t getCount() const { return this->airports.size(); }
|
|
||||||
inline const std::pair<const std::vector<Gate>,
|
|
||||||
const std::vector<Runway>>
|
|
||||||
operator[](std::string key)
|
|
||||||
{
|
|
||||||
auto it = this->airports.find(key);
|
|
||||||
if (it != this->airports.end()) {
|
|
||||||
return this->airports[key];
|
|
||||||
} else {
|
|
||||||
return std::pair<std::vector<Gate>, std::vector<Runway>>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace simdata
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
|
|
||||||
#endif
|
|
||||||
183
file/include/simdata/simDatabase.hpp
Normal file
183
file/include/simdata/simDatabase.hpp
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
#ifndef GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
||||||
|
#define GERMANAIRLINESVA_FILE_SIMDATABASE_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "config/config.hpp"
|
||||||
|
#include "constants.h"
|
||||||
|
#include "simdata/gate.hpp"
|
||||||
|
#include "simdata/runway.hpp"
|
||||||
|
#include "simdata/simdataXP.hpp"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Header
|
||||||
|
*
|
||||||
|
* CHAR[5] | UINT8
|
||||||
|
* --------+--------
|
||||||
|
* VGAS | VERSION
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Airport
|
||||||
|
*
|
||||||
|
* UINT8 | CHAR[] | UINT16 | GATE[] | UINT8 | RUNWAY[]
|
||||||
|
* --------+--------+----------+--------+---------+---------
|
||||||
|
* STRLEN | ICAO | NUMGATES | GATES | NUMRWYS | RUNWAYS
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace germanairlinesva
|
||||||
|
{
|
||||||
|
namespace file
|
||||||
|
{
|
||||||
|
namespace simdata
|
||||||
|
{
|
||||||
|
class SimDatabase
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
|
airports;
|
||||||
|
|
||||||
|
inline void readVersion1(std::ifstream &in)
|
||||||
|
{
|
||||||
|
std::uint16_t numAirports = read<std::uint16_t>(in);
|
||||||
|
|
||||||
|
for (int i = 0; i < numAirports; i++) {
|
||||||
|
// ICAO
|
||||||
|
std::string icao = readString(in);
|
||||||
|
// Gates
|
||||||
|
std::uint16_t numGates = read<std::uint16_t>(in);
|
||||||
|
for (int j = 0; j < numGates; j++) {
|
||||||
|
std::string designator = readString(in);
|
||||||
|
struct geodata::point center = read<struct geodata::point>(in);
|
||||||
|
std::uint8_t radius = read<std::uint8_t>(in);
|
||||||
|
|
||||||
|
this->airports[icao].first.emplace_back(designator,
|
||||||
|
center,
|
||||||
|
radius);
|
||||||
|
}
|
||||||
|
// Runways
|
||||||
|
std::uint8_t numRunways = read<std::uint8_t>(in);
|
||||||
|
for (int j = 0; j < numRunways; j++) {
|
||||||
|
std::string designator = readString(in);
|
||||||
|
// Center
|
||||||
|
struct geodata::box bounds = read<struct geodata::box>(in);
|
||||||
|
std::uint8_t width = read<std::uint8_t>(in);
|
||||||
|
std::uint16_t length = read<std::uint16_t>(in);
|
||||||
|
double trueHeading = read<double>(in);
|
||||||
|
|
||||||
|
this->airports[icao].second.emplace_back(designator,
|
||||||
|
bounds,
|
||||||
|
width,
|
||||||
|
length,
|
||||||
|
trueHeading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void fromFile()
|
||||||
|
{
|
||||||
|
std::ifstream in(BASE_DIRECTORY SIMDATABASE, std::ifstream::binary);
|
||||||
|
|
||||||
|
// File Header
|
||||||
|
std::string ident = readString(in, 5);
|
||||||
|
if (ident.compare("VGAS") != 0) {
|
||||||
|
throw std::invalid_argument("Wrong file");
|
||||||
|
}
|
||||||
|
std::uint8_t version = read<std::uint8_t>(in);
|
||||||
|
|
||||||
|
if (version == 1) {
|
||||||
|
this->readVersion1(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline SimDatabase(int xPlaneVersion,
|
||||||
|
const char *hash,
|
||||||
|
std::unique_ptr<config::Config> &configuration,
|
||||||
|
std::function<void(const std::string)> toLog)
|
||||||
|
{
|
||||||
|
if (strcmp(configuration->getScenery().c_str(), hash) != 0 ||
|
||||||
|
!util::fileExists(BASE_DIRECTORY SIMDATABASE)) {
|
||||||
|
#ifdef XP
|
||||||
|
scan(xPlaneVersion < 12000 ? XPLANE11_BASE_SCENERY
|
||||||
|
: XPLANE12_BASE_SCENERY,
|
||||||
|
XPLANE_CUSTOM_SCENERY,
|
||||||
|
BASE_DIRECTORY "log.txt",
|
||||||
|
airports);
|
||||||
|
#else
|
||||||
|
toLog("ESP SCAN WILL BE HERE");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
configuration->updateScenery(hash);
|
||||||
|
this->toFile();
|
||||||
|
|
||||||
|
toLog("Sim Database updated");
|
||||||
|
} else {
|
||||||
|
this->fromFile();
|
||||||
|
|
||||||
|
toLog("Sim Database loaded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void toFile() const
|
||||||
|
{
|
||||||
|
std::ofstream out(BASE_DIRECTORY SIMDATABASE, std::fstream::binary);
|
||||||
|
|
||||||
|
// File Header, Last member is version
|
||||||
|
std::uint8_t header[] = {'V', 'G', 'A', 'S', '\0', 1};
|
||||||
|
out.write(reinterpret_cast<const char *>(header), 6);
|
||||||
|
// Num Airports
|
||||||
|
write<std::uint16_t>(out, airports.size());
|
||||||
|
// Airport
|
||||||
|
for (const std::pair<
|
||||||
|
const std::string,
|
||||||
|
std::pair<std::vector<Gate>, std::vector<Runway>>> &airport :
|
||||||
|
airports) {
|
||||||
|
std::string icao = airport.first;
|
||||||
|
const std::vector<Gate> gates = airport.second.first;
|
||||||
|
const std::vector<Runway> runways = airport.second.second;
|
||||||
|
// ICAO
|
||||||
|
writeString(out, icao);
|
||||||
|
// Gates
|
||||||
|
write<std::uint16_t>(out, gates.size());
|
||||||
|
for (const Gate &gate : gates) {
|
||||||
|
gate.toFile(out);
|
||||||
|
}
|
||||||
|
// Runways
|
||||||
|
write<std::uint8_t>(out, runways.size());
|
||||||
|
for (const Runway &runway : runways) {
|
||||||
|
runway.toFile(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::size_t getCount() const { return this->airports.size(); }
|
||||||
|
|
||||||
|
inline const std::pair<const std::vector<Gate>,
|
||||||
|
const std::vector<Runway>>
|
||||||
|
operator[](std::string key)
|
||||||
|
{
|
||||||
|
auto it = this->airports.find(key);
|
||||||
|
if (it != this->airports.end()) {
|
||||||
|
return this->airports[key];
|
||||||
|
} else {
|
||||||
|
return std::pair<std::vector<Gate>, std::vector<Runway>>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace simdata
|
||||||
|
} // namespace file
|
||||||
|
} // namespace germanairlinesva
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,42 +0,0 @@
|
|||||||
#ifndef GERMANAIRLINESVA_FILE_SIMDATAXP_H
|
|
||||||
#define GERMANAIRLINESVA_FILE_SIMDATAXP_H
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "simdata/gate.h"
|
|
||||||
#include "simdata/runway.h"
|
|
||||||
#include "simdata/simDatabase.h"
|
|
||||||
#include "util.hpp"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace simdata
|
|
||||||
{
|
|
||||||
int scan(
|
|
||||||
const std::string defaultFile,
|
|
||||||
const std::string sceneryPack,
|
|
||||||
const std::string logFile,
|
|
||||||
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
||||||
&airports);
|
|
||||||
|
|
||||||
void makeAirport(
|
|
||||||
const std::string &kind,
|
|
||||||
std::ifstream &infile,
|
|
||||||
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
||||||
&airports,
|
|
||||||
std::ofstream &logfile);
|
|
||||||
void makeGate15(std::vector<Gate> &gates,
|
|
||||||
const std::vector<std::string> &fields);
|
|
||||||
void makeRunway(std::vector<Runway> &runways,
|
|
||||||
const std::vector<std::string> &fields);
|
|
||||||
void makeGate1300(std::vector<Gate> &gates,
|
|
||||||
const std::vector<std::string> &fields);
|
|
||||||
} // namespace simdata
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,4 +1,13 @@
|
|||||||
#include "simdata/simdataXP.h"
|
#ifndef GERMANAIRLINESVA_FILE_SIMDATAXP_H
|
||||||
|
#define GERMANAIRLINESVA_FILE_SIMDATAXP_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "simdata/gate.hpp"
|
||||||
|
#include "simdata/runway.hpp"
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
namespace germanairlinesva
|
namespace germanairlinesva
|
||||||
{
|
{
|
||||||
@ -6,68 +15,55 @@ namespace file
|
|||||||
{
|
{
|
||||||
namespace simdata
|
namespace simdata
|
||||||
{
|
{
|
||||||
int scan(
|
inline void makeGate15(std::vector<Gate> &gates,
|
||||||
const std::string defaultFile,
|
const std::vector<std::string> &fields)
|
||||||
const std::string sceneryPack,
|
|
||||||
const std::string logFile,
|
|
||||||
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
||||||
&airports)
|
|
||||||
{
|
{
|
||||||
std::ifstream base(defaultFile);
|
std::string gateName;
|
||||||
if (!base.good()) {
|
for (size_t j = 4; j < fields.size() - 1; j++) {
|
||||||
return 1;
|
gateName += fields[j] + " ";
|
||||||
}
|
}
|
||||||
std::ifstream custom(sceneryPack);
|
gateName += fields.back();
|
||||||
if (!custom.good()) {
|
gateName = std::regex_replace(gateName, std::regex{","}, "0");
|
||||||
base.close();
|
gates.emplace_back(gateName,
|
||||||
return 2;
|
std::stod(fields[1]),
|
||||||
}
|
std::stod(fields[2]),
|
||||||
std::ofstream logfile(logFile, std::fstream::trunc);
|
40);
|
||||||
if (!logfile.good()) {
|
|
||||||
base.close();
|
|
||||||
custom.close();
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default
|
|
||||||
logfile << "<FILE> " << defaultFile << std::endl;
|
|
||||||
makeAirport("DEFAULT", base, airports, logfile);
|
|
||||||
base.close();
|
|
||||||
|
|
||||||
std::string line;
|
|
||||||
size_t pos;
|
|
||||||
std::vector<std::string> packs;
|
|
||||||
while (std::getline(custom, line)) {
|
|
||||||
if ((pos = line.find("SCENERY_PACK")) != std::string::npos) {
|
|
||||||
std::string path = util::rtrim_copy(line.substr(pos + 13)) +
|
|
||||||
"Earth nav data/apt.dat";
|
|
||||||
packs.emplace_back(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::reverse(packs.begin(), packs.end());
|
|
||||||
|
|
||||||
for (std::string const &path : packs) {
|
|
||||||
std::ifstream pack(path);
|
|
||||||
if (pack.good()) {
|
|
||||||
logfile << "<FILE> " << path << std::endl;
|
|
||||||
makeAirport("CUSTOM", pack, airports, logfile);
|
|
||||||
pack.close();
|
|
||||||
} else {
|
|
||||||
pack.close();
|
|
||||||
logfile << "<STATUS>"
|
|
||||||
<< "Could not find " << path << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logfile << std::endl
|
|
||||||
<< "<STATUS> Total airports: " << airports.size() << std::endl;
|
|
||||||
|
|
||||||
custom.close();
|
|
||||||
logfile.close();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeAirport(
|
inline void makeRunway(std::vector<Runway> &runways,
|
||||||
|
const std::vector<std::string> &fields)
|
||||||
|
{
|
||||||
|
runways.emplace_back(fields[8],
|
||||||
|
std::stod(fields[9]),
|
||||||
|
std::stod(fields[10]),
|
||||||
|
std::stod(fields[18]),
|
||||||
|
std::stod(fields[19]),
|
||||||
|
std::stod(fields[1]));
|
||||||
|
runways.emplace_back(fields[17],
|
||||||
|
std::stod(fields[18]),
|
||||||
|
std::stod(fields[19]),
|
||||||
|
std::stod(fields[9]),
|
||||||
|
std::stod(fields[10]),
|
||||||
|
std::stod(fields[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void makeGate1300(std::vector<Gate> &gates,
|
||||||
|
const std::vector<std::string> &fields)
|
||||||
|
{
|
||||||
|
std::string gateName;
|
||||||
|
for (size_t j = 6; j < fields.size() - 1; j++) {
|
||||||
|
gateName += fields[j] + " ";
|
||||||
|
}
|
||||||
|
gateName += fields.back();
|
||||||
|
gateName = std::regex_replace(gateName, std::regex{","}, "0");
|
||||||
|
|
||||||
|
gates.emplace_back(gateName,
|
||||||
|
std::stod(fields[1]),
|
||||||
|
std::stod(fields[2]),
|
||||||
|
40);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void makeAirport(
|
||||||
const std::string &kind,
|
const std::string &kind,
|
||||||
std::ifstream &infile,
|
std::ifstream &infile,
|
||||||
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
@ -144,53 +140,68 @@ namespace file
|
|||||||
<< validCount << " are valid" << std::endl;
|
<< validCount << " are valid" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeGate15(std::vector<Gate> &gates,
|
inline int scan(
|
||||||
const std::vector<std::string> &fields)
|
const std::string defaultFile,
|
||||||
|
const std::string sceneryPack,
|
||||||
|
const std::string logFile,
|
||||||
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
|
&airports)
|
||||||
{
|
{
|
||||||
std::string gateName;
|
std::ifstream base(defaultFile);
|
||||||
for (size_t j = 4; j < fields.size() - 1; j++) {
|
if (!base.good()) {
|
||||||
gateName += fields[j] + " ";
|
return 1;
|
||||||
}
|
}
|
||||||
gateName += fields.back();
|
std::ifstream custom(sceneryPack);
|
||||||
gateName = std::regex_replace(gateName, std::regex{","}, "0");
|
if (!custom.good()) {
|
||||||
gates.emplace_back(gateName,
|
base.close();
|
||||||
std::stod(fields[1]),
|
return 2;
|
||||||
std::stod(fields[2]),
|
}
|
||||||
40);
|
std::ofstream logfile(logFile, std::fstream::trunc);
|
||||||
}
|
if (!logfile.good()) {
|
||||||
|
base.close();
|
||||||
void makeRunway(std::vector<Runway> &runways,
|
custom.close();
|
||||||
const std::vector<std::string> &fields)
|
return 3;
|
||||||
{
|
|
||||||
runways.emplace_back(fields[8],
|
|
||||||
std::stod(fields[9]),
|
|
||||||
std::stod(fields[10]),
|
|
||||||
std::stod(fields[18]),
|
|
||||||
std::stod(fields[19]),
|
|
||||||
std::stod(fields[1]));
|
|
||||||
runways.emplace_back(fields[17],
|
|
||||||
std::stod(fields[18]),
|
|
||||||
std::stod(fields[19]),
|
|
||||||
std::stod(fields[9]),
|
|
||||||
std::stod(fields[10]),
|
|
||||||
std::stod(fields[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
void makeGate1300(std::vector<Gate> &gates,
|
|
||||||
const std::vector<std::string> &fields)
|
|
||||||
{
|
|
||||||
std::string gateName;
|
|
||||||
for (size_t j = 6; j < fields.size() - 1; j++) {
|
|
||||||
gateName += fields[j] + " ";
|
|
||||||
}
|
}
|
||||||
gateName += fields.back();
|
|
||||||
gateName = std::regex_replace(gateName, std::regex{","}, "0");
|
|
||||||
|
|
||||||
gates.emplace_back(gateName,
|
// Default
|
||||||
std::stod(fields[1]),
|
logfile << "<FILE> " << defaultFile << std::endl;
|
||||||
std::stod(fields[2]),
|
makeAirport("DEFAULT", base, airports, logfile);
|
||||||
40);
|
base.close();
|
||||||
|
|
||||||
|
std::string line;
|
||||||
|
size_t pos;
|
||||||
|
std::vector<std::string> packs;
|
||||||
|
while (std::getline(custom, line)) {
|
||||||
|
if ((pos = line.find("SCENERY_PACK")) != std::string::npos) {
|
||||||
|
std::string path = util::rtrim_copy(line.substr(pos + 13)) +
|
||||||
|
"Earth nav data/apt.dat";
|
||||||
|
packs.emplace_back(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::reverse(packs.begin(), packs.end());
|
||||||
|
|
||||||
|
for (std::string const &path : packs) {
|
||||||
|
std::ifstream pack(path);
|
||||||
|
if (pack.good()) {
|
||||||
|
logfile << "<FILE> " << path << std::endl;
|
||||||
|
makeAirport("CUSTOM", pack, airports, logfile);
|
||||||
|
pack.close();
|
||||||
|
} else {
|
||||||
|
pack.close();
|
||||||
|
logfile << "<STATUS>"
|
||||||
|
<< "Could not find " << path << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logfile << std::endl
|
||||||
|
<< "<STATUS> Total airports: " << airports.size() << std::endl;
|
||||||
|
|
||||||
|
custom.close();
|
||||||
|
logfile.close();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace simdata
|
} // namespace simdata
|
||||||
} // namespace file
|
} // namespace file
|
||||||
} // namespace germanairlinesva
|
} // namespace germanairlinesva
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -8,14 +8,14 @@ namespace file
|
|||||||
{
|
{
|
||||||
Logbook::Logbook()
|
Logbook::Logbook()
|
||||||
{
|
{
|
||||||
if (util::fileExists(XPLANE_PLUGIN_DIRECTORY LOGBOOK)) {
|
if (util::fileExists(BASE_DIRECTORY LOGBOOK)) {
|
||||||
this->fromFile();
|
this->fromFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logbook::fromFile()
|
void Logbook::fromFile()
|
||||||
{
|
{
|
||||||
std::ifstream in(XPLANE_PLUGIN_DIRECTORY LOGBOOK, std::ifstream::binary);
|
std::ifstream in(BASE_DIRECTORY LOGBOOK, std::ifstream::binary);
|
||||||
|
|
||||||
// File Header
|
// File Header
|
||||||
std::string ident = readString(in, 5);
|
std::string ident = readString(in, 5);
|
||||||
@ -96,7 +96,7 @@ namespace file
|
|||||||
|
|
||||||
void Logbook::toFile() const
|
void Logbook::toFile() const
|
||||||
{
|
{
|
||||||
std::ofstream out(XPLANE_PLUGIN_DIRECTORY LOGBOOK, std::fstream::binary);
|
std::ofstream out(BASE_DIRECTORY LOGBOOK, std::fstream::binary);
|
||||||
char header[] = {'V', 'G', 'A', 'L', '\0', 1};
|
char header[] = {'V', 'G', 'A', 'L', '\0', 1};
|
||||||
out.write(header, 6);
|
out.write(header, 6);
|
||||||
for (const LogbookEntry &entry : this->entries) {
|
for (const LogbookEntry &entry : this->entries) {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace file
|
|||||||
{
|
{
|
||||||
void Recording::toFile(std::string fileName) const
|
void Recording::toFile(std::string fileName) const
|
||||||
{
|
{
|
||||||
std::ofstream out(XPLANE_PLUGIN_DIRECTORY RECORDING_DIRECTORY + fileName,
|
std::ofstream out(BASE_DIRECTORY RECORDING_DIRECTORY + fileName,
|
||||||
std::fstream::binary);
|
std::fstream::binary);
|
||||||
char header[] = {'V', 'G', 'A', 'R', '\0', 1};
|
char header[] = {'V', 'G', 'A', 'R', '\0', 1};
|
||||||
out.write(header, 6);
|
out.write(header, 6);
|
||||||
|
|||||||
@ -1,55 +0,0 @@
|
|||||||
#include "simdata/runway.h"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace simdata
|
|
||||||
{
|
|
||||||
Runway::Runway(std::string designator,
|
|
||||||
double latitudeStart,
|
|
||||||
double longitudeStart,
|
|
||||||
double latitudeEnd,
|
|
||||||
double longitudeEnd,
|
|
||||||
double width)
|
|
||||||
{
|
|
||||||
this->designator = designator;
|
|
||||||
this->width = width;
|
|
||||||
this->length = geodata::distanceEarthD(latitudeStart,
|
|
||||||
longitudeStart,
|
|
||||||
latitudeEnd,
|
|
||||||
longitudeEnd);
|
|
||||||
this->trueHeading = geodata::bearingDD(latitudeStart,
|
|
||||||
longitudeStart,
|
|
||||||
latitudeEnd,
|
|
||||||
longitudeEnd);
|
|
||||||
this->bounds = geodata::calculateBoxDD({latitudeStart, longitudeStart},
|
|
||||||
{latitudeEnd, longitudeEnd},
|
|
||||||
this->trueHeading,
|
|
||||||
this->width);
|
|
||||||
}
|
|
||||||
|
|
||||||
Runway::Runway(std::string designator,
|
|
||||||
struct geodata::box bounds,
|
|
||||||
std::uint8_t width,
|
|
||||||
std::uint16_t length,
|
|
||||||
double trueHeading)
|
|
||||||
{
|
|
||||||
this->designator = designator;
|
|
||||||
this->bounds = bounds;
|
|
||||||
this->width = width;
|
|
||||||
this->length = length;
|
|
||||||
this->trueHeading = trueHeading;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Runway::toFile(std::ofstream &out) const
|
|
||||||
{
|
|
||||||
writeString(out, this->designator);
|
|
||||||
write<decltype(this->bounds)>(out, this->bounds);
|
|
||||||
write<decltype(this->width)>(out, this->width);
|
|
||||||
write<decltype(this->length)>(out, this->length);
|
|
||||||
write<decltype(this->trueHeading)>(out, this->trueHeading);
|
|
||||||
}
|
|
||||||
} // namespace simdata
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
@ -1,121 +0,0 @@
|
|||||||
#include "simdata/simDatabase.h"
|
|
||||||
|
|
||||||
namespace germanairlinesva
|
|
||||||
{
|
|
||||||
namespace file
|
|
||||||
{
|
|
||||||
namespace simdata
|
|
||||||
{
|
|
||||||
SimDatabase::SimDatabase(int xPlaneVersion,
|
|
||||||
const char *hash,
|
|
||||||
std::unique_ptr<config::Config> &configuration,
|
|
||||||
std::function<void(const std::string)> toLog)
|
|
||||||
{
|
|
||||||
if (strcmp(configuration->getScenery().c_str(), hash) != 0 ||
|
|
||||||
!util::fileExists(XPLANE_PLUGIN_DIRECTORY SIMDATABASE)) {
|
|
||||||
scan(xPlaneVersion < 12000 ? XPLANE11_BASE_SCENERY
|
|
||||||
: XPLANE12_BASE_SCENERY,
|
|
||||||
XPLANE_CUSTOM_SCENERY,
|
|
||||||
XPLANE_PLUGIN_DIRECTORY "log.txt",
|
|
||||||
airports);
|
|
||||||
|
|
||||||
configuration->updateScenery(hash);
|
|
||||||
this->toFile();
|
|
||||||
|
|
||||||
toLog("Sim Database updated");
|
|
||||||
} else {
|
|
||||||
this->fromFile();
|
|
||||||
|
|
||||||
toLog("Sim Database loaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimDatabase::fromFile()
|
|
||||||
{
|
|
||||||
std::ifstream in(XPLANE_PLUGIN_DIRECTORY SIMDATABASE,
|
|
||||||
std::ifstream::binary);
|
|
||||||
|
|
||||||
// File Header
|
|
||||||
std::string ident = readString(in, 5);
|
|
||||||
if (ident.compare("VGAS") != 0) {
|
|
||||||
throw std::invalid_argument("Wrong file");
|
|
||||||
}
|
|
||||||
std::uint8_t version = read<std::uint8_t>(in);
|
|
||||||
|
|
||||||
if (version == 1) {
|
|
||||||
this->readVersion1(in);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimDatabase::readVersion1(std::ifstream &in)
|
|
||||||
{
|
|
||||||
std::uint16_t numAirports = read<std::uint16_t>(in);
|
|
||||||
|
|
||||||
for (int i = 0; i < numAirports; i++) {
|
|
||||||
// ICAO
|
|
||||||
std::string icao = readString(in);
|
|
||||||
// Gates
|
|
||||||
std::uint16_t numGates = read<std::uint16_t>(in);
|
|
||||||
for (int j = 0; j < numGates; j++) {
|
|
||||||
std::string designator = readString(in);
|
|
||||||
struct geodata::point center = read<struct geodata::point>(in);
|
|
||||||
std::uint8_t radius = read<std::uint8_t>(in);
|
|
||||||
|
|
||||||
this->airports[icao].first.emplace_back(designator, center, radius);
|
|
||||||
}
|
|
||||||
// Runways
|
|
||||||
std::uint8_t numRunways = read<std::uint8_t>(in);
|
|
||||||
for (int j = 0; j < numRunways; j++) {
|
|
||||||
std::string designator = readString(in);
|
|
||||||
// Center
|
|
||||||
struct geodata::box bounds = read<struct geodata::box>(in);
|
|
||||||
std::uint8_t width = read<std::uint8_t>(in);
|
|
||||||
std::uint16_t length = read<std::uint16_t>(in);
|
|
||||||
double trueHeading = read<double>(in);
|
|
||||||
|
|
||||||
this->airports[icao].second.emplace_back(designator,
|
|
||||||
bounds,
|
|
||||||
width,
|
|
||||||
length,
|
|
||||||
trueHeading);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimDatabase::toFile() const
|
|
||||||
{
|
|
||||||
std::ofstream out(XPLANE_PLUGIN_DIRECTORY SIMDATABASE,
|
|
||||||
std::fstream::binary);
|
|
||||||
|
|
||||||
// File Header, Last member is version
|
|
||||||
std::uint8_t header[] = {'V', 'G', 'A', 'S', '\0', 1};
|
|
||||||
out.write(reinterpret_cast<const char *>(header), 6);
|
|
||||||
// Num Airports
|
|
||||||
write<std::uint16_t>(out, airports.size());
|
|
||||||
// Airport
|
|
||||||
for (const std::pair<const std::string,
|
|
||||||
std::pair<std::vector<Gate>, std::vector<Runway>>>
|
|
||||||
&airport : airports) {
|
|
||||||
std::string icao = airport.first;
|
|
||||||
const std::vector<Gate> gates = airport.second.first;
|
|
||||||
const std::vector<Runway> runways = airport.second.second;
|
|
||||||
// ICAO
|
|
||||||
writeString(out, icao);
|
|
||||||
// Gates
|
|
||||||
write<std::uint16_t>(out, gates.size());
|
|
||||||
for (const Gate &gate : gates) {
|
|
||||||
gate.toFile(out);
|
|
||||||
}
|
|
||||||
// Runways
|
|
||||||
write<std::uint8_t>(out, runways.size());
|
|
||||||
for (const Runway &runway : runways) {
|
|
||||||
runway.toFile(out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
} // namespace simdata
|
|
||||||
} // namespace file
|
|
||||||
} // namespace germanairlinesva
|
|
||||||
@ -1,9 +1,13 @@
|
|||||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
#ifndef GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
||||||
#define GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
#define GERMANAIRLINESVA_GACONNECTOR_CONSTANTS_H
|
||||||
|
|
||||||
#define XPLANE_CUSTOM_SCENERY "Custom Scenery/scenery_packs.ini"
|
#ifdef XP
|
||||||
#define XPLANE_PLUGIN_DIRECTORY "Resources/plugins/GAConnector/"
|
#define BASE_DIRECTORY "Resources/plugins/GAConnector/"
|
||||||
|
#else
|
||||||
|
#define BASE_DIRECTORY "./"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define XPLANE_CUSTOM_SCENERY "Custom Scenery/scenery_packs.ini"
|
||||||
#define XPLANE11_BASE_SCENERY \
|
#define XPLANE11_BASE_SCENERY \
|
||||||
"Resources/default scenery/default apt dat/Earth nav data/apt.dat"
|
"Resources/default scenery/default apt dat/Earth nav data/apt.dat"
|
||||||
#define XPLANE12_BASE_SCENERY \
|
#define XPLANE12_BASE_SCENERY \
|
||||||
|
|||||||
@ -55,6 +55,7 @@ if(APPLE)
|
|||||||
|
|
||||||
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
||||||
APL
|
APL
|
||||||
|
XP
|
||||||
)
|
)
|
||||||
target_compile_options(germanairlinesva_xplugin PRIVATE
|
target_compile_options(germanairlinesva_xplugin PRIVATE
|
||||||
"SHELL:-arch x86_64"
|
"SHELL:-arch x86_64"
|
||||||
@ -76,6 +77,7 @@ elseif(UNIX)
|
|||||||
|
|
||||||
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
||||||
LIN
|
LIN
|
||||||
|
XP
|
||||||
)
|
)
|
||||||
target_compile_options(germanairlinesva_xplugin PRIVATE
|
target_compile_options(germanairlinesva_xplugin PRIVATE
|
||||||
-nodefaultlibs
|
-nodefaultlibs
|
||||||
@ -90,6 +92,7 @@ elseif(WIN32)
|
|||||||
|
|
||||||
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
target_compile_definitions(germanairlinesva_xplugin PUBLIC
|
||||||
IBM
|
IBM
|
||||||
|
XP
|
||||||
)
|
)
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
target_compile_options(germanairlinesva_xplugin PRIVATE
|
target_compile_options(germanairlinesva_xplugin PRIVATE
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
#ifndef GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
||||||
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
|
||||||
|
|
||||||
#include "config/config.h"
|
#include "config/config.hpp"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "logbook/logbook.h"
|
#include "logbook/logbook.h"
|
||||||
#include "recording/recording.h"
|
#include "recording/recording.h"
|
||||||
#include "simdata/simDatabase.h"
|
#include "simdata/simDatabase.hpp"
|
||||||
#include "simdata/simdataXP.h"
|
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
#include "websocket.h"
|
#include "websocket.h"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user