]> git.mxchange.org Git - flightgear.git/commitdiff
Drop sorting of Nasal scripts.
authorThorstenB <brehmt@gmail.com>
Sat, 13 Oct 2012 10:42:48 +0000 (12:42 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 13 Oct 2012 13:45:15 +0000 (15:45 +0200)
simgear::Dir now always provides results in a deterministic order.

src/Scripting/NasalSys.cxx

index b38e0fbcd35137e43dd8d7cc8d78281380068995..9bb1966e78fd6d44059b464cb1ed014f740336e2 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/stat.h>
 #include <fstream>
 #include <sstream>
-#include <algorithm> // for std::sort
 
 #include <simgear/nasal/nasal.h>
 #include <simgear/props/props.hxx>
@@ -635,10 +634,8 @@ bool pathSortPredicate(const SGPath& p1, const SGPath& p2)
 void FGNasalSys::loadScriptDirectory(simgear::Dir nasalDir)
 {
     simgear::PathList scripts = nasalDir.children(simgear::Dir::TYPE_FILE, ".nas");
-    // sort scripts, avoid loading sequence effects due to file system's
-    // random directory order
-    std::sort(scripts.begin(), scripts.end(), pathSortPredicate);
-
+    // Note: simgear::Dir already reports file entries in a deterministic order,
+    // so a fixed loading sequence is guaranteed (same for every user)
     for (unsigned int i=0; i<scripts.size(); ++i) {
       SGPath fullpath(scripts[i]);
       SGPath file = fullpath.file();