Fix Linux
This commit is contained in:
parent
de8b282ab1
commit
46a0607b55
@ -44,8 +44,8 @@ namespace file
|
|||||||
private:
|
private:
|
||||||
std::map<
|
std::map<
|
||||||
std::string,
|
std::string,
|
||||||
std::pair<std::vector<const germanairlinesva::file::simdata::Gate>,
|
std::pair<std::vector<germanairlinesva::file::simdata::Gate>,
|
||||||
std::vector<const germanairlinesva::file::simdata::Runway>>>
|
std::vector<germanairlinesva::file::simdata::Runway>>>
|
||||||
airports;
|
airports;
|
||||||
|
|
||||||
void fromFile();
|
void fromFile();
|
||||||
@ -60,13 +60,15 @@ namespace file
|
|||||||
void toFile() const;
|
void toFile() const;
|
||||||
|
|
||||||
inline std::size_t getCount() const { return this->airports.size(); }
|
inline std::size_t getCount() const { return this->airports.size(); }
|
||||||
inline const std::pair<const std::vector<const Gate>, const std::vector<const Runway>>
|
inline const std::pair<const std::vector<Gate>,
|
||||||
|
const std::vector<Runway>>
|
||||||
operator[](std::string key)
|
operator[](std::string key)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return this->airports.at(key);
|
return this->airports.at(key);
|
||||||
} catch (std::out_of_range &ex) {
|
} catch (std::out_of_range &ex) {
|
||||||
return std::pair<const std::vector<const Gate>, const std::vector<const Runway>>();
|
return std::pair<const std::vector<Gate>,
|
||||||
|
const std::vector<Runway>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -21,21 +21,21 @@ namespace file
|
|||||||
const std::string sceneryPack,
|
const std::string sceneryPack,
|
||||||
const std::string logFile,
|
const std::string logFile,
|
||||||
std::map<std::string,
|
std::map<std::string,
|
||||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
&airports);
|
&airports);
|
||||||
|
|
||||||
void makeAirport(
|
void makeAirport(
|
||||||
const std::string &kind,
|
const std::string &kind,
|
||||||
std::ifstream &infile,
|
std::ifstream &infile,
|
||||||
std::map<std::string,
|
std::map<std::string,
|
||||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
&airports,
|
&airports,
|
||||||
std::ofstream &logfile);
|
std::ofstream &logfile);
|
||||||
void makeGate15(std::vector<const Gate> &gates,
|
void makeGate15(std::vector<Gate> &gates,
|
||||||
const std::vector<std::string> &fields);
|
const std::vector<std::string> &fields);
|
||||||
void makeRunway(std::vector<const Runway> &runways,
|
void makeRunway(std::vector<Runway> &runways,
|
||||||
const std::vector<std::string> &fields);
|
const std::vector<std::string> &fields);
|
||||||
void makeGate1300(std::vector<const Gate> &gates,
|
void makeGate1300(std::vector<Gate> &gates,
|
||||||
const std::vector<std::string> &fields);
|
const std::vector<std::string> &fields);
|
||||||
} // namespace simdata
|
} // namespace simdata
|
||||||
} // namespace file
|
} // namespace file
|
||||||
|
|||||||
@ -96,11 +96,11 @@ namespace file
|
|||||||
write<std::uint16_t>(out, airports.size());
|
write<std::uint16_t>(out, airports.size());
|
||||||
// Airport
|
// Airport
|
||||||
for (const std::pair<const std::string,
|
for (const std::pair<const std::string,
|
||||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
&airport : airports) {
|
&airport : airports) {
|
||||||
std::string icao = airport.first;
|
std::string icao = airport.first;
|
||||||
const std::vector<const Gate> gates = airport.second.first;
|
const std::vector<Gate> gates = airport.second.first;
|
||||||
const std::vector<const Runway> runways = airport.second.second;
|
const std::vector<Runway> runways = airport.second.second;
|
||||||
// ICAO
|
// ICAO
|
||||||
writeString(out, icao);
|
writeString(out, icao);
|
||||||
// Gates
|
// Gates
|
||||||
|
|||||||
@ -10,8 +10,7 @@ namespace file
|
|||||||
const std::string defaultFile,
|
const std::string defaultFile,
|
||||||
const std::string sceneryPack,
|
const std::string sceneryPack,
|
||||||
const std::string logFile,
|
const std::string logFile,
|
||||||
std::map<std::string,
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
|
||||||
&airports)
|
&airports)
|
||||||
{
|
{
|
||||||
std::ifstream base(defaultFile);
|
std::ifstream base(defaultFile);
|
||||||
@ -72,15 +71,14 @@ namespace file
|
|||||||
void makeAirport(
|
void makeAirport(
|
||||||
const std::string &kind,
|
const std::string &kind,
|
||||||
std::ifstream &infile,
|
std::ifstream &infile,
|
||||||
std::map<std::string,
|
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
|
||||||
std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
|
||||||
&airports,
|
&airports,
|
||||||
std::ofstream &logfile)
|
std::ofstream &logfile)
|
||||||
{
|
{
|
||||||
std::string line;
|
std::string line;
|
||||||
std::string *currentIcao = nullptr;
|
std::string *currentIcao = nullptr;
|
||||||
std::vector<const Gate> tmpGates;
|
std::vector<Gate> tmpGates;
|
||||||
std::vector<const Runway> tmpRunways;
|
std::vector<Runway> tmpRunways;
|
||||||
|
|
||||||
int apCount = 0;
|
int apCount = 0;
|
||||||
int validCount = 0;
|
int validCount = 0;
|
||||||
@ -106,8 +104,8 @@ namespace file
|
|||||||
logfile << "\t<STATUS> " << *currentIcao
|
logfile << "\t<STATUS> " << *currentIcao
|
||||||
<< " had no gates or runways" << std::endl;
|
<< " had no gates or runways" << std::endl;
|
||||||
}
|
}
|
||||||
tmpGates = std::vector<const Gate>();
|
tmpGates = std::vector<Gate>();
|
||||||
tmpRunways = std::vector<const Runway>();
|
tmpRunways = std::vector<Runway>();
|
||||||
currentIcao = new std::string(fields[4]);
|
currentIcao = new std::string(fields[4]);
|
||||||
apCount += 1;
|
apCount += 1;
|
||||||
logfile << "\t<" << kind << "> " << line << std::endl;
|
logfile << "\t<" << kind << "> " << line << std::endl;
|
||||||
@ -126,8 +124,8 @@ namespace file
|
|||||||
logfile << "\t<STATUS> " << *currentIcao
|
logfile << "\t<STATUS> " << *currentIcao
|
||||||
<< " had no gates or runways" << std::endl;
|
<< " had no gates or runways" << std::endl;
|
||||||
}
|
}
|
||||||
tmpGates = std::vector<const Gate>();
|
tmpGates = std::vector<Gate>();
|
||||||
tmpRunways = std::vector<const Runway>();
|
tmpRunways = std::vector<Runway>();
|
||||||
currentIcao = nullptr;
|
currentIcao = nullptr;
|
||||||
logfile << "\t<" << kind << " SKIPPED> " << line << std::endl;
|
logfile << "\t<" << kind << " SKIPPED> " << line << std::endl;
|
||||||
} else if (currentIcao != nullptr && fields[0] == "100") {
|
} else if (currentIcao != nullptr && fields[0] == "100") {
|
||||||
@ -148,7 +146,7 @@ namespace file
|
|||||||
<< validCount << " are valid" << std::endl;
|
<< validCount << " are valid" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeGate15(std::vector<const Gate> &gates,
|
void makeGate15(std::vector<Gate> &gates,
|
||||||
const std::vector<std::string> &fields)
|
const std::vector<std::string> &fields)
|
||||||
{
|
{
|
||||||
std::string gateName;
|
std::string gateName;
|
||||||
@ -163,7 +161,7 @@ namespace file
|
|||||||
gates.emplace_back(gateName, pt, 40);
|
gates.emplace_back(gateName, pt, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeRunway(std::vector<const Runway> &runways,
|
void makeRunway(std::vector<Runway> &runways,
|
||||||
const std::vector<std::string> &fields)
|
const std::vector<std::string> &fields)
|
||||||
{
|
{
|
||||||
runways.emplace_back(fields[8],
|
runways.emplace_back(fields[8],
|
||||||
@ -180,7 +178,7 @@ namespace file
|
|||||||
std::stod(fields[1]));
|
std::stod(fields[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeGate1300(std::vector<const Gate> &gates,
|
void makeGate1300(std::vector<Gate> &gates,
|
||||||
const std::vector<std::string> &fields)
|
const std::vector<std::string> &fields)
|
||||||
{
|
{
|
||||||
std::string gateName;
|
std::string gateName;
|
||||||
|
|||||||
@ -114,17 +114,12 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
|
|||||||
configuration = std::make_unique<germanairlinesva::file::config::Config>();
|
configuration = std::make_unique<germanairlinesva::file::config::Config>();
|
||||||
toLog("Config loaded");
|
toLog("Config loaded");
|
||||||
|
|
||||||
try {
|
connector = std::make_unique<germanairlinesva_websocket::Websocket>(
|
||||||
connector = std::make_unique<germanairlinesva_websocket::Websocket>(
|
"wss://ws.hofmannnet.myhome-server.de:8000",
|
||||||
"ss://ws.hofmannnet.myhome-server.de:8000",
|
configuration->getUser(),
|
||||||
configuration->getUser(),
|
toLog);
|
||||||
toLog);
|
|
||||||
} catch (const std::invalid_argument &e) {
|
|
||||||
toLog("SOCK");
|
|
||||||
toLog(e.what());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
toLog("WebSocket started");
|
toLog("WebSocket started");
|
||||||
|
|
||||||
char hash[2 * MD5LEN + 1] = "";
|
char hash[2 * MD5LEN + 1] = "";
|
||||||
if (germanairlinesva::util::generateMD5(XPLANE_CUSTOM_SCENERY, hash, toLog) ==
|
if (germanairlinesva::util::generateMD5(XPLANE_CUSTOM_SCENERY, hash, toLog) ==
|
||||||
0) {
|
0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user