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