]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AIMgr.cxx
Mathias Fröhlich:
[flightgear.git] / src / ATC / AIMgr.cxx
index c3682718fa20ff9eecfa04da0d74d98d356c1062..c7c7c47446f57d18e5ef760f071fb8e97a1f49b7 100644 (file)
@@ -57,8 +57,8 @@ FGAIMgr::FGAIMgr() {
 }
 
 FGAIMgr::~FGAIMgr() {
-       _defaultModel->deRef();
-       if(_havePiperModel) _piperModel->deRef();
+        ssgDeRefDelete(_defaultModel);
+       if(_havePiperModel) ssgDeRefDelete(_piperModel);
 }
 
 void FGAIMgr::init() {
@@ -353,8 +353,13 @@ void FGAIMgr::GenerateSimpleAirportTraffic(string ident, double min_dist) {
        bool cessna = true;
        
        // Get the time and only operate VFR in the (approximate) daytime.
-       time_t now = globals->get_time_params()->get_cur_time() + time_t(aptpos.lon() * 240.0);
-       int loc_time = gmtime(&now)->tm_hour;
+       struct tm *t = globals->get_time_params()->getGmt();
+       int loc_time = t->tm_hour + int(aptpos.lon() / (360.0 / 24.0));
+       while (loc_time < 0)
+               loc_time += 24;
+       while (loc_time >= 24)
+               loc_time -= 24;
+
        //cout << "loc_time = " << loc_time << '\n';
        if(loc_time < 7 || loc_time > 19) return;