Fix merge errors
This commit is contained in:
parent
6027095c38
commit
de8b282ab1
@ -16,16 +16,22 @@ namespace file
|
||||
{
|
||||
namespace simdata
|
||||
{
|
||||
int scan(const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
SimDatabase &airports);
|
||||
int scan(
|
||||
const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
std::map<std::string,
|
||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports);
|
||||
|
||||
void makeAirport(const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
SimDatabase &airports,
|
||||
std::ofstream &logfile);
|
||||
void makeGate15(std::vector<Gate> &gates,
|
||||
void makeAirport(
|
||||
const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
std::map<std::string,
|
||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports,
|
||||
std::ofstream &logfile);
|
||||
void makeGate15(std::vector<const Gate> &gates,
|
||||
const std::vector<std::string> &fields);
|
||||
void makeRunway(std::vector<const Runway> &runways,
|
||||
const std::vector<std::string> &fields);
|
||||
|
||||
@ -6,10 +6,13 @@ namespace file
|
||||
{
|
||||
namespace simdata
|
||||
{
|
||||
int scan(const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
SimDatabase &database)
|
||||
int scan(
|
||||
const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
std::map<std::string,
|
||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports)
|
||||
{
|
||||
std::ifstream base(defaultFile);
|
||||
if (!base.good()) {
|
||||
@ -29,7 +32,7 @@ namespace file
|
||||
|
||||
// Default
|
||||
logfile << "<FILE> " << defaultFile << std::endl;
|
||||
makeAirport("DEFAULT", base, database, logfile);
|
||||
makeAirport("DEFAULT", base, airports, logfile);
|
||||
base.close();
|
||||
|
||||
std::string line;
|
||||
@ -49,7 +52,7 @@ namespace file
|
||||
std::ifstream pack(path);
|
||||
if (pack.good()) {
|
||||
logfile << "<FILE> " << path << std::endl;
|
||||
makeAirport("CUSTOM", pack, database, logfile);
|
||||
makeAirport("CUSTOM", pack, airports, logfile);
|
||||
pack.close();
|
||||
} else {
|
||||
pack.close();
|
||||
@ -59,18 +62,20 @@ namespace file
|
||||
}
|
||||
|
||||
logfile << std::endl
|
||||
<< "<STATUS> Total airports: " << database.numAirports()
|
||||
<< std::endl;
|
||||
<< "<STATUS> Total airports: " << airports.size() << std::endl;
|
||||
|
||||
custom.close();
|
||||
logfile.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void makeAirport(const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
SimDatabase &database,
|
||||
std::ofstream &logfile)
|
||||
void makeAirport(
|
||||
const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
std::map<std::string,
|
||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports,
|
||||
std::ofstream &logfile)
|
||||
{
|
||||
std::string line;
|
||||
std::string *currentIcao = nullptr;
|
||||
@ -93,7 +98,7 @@ namespace file
|
||||
// Write to file if ICAO is valid, and we have gates and runways
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||
!tmpGates.empty()) {
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||
<< std::endl;
|
||||
@ -113,7 +118,7 @@ namespace file
|
||||
// Write to file if ICAO is valid, and we have gates and runways
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||
!tmpGates.empty()) {
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||
<< std::endl;
|
||||
@ -135,7 +140,7 @@ namespace file
|
||||
}
|
||||
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() && !tmpGates.empty()) {
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed" << std::endl;
|
||||
}
|
||||
|
||||
@ -116,10 +116,11 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
||||
|
||||
try {
|
||||
connector = std::make_unique<germanairlinesva_websocket::Websocket>(
|
||||
"wss://ws.hofmannnet.myhome-server.de:8000",
|
||||
"ss://ws.hofmannnet.myhome-server.de:8000",
|
||||
configuration->getUser(),
|
||||
toLog);
|
||||
} catch (const std::invalid_argument &e) {
|
||||
toLog("SOCK");
|
||||
toLog(e.what());
|
||||
return 0;
|
||||
}
|
||||
@ -146,9 +147,55 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
||||
ap2.first.size() == 0 ? toLog(" SUCCESS") : toLog(" ERROR");
|
||||
}
|
||||
|
||||
delete connector.release();
|
||||
delete database.release();
|
||||
delete configuration.release();
|
||||
// Thread for sending data to websocket
|
||||
serverThread = std::thread(&serverWorker);
|
||||
recordingThread = std::thread(&recordingWorker);
|
||||
toLog("Workers started");
|
||||
|
||||
toLog("Logbook Test");
|
||||
germanairlinesva::file::logbook::Logbook logbook;
|
||||
logbook.addEntry("08.09.2022",
|
||||
"1000",
|
||||
"L049",
|
||||
"D-ALFA",
|
||||
"John F. Kennedy International Aiport / EDDF",
|
||||
"A1",
|
||||
"14L",
|
||||
"Gander International Airport / CYQX",
|
||||
"10",
|
||||
"03",
|
||||
"10:00",
|
||||
"10:20",
|
||||
"13:20",
|
||||
"13:30",
|
||||
210.5,
|
||||
20.1,
|
||||
5012.4156,
|
||||
8.87,
|
||||
5041.3856,
|
||||
7.1,
|
||||
971.14,
|
||||
2.41,
|
||||
980.65,
|
||||
-165.23,
|
||||
1,
|
||||
1.2012,
|
||||
"2022-09-08_VGA1000",
|
||||
5.5,
|
||||
1);
|
||||
logbook.toFile();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
PLUGIN_API void XPluginStop(void)
|
||||
{
|
||||
/* Flight Loop */
|
||||
XPLMUnregisterFlightLoopCallback(flightLoop, nullptr);
|
||||
/* End threads */
|
||||
wantsExit = true;
|
||||
serverThread.join();
|
||||
recordingThread.join();
|
||||
|
||||
delete connector.release();
|
||||
delete database.release();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user