#include <Viewer/viewmgr.hxx>
#include <Viewer/viewer.hxx>
#include <Environment/presets.hxx>
+#include <Navaids/NavDataCache.hxx>
#include "fg_init.hxx"
#include "fg_io.hxx"
root.append("Scenery");
globals->append_fg_scenery(root.str());
}
+
+ // might need to drop ground-nets from the DB. Also need to drop
+ // them from memory, but this is tricky since FGAirportDynamics holds
+ // an instance directly, and AI code may have pointers to ground-net
+ // nodes. For now we'll leave-in memory versions untouched.
+ flightgear::NavDataCache::instance()->dropGroundnetsIfRequired();
return true;
}
SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: main cache rebuild required");
return true;
}
-
- string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";");
- if (readStringProperty("scenery_paths") != sceneryPaths) {
- SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: scenery paths changed,dropping ground net");
- dropAllGroundnets();
- writeStringProperty("scenery_paths", sceneryPaths);
- }
+
+ dropGroundnetsIfRequired();
SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: no main cache rebuild required");
return false;
}
+
+bool NavDataCache::dropGroundnetsIfRequired()
+{
+ string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";");
+ if (readStringProperty("scenery_paths") != sceneryPaths) {
+ SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: scenery paths changed, dropping ground nets");
+ dropAllGroundnets();
+ writeStringProperty("scenery_paths", sceneryPaths);
+ return true;
+ }
+
+ return false;
+}
bool NavDataCache::rebuild()
{
** global input files is changed.
*/
bool isRebuildRequired();
-
+
+ /**
+ * check if cached scenery paths have changed, and if so, drop scenery-
+ * dependant data such as ground-nets.
+ */
+ bool dropGroundnetsIfRequired();
+
/**
* run the cache rebuild - returns true if rebuild is complete,
* otherwise keep going.