]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/groundnetwork.cxx
Document that property write-protection is not a security measure
[flightgear.git] / src / Airports / groundnetwork.cxx
index 344161172820a1780c9027cc136a515dccb413b2..3c692629a7d29de13731fd346e4add6fe095bc7d 100644 (file)
@@ -82,14 +82,14 @@ SGGeod FGTaxiSegment::getCenter() const
   return SGGeodesy::direct(start->geod(), heading, length * 0.5);
 }
 
-FGTaxiNode* FGTaxiSegment::getEnd() const
+FGTaxiNodeRef FGTaxiSegment::getEnd() const
 {
-  return static_cast<FGTaxiNode*>(NavDataCache::instance()->loadById(endNode));
+  return FGPositioned::loadById<FGTaxiNode>(endNode);
 }
 
-FGTaxiNode* FGTaxiSegment::getStart() const
+FGTaxiNodeRef FGTaxiSegment::getStart() const
 {
-  return static_cast<FGTaxiNode*>(NavDataCache::instance()->loadById(startNode));
+  return FGPositioned::loadById<FGTaxiNode>(startNode);
 }
 
 double FGTaxiSegment::getLength() const
@@ -212,7 +212,7 @@ void FGGroundNetwork::saveElevationCache()
                        airport[0], airport[1], airport[2]);
             cacheData.append(buffer);
             if (!cacheData.exists()) {
-                cacheData.create_dir(0777);
+                cacheData.create_dir(0755);
             }
             cacheData.append(airport + "-groundnet-cache.txt");
             cachefile.open(cacheData.str().c_str());
@@ -300,7 +300,7 @@ void FGGroundNetwork::parseCache()
              airport[0], airport[1], airport[2]);
   cacheData.append(buffer);
   if (!cacheData.exists()) {
-    cacheData.create_dir(0777);
+    cacheData.create_dir(0755);
   }
   int index;
   double elev;
@@ -343,10 +343,9 @@ int FGGroundNetwork::findNearestNodeOnRunway(const SGGeod & aGeod, FGRunway* aRu
   return NavDataCache::instance()->findGroundNetNode(parent->guid(), aGeod, onRunway, aRunway);
 }
 
-FGTaxiNode* FGGroundNetwork::findNode(PositionedID idx) const
+FGTaxiNodeRef FGGroundNetwork::findNode(PositionedID idx) const
 {
-
-  return static_cast<FGTaxiNode*>(NavDataCache::instance()->loadById(idx));
+  return FGPositioned::loadById<FGTaxiNode>(idx);
 }
 
 FGTaxiSegment *FGGroundNetwork::findSegment(unsigned idx) const
@@ -447,7 +446,7 @@ FGTaxiRoute FGGroundNetwork::findShortestRoute(PositionedID start, PositionedID
         }
       
         BOOST_FOREACH(PositionedID targetId, cache->groundNetEdgesFrom(best->guid(), !fullSearch)) {
-            FGTaxiNode* tgt = (FGTaxiNode*) cache->loadById(targetId);
+            FGTaxiNodeRef tgt = FGPositioned::loadById<FGTaxiNode>(targetId);
             double edgeLength = dist(best->cart(), tgt->cart());          
             double alt = searchData[best].score + edgeLength + edgePenalty(tgt);
             if (alt < searchData[tgt].score) {    // Relax (u,v)
@@ -1231,9 +1230,9 @@ void FGGroundNetwork::render(bool visible)
                 //osg::Node *custom_obj;
                 SGMaterial *mat;
                 if (segments[pos]->hasBlock(now)) {
-                    mat = matlib->find("UnidirectionalTaperRed");
+                    mat = matlib->find("UnidirectionalTaperRed", center);
                 } else {
-                    mat = matlib->find("UnidirectionalTaperGreen");
+                    mat = matlib->find("UnidirectionalTaperGreen", center);
                 }
                 if (mat)
                     geode->setEffect(mat->get_effect());
@@ -1305,9 +1304,9 @@ void FGGroundNetwork::render(bool visible)
                     //osg::Node *custom_obj;
                     SGMaterial *mat;
                     if (segments[k]->hasBlock(now)) {
-                        mat = matlib->find("UnidirectionalTaperRed");
+                        mat = matlib->find("UnidirectionalTaperRed", segCenter);
                     } else {
-                        mat = matlib->find("UnidirectionalTaperGreen");
+                        mat = matlib->find("UnidirectionalTaperGreen", segCenter);
                     }
                     if (mat)
                         geode->setEffect(mat->get_effect());