Maintenance: runways
whitespace formatting. increase buf size convert atoi() to stoi()
This commit is contained in:
parent
4a2cbc7389
commit
eb708eb5fe
1 changed files with 112 additions and 116 deletions
|
@ -25,9 +25,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <cstdio> // sprintf()
|
#include <cstdio> // sprintf()
|
||||||
#include <cstdlib> // atoi()
|
#include <cstdlib> // atoi()
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@
|
||||||
#include "runways.hxx"
|
#include "runways.hxx"
|
||||||
|
|
||||||
#include <Airports/airport.hxx>
|
#include <Airports/airport.hxx>
|
||||||
#include <Navaids/procedure.hxx>
|
|
||||||
#include <Navaids/navrecord.hxx>
|
|
||||||
#include <Navaids/NavDataCache.hxx>
|
#include <Navaids/NavDataCache.hxx>
|
||||||
|
#include <Navaids/navrecord.hxx>
|
||||||
|
#include <Navaids/procedure.hxx>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
@ -51,8 +51,7 @@ FGRunway::FGRunway(PositionedID aGuid,
|
||||||
const double width,
|
const double width,
|
||||||
const double displ_thresh,
|
const double displ_thresh,
|
||||||
const double stopway,
|
const double stopway,
|
||||||
const int surface_code) :
|
const int surface_code) : FGRunwayBase(aGuid, RUNWAY, aIdent, aGeod,
|
||||||
FGRunwayBase(aGuid, RUNWAY, aIdent, aGeod,
|
|
||||||
heading, length, width, surface_code),
|
heading, length, width, surface_code),
|
||||||
_airport(aAirport),
|
_airport(aAirport),
|
||||||
_reciprocal(0),
|
_reciprocal(0),
|
||||||
|
@ -71,14 +70,15 @@ string FGRunway::reverseIdent(const string& aRunwayIdent)
|
||||||
|
|
||||||
std::string ident(aRunwayIdent);
|
std::string ident(aRunwayIdent);
|
||||||
|
|
||||||
char buf[4];
|
int rn = std::stoi(ident.substr(0, 2));
|
||||||
int rn = atoi(ident.substr(0,2).c_str());
|
|
||||||
rn += 18;
|
rn += 18;
|
||||||
while (rn > 36) {
|
while (rn > 36) {
|
||||||
rn -= 36;
|
rn -= 36;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%02i", rn);
|
char buf[16];
|
||||||
|
snprintf(buf, sizeof(buf) - 1, "%02i", rn);
|
||||||
|
|
||||||
if (ident.size() == 3) {
|
if (ident.size() == 3) {
|
||||||
char suffix = toupper(ident[2]);
|
char suffix = toupper(ident[2]);
|
||||||
if (suffix == 'L') {
|
if (suffix == 'L') {
|
||||||
|
@ -193,12 +193,9 @@ FGRunway::getApproaches(flightgear::ProcedureType type) const
|
||||||
{
|
{
|
||||||
FGAirport* apt = airport();
|
FGAirport* apt = airport();
|
||||||
flightgear::ApproachList result;
|
flightgear::ApproachList result;
|
||||||
for (unsigned int i=0; i<apt->numApproaches(); ++i)
|
for (unsigned int i = 0; i < apt->numApproaches(); ++i) {
|
||||||
{
|
|
||||||
flightgear::Approach* s = apt->getApproachByIndex(i);
|
flightgear::Approach* s = apt->getApproachByIndex(i);
|
||||||
if( s->runway() == this
|
if (s->runway() == this && (type == flightgear::PROCEDURE_INVALID || type == s->type())) {
|
||||||
&& (type == flightgear::PROCEDURE_INVALID || type == s->type()) )
|
|
||||||
{
|
|
||||||
result.push_back(s);
|
result.push_back(s);
|
||||||
}
|
}
|
||||||
} // of approaches at the airport iteration
|
} // of approaches at the airport iteration
|
||||||
|
@ -221,8 +218,7 @@ FGHelipad::FGHelipad(PositionedID aGuid,
|
||||||
const SGGeod& aGeod,
|
const SGGeod& aGeod,
|
||||||
const double heading, const double length,
|
const double heading, const double length,
|
||||||
const double width,
|
const double width,
|
||||||
const int surface_code) :
|
const int surface_code) : FGRunwayBase(aGuid, HELIPAD, aIdent, aGeod,
|
||||||
FGRunwayBase(aGuid, HELIPAD, aIdent, aGeod,
|
|
||||||
heading, length, width, surface_code)
|
heading, length, width, surface_code)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue