X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fawynet.cxx;h=b2865b4e1066389fd977f6051002e8fbfa8ab5a5;hb=e171f0ecdbbdac03d35a2dd022b14a98989c3984;hp=5a76a521caae93df1b0974ef66151b02bd453dcd;hpb=10ebe0628568e0377f2a6fd6c8c1926d53280c92;p=flightgear.git diff --git a/src/Navaids/awynet.cxx b/src/Navaids/awynet.cxx index 5a76a521c..b2865b4e1 100755 --- a/src/Navaids/awynet.cxx +++ b/src/Navaids/awynet.cxx @@ -23,34 +23,22 @@ # include #endif -#ifdef _MSC_VER -# define _USE_MATH_DEFINES -#endif #include #include +#include #include -//#include -//#include - -//#include -//#include -//#include -//#include -//#include #include #include #include -//#include
-//#include
-//#include - -//#include STL_STRING #include "awynet.hxx" -SG_USING_STD(sort); +using std::sort; + +using std::cerr; +using std::endl; /************************************************************************** * FGNode @@ -157,6 +145,12 @@ FGAirwayNetwork::FGAirwayNetwork() maxDistance = 0; } +FGAirwayNetwork::~FGAirwayNetwork() +{ + for (unsigned int it = 0; it < nodes.size(); it++) { + delete nodes[ it]; + } +} void FGAirwayNetwork::addAirway(const FGAirway &seg) { segments.push_back(seg); @@ -220,14 +214,7 @@ void FGAirwayNetwork::load(SGPath path) in >> skipeol; // read in each remaining line of the file - -#ifdef __MWERKS__ - char c = 0; - while ( in.get(c) && c != '\0' ) { - in.putback(c); -#else while ( ! in.eof() ) { -#endif string token; in >> token; @@ -237,6 +224,7 @@ void FGAirwayNetwork::load(SGPath path) // Read each line from the database identStart = token; in >> latStart >> lonStart >> identEnd >> latEnd >> lonEnd >> type >> base >> top >> name; + in >> skipeol; /*out << identStart << " " << latStart << " " << lonStart << " " @@ -278,7 +266,8 @@ void FGAirwayNetwork::load(SGPath path) char buffer[32]; string startNode, endNode; // Start - snprintf(buffer, 32, "%s%d%d", identStart.c_str(), (int) latStart, (int) lonStart); + buffer[sizeof(buffer)-1] = 0; + snprintf(buffer, sizeof(buffer)-1, "%s%d%d", identStart.c_str(), (int) latStart, (int) lonStart); startNode = buffer; node_map_iterator itr = nodesMap.find(string(buffer));