# include "config.h"
#endif
+#include "poidb.hxx"
+
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sgstream.hxx>
#include <Navaids/NavDataCache.hxx>
-#include "poidb.hxx"
+
using std::string;
}
}
-
-
namespace flightgear
{
-static PositionedID readPOIFromStream(std::istream& aStream,
+static PositionedID readPOIFromStream(std::istream& aStream, NavDataCache* cache,
FGPositioned::Type type = FGPositioned::INVALID)
{
- NavDataCache* cache = NavDataCache::instance();
+ if (aStream.eof()) {
+ return 0;
+ }
+ aStream >> skipws;
+ if (aStream.peek() == '#') {
+ aStream >> skipeol;
+ return 0;
+ }
+
int rawType;
aStream >> rawType;
- if (aStream.eof() || (rawType == '#')) {
- return 0;
- }
-
double lat, lon;
std::string name;
aStream >> lat >> lon;
return 0;
}
- PositionedID r = cache->createPOI(type, name, pos);
- return r;
+ return cache->createPOI(type, name, pos);
}
// load and initialize the POI database
return false;
}
- in >> skipcomment;
-
+ NavDataCache* cache = NavDataCache::instance();
while (!in.eof()) {
- readPOIFromStream(in);
- in >> skipcomment;
+ readPOIFromStream(in, cache);
} // of stream data loop
- return true;
+ return true;
}
} // of namespace flightgear