diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fd7341f2..2c464cbda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ option(ENABLE_LARCSIM "Set to ON to build FlightGear with LaRCsim FDM" ON) option(ENABLE_YASIM "Set to ON to build FlightGear with YASIM FDM" ON) option(ENABLE_JSBSIM "Set to ON to build FlightGear with JSBSim FDM" ON) option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" OFF) -option(MSVC_3RDPARTY_DIR "Location where the third-party dependencies are extracted" NOT_FOUND) +set(MSVC_3RDPARTY_DIR NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") if(LOGGING) # nothing @@ -76,8 +76,8 @@ endif(EVENT_INPUT) if (MSVC_3RDPARTY_DIR) message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_DIR}") - set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/lib ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/lib ) - set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/include ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/include) + set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/lib ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/lib ${MSVC_3RDPARTY_DIR}/install/msvc90/SimGear/lib ) + set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/include ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/include ${MSVC_3RDPARTY_DIR}/install/msvc90/SimGear/include) set (BOOST_ROOT ${MSVC_3RDPARTY_DIR}/boost_1_44_0) set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/include) set (ALUT_INCLUDE_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/include) @@ -86,17 +86,7 @@ endif (MSVC_3RDPARTY_DIR) # check required dependencies -if (MSVC) - # on MSVC, Olaf reports that the serialization library is required at - # link time. No one has you explained why, unfortunately. - set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) - set(Boost_USE_STATIC_RUNTIME OFF) - find_package(Boost REQUIRED COMPONENTS serialization) -else (MSVC) - find_package(Boost REQUIRED) -endif (MSVC) - +find_package(Boost REQUIRED) find_package(ZLIB REQUIRED) find_package(Threads REQUIRED) find_package(OpenGL REQUIRED) diff --git a/CMakeModules/FindSimGear.cmake b/CMakeModules/FindSimGear.cmake index d6a4b7ba9..71ce82e09 100644 --- a/CMakeModules/FindSimGear.cmake +++ b/CMakeModules/FindSimGear.cmake @@ -134,7 +134,7 @@ SET(CMAKE_REQUIRED_INCLUDES ${SIMGEAR_INCLUDE_DIR}) check_cxx_source_runs( "#include - #include + #include \"simgear/version.h\" #define xstr(s) str(s) #define str(s) #s diff --git a/configure.ac b/configure.ac index 5f0dae1a8..c4ee12d68 100644 --- a/configure.ac +++ b/configure.ac @@ -530,7 +530,7 @@ if test "x$ac_cv_header_simgear_version_h" != "xyes"; then exit fi -AC_MSG_CHECKING([for SimGear 2.0.0 or newer]) +AC_MSG_CHECKING([for SimGear 2.2.0 or newer]) AC_TRY_RUN([ #include @@ -540,7 +540,7 @@ AC_TRY_RUN([ #define XSTRINGIFY(X) #X #define MIN_MAJOR 2 -#define MIN_MINOR 0 +#define MIN_MINOR 2 #define MIN_MICRO 0 int main() { @@ -837,6 +837,7 @@ AC_CONFIG_FILES([ \ scripts/debug/Makefile \ scripts/perl/Makefile \ scripts/perl/examples/Makefile \ + scripts/perl/traffic/Makefile \ scripts/python/Makefile \ src/Makefile \ src/Include/Makefile \ diff --git a/scripts/perl/Makefile.am b/scripts/perl/Makefile.am index aee2d7baa..9538e129c 100644 --- a/scripts/perl/Makefile.am +++ b/scripts/perl/Makefile.am @@ -1 +1,2 @@ -SUBDIRS = examples +SUBDIRS = examples \ + traffic diff --git a/scripts/perl/traffic/Makefile.am b/scripts/perl/traffic/Makefile.am new file mode 100644 index 000000000..b14050c96 --- /dev/null +++ b/scripts/perl/traffic/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = \ + conf2xml.pl \ + xml2conf.pl diff --git a/scripts/perl/traffic/conf2xml.pl b/scripts/perl/traffic/conf2xml.pl new file mode 100755 index 000000000..0305ebd11 --- /dev/null +++ b/scripts/perl/traffic/conf2xml.pl @@ -0,0 +1,117 @@ +#!/usr/bin/perl -w + +sub parseTime { + # print "Parsing time @_\n"; + #die; + my $timeStr = $_[0]; + @timeArray = split(":", $timeStr); + # print STDERR "TimeArray: @timeArray\n"; + return ($timeArray[0] + $timeArray[1]/60.0); +} + + sub writeFlight { + print XMLFILE " \n"; + print XMLFILE " $_[0]\n"; + print XMLFILE " $_[1]\n"; + print XMLFILE " $_[2]\n"; + print XMLFILE " \n"; + print XMLFILE " $_[3]\n"; + if ($_[4] =~ /[0-6]/) { print XMLFILE " \n" } + else { print XMLFILE " \n" }; + print XMLFILE " \n"; + print XMLFILE " $_[6]\n"; + print XMLFILE " \n"; + print XMLFILE " $_[7]\n"; + if ($_[8] =~ /[0-6]/) { print XMLFILE " \n" } + else { print XMLFILE " \n" }; + print XMLFILE " \n"; + if (($_[4] =~ /[0-6]/) && ($_[8] =~ /[0-6]/)) { print XMLFILE " WEEK\n" } + else { print XMLFILE " 24Hr\n" }; + print XMLFILE " \n"; + return; +} + +@inputfiles = glob("???.conf"); +while ($infile = shift(@inputfiles)) { + open (CONF, $infile) or die "Unable to open input configuration file"; + ($outname = $infile) =~ s/conf/xml/; + print "Opening $outname\n"; + open XMLFILE, ">$outname"; + while ($buf = readline(CONF)) { + push @DataList, $buf; + } + close (CONF); + print XMLFILE "\n"; + print XMLFILE "\n"; + while ($dataline = shift(@DataList)) { + # print STDERR "Dataline: $dataline\n"; + @token = split(" ", $dataline); + if (scalar(@token) > 0) { + # print STDERR "Token: @token\n"; + if ($token[0] eq "AC") + { + print XMLFILE " \n"; + print XMLFILE " $token[12]\n"; + print XMLFILE " $token[6]\n"; + print XMLFILE " $token[5]\n"; + print XMLFILE " $token[1]\n"; + print XMLFILE " $token[3]$token[5]\n"; + print XMLFILE " $token[4]\n"; + print XMLFILE " $token[7]\n"; + print XMLFILE " $token[8]\n"; + print XMLFILE " $token[9]\n"; + print XMLFILE " $token[10]\n"; + print XMLFILE " $token[2]\n"; + print XMLFILE " $token[11]\n"; + print XMLFILE " \n"; + } + if ($token[0] eq "FLIGHT") { + $weekdays = $token[3]; + if (!(($weekdays =~ /^(0|\.)?(1|\.)?(2|\.)?(3|\.)?(4|\.)?(5|\.)?(6|\.)?$/) || ($weekdays eq "DAILY"))) { + die "Syntax Error! Check days $weekdays for flight no. $token[1]!\n"; + } + if ($token[4] !~ /^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])$/) { + die "Syntax Error! Check departure time $token[4] for flight no. $token[1]!\n" + } + if ($token[6] !~ /^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])$/) { + die "Syntax Error! Check arrival time $token[6] for flight no. $token[1]!\n" + } + # print STDERR "Weekdays: $weekdays\n"; + if ($weekdays =~ /^(0|\.)?(1|\.)?(2|\.)?(3|\.)?(4|\.)?(5|\.)?(6|\.)?$/) { + # print STDERR "Weekly for flight no. $token[1]\n"; + # print STDERR "Day: $_\n"; + @day = split(//, $weekdays); + foreach (@day) { + if ($_ eq "\.") { + next; + } else { + $depTime = parseTime($token[4]); + # print STDERR "depTime: $depTime\n"; + $arrTime = parseTime($token[6]); + # print STDERR "arrTime: $arrTime\n"; + $depDay = $_ + 1; + if ($depDay > 6) { $depDay = 0 }; + $arrDay = $depDay; + if ($depTime > $arrTime) { $arrDay++ }; + if ($arrDay > 6) { $arrDay = 0 }; + # print STDERR "depDay: $depDay, arrDay: $arrDay\n"; + writeFlight ($token[1], $token[9], $token[2], $token[5], $depDay, $token[4], $token[8], $token[7], $arrDay, $token[6]); + } + } + } + elsif ($weekdays eq "DAILY") { + # print STDERR "Daily flights for flight no. $token[1]\n"; + $depTime = parseTime($token[4]); + $arrTime = parseTime($token[6]); + writeFlight ($token[1], $token[9], $token[2], $token[5], 7, $token[4], $token[8], $token[7], 7, $token[6]); + } + else { + die "System Error! Can't find days to place a flight!\n"; + } + } + } + } + print XMLFILE "\n"; + close XMLFILE; +# print "Closing $outname\n"; +} diff --git a/scripts/perl/traffic/xml2conf.pl b/scripts/perl/traffic/xml2conf.pl new file mode 100755 index 000000000..f4f462070 --- /dev/null +++ b/scripts/perl/traffic/xml2conf.pl @@ -0,0 +1,99 @@ +#!/usr/bin/perl -w + +#use strict; +#use warnings; + +# DEBUG +# use Data::Dumper; +# print Dumper($data) . "\n"; +# END + +if (scalar (@ARGV) == 1) { + @files = glob("$ARGV[0]"); + print "Processing : ", @files, "\n"; +} else { + die "Usage : conf2xml.pl [ > outputfile ]\n"; +} +$file = shift(@files); + +use Switch; +use XML::LibXML; +my $parser = XML::LibXML->new(); +my $doc = $parser->load_xml(location => $file); +my $data; + +# reformatting days +# According to http://wiki.flightgear.org/index.php/Interactive_Traffic +# 0 = Sunday and 6 = saturday +# For convenience we switch here to "classical" numbering +# where 0 = Monday and 6 = sunday +sub parseDay { + my $day; + $day = substr($_[0],0,1); + switch ($day) { + case 0 {$day="......6"} # Sunday + case 1 {$day="0......"} # Monday + case 2 {$day=".1....."} # Tuesday + case 3 {$day="..2...."} # Wednesday + case 4 {$day="...3..."} # Thrusday + case 5 {$day="....4.."} # Friday + case 6 {$day=".....5."} # Saturday + else {$day="0123456"} # Daily + }; + return $day; +} + +# reformatting times +sub parseTime { + return substr($_[0],2,5); +} + +print "# AC Homeport Registration RequiredAC AcTyp Airline Livery Offset Radius Flighttype PerfClass Heavy Model\n"; +# get aircraft data +foreach $data ($doc->findnodes('/trafficlist/aircraft')) { + my $AcMdl = $data->findnodes('./model'); + my $AcLvy = $data->findnodes('./livery'); + my $AcAln = $data->findnodes('./airline'); + my $AcHp = $data->findnodes('./home-port'); + my $AcReq = $data->findnodes('./required-aircraft'); + my $AcTyp = $data->findnodes('./actype'); + my $AcO = $data->findnodes('./offset'); + my $AcRad = $data->findnodes('./radius'); + my $AcFt = $data->findnodes('./flighttype'); + my $AcPrf = $data->findnodes('./performance-class'); + my $AcReg = $data->findnodes('./registration'); + my $AcHvy = $data->findnodes('./heavy'); + print "AC $AcHp $AcReg $AcReq $AcTyp $AcAln $AcLvy $AcO $AcRad $AcFt $AcPrf $AcHvy $AcMdl\n"; +} +print "\n# FLIGHT Callsign Flightrule Days DeparTime DepartPort ArrivalTime ArrivalPort Altitude RequiredAc\n# 0 = Monday, 6 = Sunday\n"; +# get flight data +foreach $data ($doc->findnodes('/trafficlist/flight')) { + my $FlRep = $data->findnodes('repeat'); + my $FlDepPrt = $data->findnodes('departure/port'); + my $FlArrPrt = $data->findnodes('arrival/port'); + my $FlCs = $data->findnodes('callsign'); + my $FlFr = $data->findnodes('fltrules'); + my $FlCa = $data->findnodes('cruise-alt'); + my $FlReq = $data->findnodes('required-aircraft'); + my $FlDepDay = $data->findnodes('departure/time'); + my $FlDepTime = $data->findnodes('departure/time'); + my $FlArrDay = $data->findnodes('arrival/time'); + my $FlArrTime = $data->findnodes('arrival/time'); + my $FlDays = "......."; +# handle flights depending on weekly or daily schedule + if (lc($FlRep) eq "week") { + $FlDays = parseDay($FlDepTime); + $FlDepTime = parseTime($FlDepTime); + $FlArrTime = parseTime($FlArrTime); + } elsif (lc($FlRep) eq "24hr") { + $FlDepDay = $data->findnodes('departure/time'); + $FlDepTime = substr($data->findnodes('departure/time'),0,5); + $FlArrDay = $data->findnodes('arrival/time'); + $FlArrTime = substr($data->findnodes('arrival/time'),0,5); + $FlDays = "0123456"; + } else { + die "Error! No proper repetition found in XML!\n"; + } +# output data + print "FLIGHT $FlCs $FlFr $FlDays $FlDepTime $FlDepPrt $FlArrTime $FlArrPrt $FlCa $FlReq\n"; +} diff --git a/src/ATCDCL/atis.cxx b/src/ATCDCL/atis.cxx index 26e7674a8..dfc1381c6 100644 --- a/src/ATCDCL/atis.cxx +++ b/src/ATCDCL/atis.cxx @@ -216,9 +216,12 @@ int FGATIS::GenTransmission(const int regen, const int special) { using namespace lex; string BRK = ".\n"; + string PAUSE = " / "; double tstamp = atof(fgGetString("sim/time/elapsed-sec")); - int interval = ATIS ? ATIS_interval : 2*minute; // AWOS updated frequently + int interval = _type == ATIS ? + ATIS_interval // ATIS updated hourly + : 2*minute; // AWOS updated more frequently int sequence = current_commlist->GetAtisSequence(ident, tstamp, interval, special); if (!regen && sequence > LTRS) { @@ -320,6 +323,9 @@ int FGATIS::GenTransmission(const int regen, const int special) { transmission += " " + at + " " + ConvertNumToSpokenDigits(buf) + BRK; } +// Sounds better with a pause in there: + transmission += PAUSE; + int did_some(0); int did_ceiling(0); @@ -431,21 +437,24 @@ int FGATIS::GenTransmission(const int regen, const int special) { transmission += ConvertNumToSpokenDigits(buf) + BRK; if (_type == ATIS /* as opposed to AWOS */) { - const FGAirport* apt = fgFindAirportID(ident); - assert(apt); - string rwy_no = apt->getActiveRunwayForUsage()->ident(); + const FGAirport* apt = fgFindAirportID(ident); + if (apt) { + string rwy_no = apt->getActiveRunwayForUsage()->ident(); if(rwy_no != "NN") { transmission += Landing_and_departing_runway + " "; transmission += ConvertRwyNumToSpokenString(rwy_no) + BRK; +#ifdef ATIS_TEST if (msg_OK) { msg_time = cur_time; - //cout << "In atis.cxx, r.rwy_no: " << rwy_no - // << " wind_dir: " << wind_dir << endl; + cout << "In atis.cxx, r.rwy_no: " << rwy_no + << " wind_dir: " << wind_dir << endl; } +#endif + } } transmission += On_initial_contact_advise_you_have_information + " "; transmission += phonetic_seq_string; - transmission += "... " + BRK; + transmission += "... " + BRK + PAUSE + PAUSE; } #ifdef ATIS_TEST cout << "**** ATIS active on:"; @@ -474,7 +483,7 @@ int FGATIS::GenTransmission(const int regen, const int special) { for (size_t where;;) { where = transmission.find_first_of(":."); if (where == string::npos) break; - transmission.replace(where, 1, " /_ "); + transmission.replace(where, 1, PAUSE); } return 1; } diff --git a/src/ATCDCL/atis_lexicon.hxx b/src/ATCDCL/atis_lexicon.hxx index 2284f1f95..37c2a03df 100644 --- a/src/ATCDCL/atis_lexicon.hxx +++ b/src/ATCDCL/atis_lexicon.hxx @@ -34,9 +34,12 @@ Q(hundred) Q(zero) Q(Temperature) Q(clear) +Q(isolated) +Q(few) Q(scattered) Q(broken) Q(overcast) +Q(thin) Q(Sky_condition) Q(Ceiling) Q(minus) diff --git a/src/ATCDCL/atis_remap.hxx b/src/ATCDCL/atis_remap.hxx index f679b70b9..c2341a2f0 100644 --- a/src/ATCDCL/atis_remap.hxx +++ b/src/ATCDCL/atis_remap.hxx @@ -3,6 +3,7 @@ REMAP(Rgnl, Regional) REMAP(Co, County) REMAP(Muni, Municipal) REMAP(Mem, Memorial) +REMAP(Meml, Memorial) REMAP(Apt, Airport) REMAP(Arpt, Airport) REMAP(Fld, Field) diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index bdd73a11e..fd02ebe0b 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -1285,6 +1285,22 @@ void MapWidget::drawILS(bool tuned, FGRunway* rwy) glVertex2dv(endCentre.data()); glVertex2dv(endR.data()); glEnd(); + + if (validDataForKey(loc)) { + setAnchorForKey(loc, endR); + return; + } + + char buffer[1024]; + ::snprintf(buffer, 1024, "%s\n%s\n%3.2fMHz", + loc->name().c_str(), loc->ident().c_str(),loc->get_freq()/100.0); + + MapData* d = createDataForKey(loc); + d->setPriority(40); + d->setLabel(loc->ident()); + d->setText(buffer); + d->setOffset(MapData::HALIGN_CENTER | MapData::VALIGN_BOTTOM, 10); + d->setAnchor(endR); } void MapWidget::drawTraffic() diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 6eb4513c0..ffc87c857 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -39,7 +39,6 @@ target_link_libraries(fgfs ${ALUT_LIBRARY} ${ZLIB_LIBRARIES} ${PLIB_LIBRARIES} - ${RT_LIBRARY} - ${Boost_SERIALIZATION_LIBRARY}) + ${RT_LIBRARY}) install(TARGETS fgfs RUNTIME DESTINATION bin)