Merge branch 'next' into durk-atc
Merge with next. Conflicts: src/Airports/dynamics.cxx src/Airports/dynamics.hxx
This commit is contained in:
commit
348ff2ec23
12 changed files with 162 additions and 111 deletions
|
@ -224,6 +224,8 @@ include_directories(${PROJECT_BINARY_DIR}/src/Include)
|
||||||
|
|
||||||
add_definitions(-DHAVE_CONFIG_H)
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
|
check_function_exists(mkfifo HAVE_MKFIFO)
|
||||||
|
|
||||||
# configure a header file to pass some of the CMake settings
|
# configure a header file to pass some of the CMake settings
|
||||||
# to the source code
|
# to the source code
|
||||||
configure_file (
|
configure_file (
|
||||||
|
|
|
@ -528,7 +528,7 @@ void FGATCController::transmit(FGTrafficRecord * rec, AtcMsgId msgId,
|
||||||
getName() + "-Ground";
|
getName() + "-Ground";
|
||||||
atisInformation =
|
atisInformation =
|
||||||
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->
|
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->
|
||||||
getDynamics()->getAtisInformation();
|
getDynamics()->getAtisSequence();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
receiver =
|
receiver =
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Airports/runways.hxx>
|
#include <Airports/runways.hxx>
|
||||||
|
#include <Airports/dynamics.hxx>
|
||||||
|
|
||||||
|
|
||||||
#include "ATCutils.hxx"
|
#include "ATCutils.hxx"
|
||||||
|
@ -228,47 +229,6 @@ int Apt_US_CA(const string id) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add structure and map for storing a log of atis transmissions
|
|
||||||
// made in this session of FlightGear. This allows the callsign
|
|
||||||
// to be allocated correctly wrt time.
|
|
||||||
typedef struct {
|
|
||||||
double tstamp;
|
|
||||||
int sequence;
|
|
||||||
} atis_transmission_type;
|
|
||||||
|
|
||||||
typedef std::map < std::string, atis_transmission_type > atis_log_type;
|
|
||||||
typedef atis_log_type::iterator atis_log_iterator;
|
|
||||||
typedef atis_log_type::const_iterator atis_log_const_iterator;
|
|
||||||
|
|
||||||
static atis_log_type atislog;
|
|
||||||
|
|
||||||
int FGATIS::GetAtisSequence( const string& apt_id,
|
|
||||||
const double tstamp, const int interval, const int special)
|
|
||||||
{
|
|
||||||
atis_transmission_type tran;
|
|
||||||
|
|
||||||
if(atislog.find(apt_id) == atislog.end()) { // New station
|
|
||||||
tran.tstamp = tstamp - interval;
|
|
||||||
// Random number between 0 and 25 inclusive, i.e. 26 equiprobable outcomes:
|
|
||||||
tran.sequence = int(sg_random() * LTRS);
|
|
||||||
atislog[apt_id] = tran;
|
|
||||||
//cout << "New ATIS station: " << apt_id << " seq-1: "
|
|
||||||
// << tran.sequence << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate the appropriate identifier and update the log
|
|
||||||
tran = atislog[apt_id];
|
|
||||||
|
|
||||||
int delta = int((tstamp - tran.tstamp) / interval);
|
|
||||||
tran.tstamp += delta * interval;
|
|
||||||
if (special && !delta) delta++; // a "special" ATIS update is required
|
|
||||||
tran.sequence = (tran.sequence + delta) % LTRS;
|
|
||||||
atislog[apt_id] = tran;
|
|
||||||
//if (delta) cout << "New ATIS sequence: " << tran.sequence
|
|
||||||
// << " Delta: " << delta << endl;
|
|
||||||
return(tran.sequence + (delta ? 0 : LTRS*1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the actual broadcast ATIS transmission.
|
// Generate the actual broadcast ATIS transmission.
|
||||||
// Regen means regenerate the /current/ transmission.
|
// Regen means regenerate the /current/ transmission.
|
||||||
// Special means generate a new transmission, with a new sequence.
|
// Special means generate a new transmission, with a new sequence.
|
||||||
|
@ -280,12 +240,12 @@ int FGATIS::GenTransmission(const int regen, const int special) {
|
||||||
string BRK = ".\n";
|
string BRK = ".\n";
|
||||||
string PAUSE = " / ";
|
string PAUSE = " / ";
|
||||||
|
|
||||||
double tstamp = atof(fgGetString("sim/time/elapsed-sec"));
|
|
||||||
int interval = _type == ATIS ?
|
int interval = _type == ATIS ?
|
||||||
ATIS_interval // ATIS updated hourly
|
ATIS_interval // ATIS updated hourly
|
||||||
: 2*minute; // AWOS updated more frequently
|
: 2*minute; // AWOS updated more frequently
|
||||||
|
|
||||||
int sequence = GetAtisSequence(ident, tstamp, interval, special);
|
FGAirport* apt = FGAirport::findByIdent(ident);
|
||||||
|
int sequence = apt->getDynamics()->updateAtisSequence(interval, special);
|
||||||
if (!regen && sequence > LTRS) {
|
if (!regen && sequence > LTRS) {
|
||||||
//xx if (msg_OK) cout << "ATIS: no change: " << sequence << endl;
|
//xx if (msg_OK) cout << "ATIS: no change: " << sequence << endl;
|
||||||
//xx msg_time = cur_time;
|
//xx msg_time = cur_time;
|
||||||
|
|
|
@ -95,9 +95,7 @@ class FGATIS : public FGATC {
|
||||||
void TreeOut(int msgOK);
|
void TreeOut(int msgOK);
|
||||||
|
|
||||||
friend std::istream& operator>> ( std::istream&, FGATIS& );
|
friend std::istream& operator>> ( std::istream&, FGATIS& );
|
||||||
|
|
||||||
int GetAtisSequence( const std::string& apt_id,
|
|
||||||
const double tstamp, const int interval, const int special);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int (FGATIS::*int_getter)() const;
|
typedef int (FGATIS::*int_getter)() const;
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Airports/runways.hxx>
|
#include <Airports/runways.hxx>
|
||||||
|
#include <ATCDCL/ATCutils.hxx>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -49,33 +50,12 @@ using std::random_shuffle;
|
||||||
#include "dynamics.hxx"
|
#include "dynamics.hxx"
|
||||||
|
|
||||||
FGAirportDynamics::FGAirportDynamics(FGAirport * ap):
|
FGAirportDynamics::FGAirportDynamics(FGAirport * ap):
|
||||||
_ap(ap), rwyPrefs(ap), SIDs(ap),startupController(this)
|
_ap(ap), rwyPrefs(ap), SIDs(ap),
|
||||||
|
atisSequenceIndex(-1),
|
||||||
|
atisSequenceTimeStamp(0.0)
|
||||||
|
startupController(this);
|
||||||
{
|
{
|
||||||
lastUpdate = 0;
|
lastUpdate = 0;
|
||||||
|
|
||||||
// For testing only. This needs to be refined when we move ATIS functionality over.
|
|
||||||
atisInformation = "Sierra";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note that the ground network should also be copied
|
|
||||||
FGAirportDynamics::
|
|
||||||
FGAirportDynamics(const FGAirportDynamics & other):rwyPrefs(other.
|
|
||||||
rwyPrefs),
|
|
||||||
SIDs(other.SIDs), startupController(other.startupController)
|
|
||||||
{
|
|
||||||
for (FGParkingVecConstIterator ip = other.parkings.begin();
|
|
||||||
ip != other.parkings.end(); ip++)
|
|
||||||
parkings.push_back(*(ip));
|
|
||||||
// rwyPrefs = other.rwyPrefs;
|
|
||||||
lastUpdate = other.lastUpdate;
|
|
||||||
|
|
||||||
stringVecConstIterator il;
|
|
||||||
for (il = other.landing.begin(); il != other.landing.end(); il++)
|
|
||||||
landing.push_back(*il);
|
|
||||||
for (il = other.takeoff.begin(); il != other.takeoff.end(); il++)
|
|
||||||
takeoff.push_back(*il);
|
|
||||||
lastUpdate = other.lastUpdate;
|
|
||||||
atisInformation = other.atisInformation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
@ -567,3 +547,33 @@ FGAIFlightPlan *FGAirportDynamics::getSID(string activeRunway,
|
||||||
{
|
{
|
||||||
return SIDs.getBest(activeRunway, heading);
|
return SIDs.getBest(activeRunway, heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string FGAirportDynamics::getAtisSequence()
|
||||||
|
{
|
||||||
|
if (atisSequenceIndex == -1) {
|
||||||
|
updateAtisSequence(1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetPhoneticLetter(atisSequenceIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FGAirportDynamics::updateAtisSequence(int interval, bool forceUpdate)
|
||||||
|
{
|
||||||
|
double now = globals->get_sim_time_sec();
|
||||||
|
if (atisSequenceIndex == -1) {
|
||||||
|
// first computation
|
||||||
|
atisSequenceTimeStamp = now;
|
||||||
|
atisSequenceIndex = rand() % LTRS; // random initial sequence letters
|
||||||
|
return atisSequenceIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
int steps = static_cast<int>((now - atisSequenceTimeStamp) / interval);
|
||||||
|
atisSequenceTimeStamp += (interval * steps);
|
||||||
|
if (forceUpdate && (steps == 0)) {
|
||||||
|
++steps; // a "special" ATIS update is required
|
||||||
|
}
|
||||||
|
|
||||||
|
atisSequenceIndex = (atisSequenceIndex + steps) % LTRS;
|
||||||
|
// return a huge value if no update occurred
|
||||||
|
return (atisSequenceIndex + (steps ? 0 : LTRS*1000));
|
||||||
|
}
|
||||||
|
|
|
@ -22,24 +22,15 @@
|
||||||
#ifndef _AIRPORT_DYNAMICS_HXX_
|
#ifndef _AIRPORT_DYNAMICS_HXX_
|
||||||
#define _AIRPORT_DYNAMICS_HXX_
|
#define _AIRPORT_DYNAMICS_HXX_
|
||||||
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
# error This library requires C++
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <simgear/xml/easyxml.hxx>
|
|
||||||
|
|
||||||
#include <ATC/trafficcontrol.hxx>
|
#include <ATC/trafficcontrol.hxx>
|
||||||
#include "parking.hxx"
|
#include "parking.hxx"
|
||||||
#include "groundnetwork.hxx"
|
#include "groundnetwork.hxx"
|
||||||
#include "runwayprefs.hxx"
|
#include "runwayprefs.hxx"
|
||||||
#include "sidstar.hxx"
|
#include "sidstar.hxx"
|
||||||
|
|
||||||
//typedef vector<float> DoubleVec;
|
// forward decls
|
||||||
//typedef vector<float>::iterator DoubleVecIterator;
|
|
||||||
|
|
||||||
class FGAirport;
|
class FGAirport;
|
||||||
|
class FGEnvironment;
|
||||||
|
|
||||||
class FGAirportDynamics {
|
class FGAirportDynamics {
|
||||||
|
|
||||||
|
@ -55,7 +46,7 @@ private:
|
||||||
FGApproachController approachController;
|
FGApproachController approachController;
|
||||||
|
|
||||||
time_t lastUpdate;
|
time_t lastUpdate;
|
||||||
string prevTrafficType;
|
std::string prevTrafficType;
|
||||||
stringVec landing;
|
stringVec landing;
|
||||||
stringVec takeoff;
|
stringVec takeoff;
|
||||||
stringVec milActive, comActive, genActive, ulActive;
|
stringVec milActive, comActive, genActive, ulActive;
|
||||||
|
@ -67,6 +58,7 @@ private:
|
||||||
intVec freqTower; // </TOWER>
|
intVec freqTower; // </TOWER>
|
||||||
intVec freqApproach; // </APPROACH>
|
intVec freqApproach; // </APPROACH>
|
||||||
|
|
||||||
|
<<<<<<< HEAD:src/Airports/dynamics.hxx
|
||||||
string atisInformation;
|
string atisInformation;
|
||||||
|
|
||||||
string chooseRunwayFallback();
|
string chooseRunwayFallback();
|
||||||
|
@ -75,9 +67,16 @@ private:
|
||||||
|
|
||||||
double elevation;
|
double elevation;
|
||||||
|
|
||||||
|
=======
|
||||||
|
int atisSequenceIndex;
|
||||||
|
double atisSequenceTimeStamp;
|
||||||
|
|
||||||
|
std::string chooseRunwayFallback();
|
||||||
|
bool innerGetActiveRunway(const std::string &trafficType, int action, std::string &runway, double heading);
|
||||||
|
std::string chooseRwyByHeading(stringVec rwys, double heading);
|
||||||
|
>>>>>>> next:src/Airports/dynamics.hxx
|
||||||
public:
|
public:
|
||||||
FGAirportDynamics(FGAirport* ap);
|
FGAirportDynamics(FGAirport* ap);
|
||||||
FGAirportDynamics(const FGAirportDynamics &other);
|
|
||||||
~FGAirportDynamics();
|
~FGAirportDynamics();
|
||||||
|
|
||||||
void addAwosFreq (int val) { freqAwos.push_back(val); };
|
void addAwosFreq (int val) { freqAwos.push_back(val); };
|
||||||
|
@ -121,9 +120,15 @@ public:
|
||||||
FGTowerController *getTowerController() { return &towerController; };
|
FGTowerController *getTowerController() { return &towerController; };
|
||||||
FGApproachController *getApproachController() { return &approachController; };
|
FGApproachController *getApproachController() { return &approachController; };
|
||||||
|
|
||||||
const string& getAtisInformation() { return atisInformation; };
|
int getGroundFrequency(unsigned leg);
|
||||||
int getGroundFrequency (unsigned leg); //{ return freqGround.size() ? freqGround[0] : 0; };
|
|
||||||
int getTowerFrequency (unsigned nr);
|
int getTowerFrequency (unsigned nr);
|
||||||
|
|
||||||
|
/// get current ATIS sequence letter
|
||||||
|
const std::string getAtisSequence();
|
||||||
|
|
||||||
|
/// get the current ATIS sequence number, updating it if necessary
|
||||||
|
int updateAtisSequence(int interval, bool forceUpdate);
|
||||||
|
|
||||||
void setRwyUse(const FGRunwayPreference& ref);
|
void setRwyUse(const FGRunwayPreference& ref);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -96,20 +96,18 @@ bool FGAirport::isHeliport() const
|
||||||
|
|
||||||
FGAirportDynamics * FGAirport::getDynamics()
|
FGAirportDynamics * FGAirport::getDynamics()
|
||||||
{
|
{
|
||||||
if (_dynamics != 0) {
|
if (_dynamics) {
|
||||||
return _dynamics;
|
return _dynamics;
|
||||||
} else {
|
}
|
||||||
//cerr << "Trying to load dynamics for " << _id << endl;
|
|
||||||
_dynamics = new FGAirportDynamics(this);
|
_dynamics = new FGAirportDynamics(this);
|
||||||
XMLLoader::load(_dynamics);
|
XMLLoader::load(_dynamics);
|
||||||
|
|
||||||
FGRunwayPreference rwyPrefs(this);
|
FGRunwayPreference rwyPrefs(this);
|
||||||
XMLLoader::load(&rwyPrefs);
|
XMLLoader::load(&rwyPrefs);
|
||||||
_dynamics->setRwyUse(rwyPrefs);
|
_dynamics->setRwyUse(rwyPrefs);
|
||||||
|
XMLLoader::load(_dynamics->getSIDs());
|
||||||
//FGSidStar SIDs(this);
|
|
||||||
XMLLoader::load(_dynamics->getSIDs());
|
|
||||||
}
|
|
||||||
return _dynamics;
|
return _dynamics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#cmakedefine HAVE_SYS_TIME_H
|
#cmakedefine HAVE_SYS_TIME_H
|
||||||
#cmakedefine HAVE_WINDOWS_H
|
#cmakedefine HAVE_WINDOWS_H
|
||||||
#cmakedefine HAVE_CULLSETTINGS_CLEAR_MASK
|
#cmakedefine HAVE_CULLSETTINGS_CLEAR_MASK
|
||||||
|
#cmakedefine HAVE_MKFIFO
|
||||||
|
|
||||||
#define VERSION "@FLIGHTGEAR_VERSION@"
|
#define VERSION "@FLIGHTGEAR_VERSION@"
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
#include <Scripting/NasalSys.hxx>
|
#include <Scripting/NasalSys.hxx>
|
||||||
#include <Sound/sample_queue.hxx>
|
#include <Sound/sample_queue.hxx>
|
||||||
#include <Airports/xmlloader.hxx>
|
#include <Airports/xmlloader.hxx>
|
||||||
|
#include <ATC/CommStation.hxx>
|
||||||
|
#include <Navaids/navrecord.hxx>
|
||||||
|
#include <Navaids/navlist.hxx>
|
||||||
|
|
||||||
#include "fg_init.hxx"
|
#include "fg_init.hxx"
|
||||||
#include "fg_io.hxx"
|
#include "fg_io.hxx"
|
||||||
|
@ -1349,7 +1352,63 @@ do_release_cockpit_button (const SGPropertyNode *arg)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SGGeod commandSearchPos(const SGPropertyNode* arg)
|
||||||
|
{
|
||||||
|
if (arg->hasChild("longitude-deg") && arg->hasChild("latitude-deg")) {
|
||||||
|
return SGGeod::fromDeg(arg->getDoubleValue("longitude-deg"),
|
||||||
|
arg->getDoubleValue("latitude-deg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// use current viewer/aircraft position
|
||||||
|
return SGGeod::fromDeg(fgGetDouble("/position/longitude-deg"),
|
||||||
|
fgGetDouble("/position/latitude-deg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
do_comm_search(const SGPropertyNode* arg)
|
||||||
|
{
|
||||||
|
SGGeod pos = commandSearchPos(arg);
|
||||||
|
int khz = static_cast<int>(arg->getDoubleValue("frequency-mhz") * 100.0 + 0.25);
|
||||||
|
|
||||||
|
flightgear::CommStation* sta = flightgear::CommStation::findByFreq(khz, pos, NULL);
|
||||||
|
if (!sta) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SGPropertyNode* result = fgGetNode(arg->getStringValue("result"));
|
||||||
|
sta->createBinding(result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
do_nav_search(const SGPropertyNode* arg)
|
||||||
|
{
|
||||||
|
SGGeod pos = commandSearchPos(arg);
|
||||||
|
double mhz = arg->getDoubleValue("frequency-mhz");
|
||||||
|
|
||||||
|
FGNavList* navList = globals->get_navlist();
|
||||||
|
string type(arg->getStringValue("type", "vor"));
|
||||||
|
if (type == "dme") {
|
||||||
|
navList = globals->get_dmelist();
|
||||||
|
} else if (type == "tacan") {
|
||||||
|
navList = globals->get_tacanlist();
|
||||||
|
}
|
||||||
|
|
||||||
|
FGNavRecord* nav = navList->findByFreq(mhz, pos);
|
||||||
|
if (!nav && (type == "vor")) {
|
||||||
|
// if we're searching VORs, look for localizers too
|
||||||
|
nav = globals->get_loclist()->findByFreq(mhz, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nav) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SGPropertyNode* result = fgGetNode(arg->getStringValue("result"));
|
||||||
|
nav->createBinding(result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Command setup.
|
// Command setup.
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1421,6 +1480,10 @@ static struct {
|
||||||
{ "dump-terrainbranch", do_dump_terrain_branch },
|
{ "dump-terrainbranch", do_dump_terrain_branch },
|
||||||
{ "print-visible-scene", do_print_visible_scene_info },
|
{ "print-visible-scene", do_print_visible_scene_info },
|
||||||
{ "reload-shaders", do_reload_shaders },
|
{ "reload-shaders", do_reload_shaders },
|
||||||
|
|
||||||
|
{ "find-navaid", do_nav_search },
|
||||||
|
{ "find-comm", do_comm_search },
|
||||||
|
|
||||||
{ 0, 0 } // zero-terminated
|
{ 0, 0 } // zero-terminated
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -148,12 +148,27 @@ AirportBinding::AirportBinding(const FGAirport* apt, SGPropertyNode* nd) :
|
||||||
for (unsigned int c=0; c<apt->commStations().size(); ++c) {
|
for (unsigned int c=0; c<apt->commStations().size(); ++c) {
|
||||||
flightgear::CommStation* comm = apt->commStations()[c];
|
flightgear::CommStation* comm = apt->commStations()[c];
|
||||||
std::string tynm = FGPositioned::nameForType(comm->type());
|
std::string tynm = FGPositioned::nameForType(comm->type());
|
||||||
int count = nd->getChildren(tynm).size();
|
|
||||||
|
|
||||||
SGPropertyNode* commNode = nd->getChild(tynm, count, true);
|
// for some standard frequence types, we don't care about the ident,
|
||||||
commNode->setStringValue("ident", comm->ident());
|
// so just list the frequencies under one group.
|
||||||
commNode->setDoubleValue("frequency-mhz", comm->freqMHz());
|
if ((comm->type() == FGPositioned::FREQ_ATIS) ||
|
||||||
}
|
(comm->type() == FGPositioned::FREQ_AWOS) ||
|
||||||
|
(comm->type() == FGPositioned::FREQ_TOWER) ||
|
||||||
|
(comm->type() == FGPositioned::FREQ_GROUND))
|
||||||
|
{
|
||||||
|
SGPropertyNode* commNode = nd->getChild(tynm, 0, true);
|
||||||
|
int count = nd->getChildren("frequency-mhz").size();
|
||||||
|
SGPropertyNode* freqNode = commNode->getChild("frequency-mhz", count, true);
|
||||||
|
freqNode->setDoubleValue(comm->freqMHz());
|
||||||
|
} else {
|
||||||
|
// for other kinds of frequency, there's more variation, so list the ID too
|
||||||
|
int count = nd->getChildren(tynm).size();
|
||||||
|
SGPropertyNode* commNode = nd->getChild(tynm, count, true);
|
||||||
|
commNode->setStringValue("ident", comm->ident());
|
||||||
|
commNode->setDoubleValue("frequency-mhz", comm->freqMHz());
|
||||||
|
|
||||||
|
}
|
||||||
|
} // of airprot comm stations iteration
|
||||||
}
|
}
|
||||||
|
|
||||||
CommStationBinding::CommStationBinding(const CommStation* sta, SGPropertyNode* node) :
|
CommStationBinding::CommStationBinding(const CommStation* sta, SGPropertyNode* node) :
|
||||||
|
|
|
@ -841,7 +841,7 @@ FGPositioned::sortByRange(List& aResult, const SGGeod& aPos)
|
||||||
|
|
||||||
FGPositioned::Filter* createSearchFilter(const SGPropertyNode* arg)
|
FGPositioned::Filter* createSearchFilter(const SGPropertyNode* arg)
|
||||||
{
|
{
|
||||||
string sty(arg->getStringValue("type", 0));
|
string sty(arg->getStringValue("type", "any"));
|
||||||
FGPositioned::Type ty = FGPositioned::typeFromName(sty);
|
FGPositioned::Type ty = FGPositioned::typeFromName(sty);
|
||||||
double minRunwayLenFt = arg->getDoubleValue("min-runway-length-ft", -1.0);
|
double minRunwayLenFt = arg->getDoubleValue("min-runway-length-ft", -1.0);
|
||||||
|
|
||||||
|
@ -861,7 +861,7 @@ FGPositioned::Filter* createSearchFilter(const SGPropertyNode* arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGeod commandSearchPos(const SGPropertyNode* arg)
|
static SGGeod commandSearchPos(const SGPropertyNode* arg)
|
||||||
{
|
{
|
||||||
if (arg->hasChild("longitude-deg") && arg->hasChild("latitude-deg")) {
|
if (arg->hasChild("longitude-deg") && arg->hasChild("latitude-deg")) {
|
||||||
return SGGeod::fromDeg(arg->getDoubleValue("longitude-deg"),
|
return SGGeod::fromDeg(arg->getDoubleValue("longitude-deg"),
|
||||||
|
@ -932,7 +932,7 @@ bool commandFindByIdent(const SGPropertyNode* arg)
|
||||||
if (arg->hasChild("name")) {
|
if (arg->hasChild("name")) {
|
||||||
results = FGPositioned::findAllWithName(arg->getStringValue("name"), filt.get(), exact);
|
results = FGPositioned::findAllWithName(arg->getStringValue("name"), filt.get(), exact);
|
||||||
} else if (arg->hasChild("ident")) {
|
} else if (arg->hasChild("ident")) {
|
||||||
results = FGPositioned::findAllWithName(arg->getStringValue("ident"), filt.get(), exact);
|
results = FGPositioned::findAllWithIdent(arg->getStringValue("ident"), filt.get(), exact);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "commandFindByIdent: no search term defined");
|
SG_LOG(SG_GENERAL, SG_WARN, "commandFindByIdent: no search term defined");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -476,10 +476,9 @@ static naRef f_systime(naContext c, naRef me, int argc, naRef* args)
|
||||||
// Converts from 100ns units in 1601 epoch to unix epoch in sec
|
// Converts from 100ns units in 1601 epoch to unix epoch in sec
|
||||||
return naNum((t * 1e-7) - 11644473600.0);
|
return naNum((t * 1e-7) - 11644473600.0);
|
||||||
#else
|
#else
|
||||||
time_t t;
|
|
||||||
struct timeval td;
|
struct timeval td;
|
||||||
do { t = time(0); gettimeofday(&td, 0); } while(t != time(0));
|
gettimeofday(&td, 0);
|
||||||
return naNum(t + 1e-6 * td.tv_usec);
|
return naNum(td.tv_sec + 1e-6 * td.tv_usec);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue