Start on Logbook

This commit is contained in:
2022-09-08 02:02:09 +02:00
parent 2bda541bce
commit 8b9f5d0406
15 changed files with 453 additions and 226 deletions
+6 -6
View File
@@ -19,11 +19,11 @@ namespace germanairlinesva_simdata
static_cast<std::uint8_t>(this->designator.length()),
sizeof(std::uint8_t));
bufPtr++;
memcpy(bufPtr, this->designator.c_str(), this->designator.length());
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
bufPtr += this->designator.length() + 1;
memcpy(bufPtr, &this->center, sizeof(this->center));
std::memcpy(bufPtr, &this->center, sizeof(this->center));
bufPtr += sizeof(this->center);
memcpy(bufPtr, &this->radius, sizeof(this->radius));
std::memcpy(bufPtr, &this->radius, sizeof(this->radius));
}
// From database
@@ -43,10 +43,10 @@ namespace germanairlinesva_simdata
static_cast<std::uint8_t>(this->designator.length()),
sizeof(std::uint8_t));
bufPtr++;
memcpy(bufPtr, this->designator.c_str(), this->designator.length());
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
bufPtr += this->designator.length() + 1;
memcpy(bufPtr, &this->center, sizeof(this->center));
std::memcpy(bufPtr, &this->center, sizeof(this->center));
bufPtr += sizeof(this->center);
memcpy(bufPtr, &this->radius, sizeof(this->radius));
std::memcpy(bufPtr, &this->radius, sizeof(this->radius));
}
} // namespace germanairlinesva_simdata
+2 -4
View File
@@ -12,8 +12,6 @@
#include "gate.h"
#include "runway.h"
#define CURRENT_VERSION 1
/*
* Header
*
@@ -41,8 +39,8 @@ namespace germanairlinesva_simdata
std::uint8_t null = 0;
std::ofstream out(file, std::fstream::binary);
// File Header
std::uint8_t header[] = {'V', 'G', 'A', 'S', 0, CURRENT_VERSION};
// 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
std::uint16_t numAirports = airports.size();
+10 -10
View File
@@ -35,15 +35,15 @@ namespace germanairlinesva_simdata
static_cast<std::uint8_t>(this->designator.length()),
sizeof(std::uint8_t));
bufPtr++;
memcpy(bufPtr, this->designator.c_str(), this->designator.length());
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
bufPtr += this->designator.length() + 1;
memcpy(bufPtr, &this->bounds, sizeof(this->bounds));
std::memcpy(bufPtr, &this->bounds, sizeof(this->bounds));
bufPtr += sizeof(this->bounds);
memcpy(bufPtr, &this->width, sizeof(this->width));
std::memcpy(bufPtr, &this->width, sizeof(this->width));
bufPtr += sizeof(this->width);
memcpy(bufPtr, &this->length, sizeof(this->length));
std::memcpy(bufPtr, &this->length, sizeof(this->length));
bufPtr += sizeof(this->length);
memcpy(bufPtr, &this->trueHeading, sizeof(this->trueHeading));
std::memcpy(bufPtr, &this->trueHeading, sizeof(this->trueHeading));
}
Runway::Runway(std::string designator,
@@ -68,14 +68,14 @@ namespace germanairlinesva_simdata
static_cast<std::uint8_t>(this->designator.length()),
sizeof(std::uint8_t));
bufPtr++;
memcpy(bufPtr, this->designator.c_str(), this->designator.length());
std::memcpy(bufPtr, this->designator.c_str(), this->designator.length());
bufPtr += this->designator.length() + 1;
memcpy(bufPtr, &this->bounds, sizeof(this->bounds));
std::memcpy(bufPtr, &this->bounds, sizeof(this->bounds));
bufPtr += sizeof(this->bounds);
memcpy(bufPtr, &this->width, sizeof(this->width));
std::memcpy(bufPtr, &this->width, sizeof(this->width));
bufPtr += sizeof(this->width);
memcpy(bufPtr, &this->length, sizeof(this->length));
std::memcpy(bufPtr, &this->length, sizeof(this->length));
bufPtr += sizeof(this->length);
memcpy(bufPtr, &this->trueHeading, sizeof(this->trueHeading));
std::memcpy(bufPtr, &this->trueHeading, sizeof(this->trueHeading));
}
} // namespace germanairlinesva_simdata