Fix merge errors

This commit is contained in:
2022-09-11 21:34:26 +02:00
parent 6027095c38
commit de8b282ab1
3 changed files with 86 additions and 28 deletions
+15 -9
View File
@@ -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);
+20 -15
View File
@@ -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;
}