Following feedback from upstream that the "turning downloads off also makes previously downloaded scenery disappear" behaviour is intentional (http://sourceforge.net/p/flightgear/mailman/message/31769643/), this is a revised patch set that keeps that behaviour. (First two for flightgear, last two for flightgear-data.)
Description: Always set Terrasync directory
Author: Rebecca Palmer
Bug-Debian: http://bugs.debian.org/252899
Forwarded: https://gitorious.org/fg/flightgear/merge_requests/52

This was previously done only if Terrasync was on, but this made it impossible
to use the GUI dialog to turn it on for the first time in a fresh install
--- flightgear-2.12.1.orig/src/Main/options.cxx
+++ flightgear-2.12.1/src/Main/options.cxx
@@ -2041,7 +2041,6 @@ void Options::processOptions()
   }
     
 // terrasync directory fixup
-  if (fgGetBool("/sim/terrasync/enabled")) {
     string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
     if (terrasyncDir.empty()) {
       SGPath p(globals->get_fg_home());
@@ -2058,6 +2057,7 @@ void Options::processOptions()
           dd.create(0700);
       }
     
+  if (fgGetBool("/sim/terrasync/enabled")) {
     const string_list& scenery_paths(globals->get_fg_scenery());
     if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
       // terrasync dir is not in the scenery paths, add it
Description: Fix Terrasync rounding error
Author: Rebecca Palmer
Bug-Debian: http://bugs.debian.org/252899
Forwarded: not-needed

Pass the lat/long rounded down (as used in tile names and expected by terrasync, e.g. 40.7,-90.4 -> w091n40), instead of the default rounded-towards-0 (40.7,-90.4 -> w090n40).
--- flightgear-2.12.1.orig/src/Scenery/tilemgr.cxx
+++ flightgear-2.12.1/src/Scenery/tilemgr.cxx
@@ -382,7 +382,7 @@ void FGTileMgr::schedule_tiles_at(const
             scheduled_visibility = range_m;
             schedule_needed(current_bucket, range_m);
             if (_terra_sync)
-                _terra_sync->schedulePosition(latitude,longitude);
+                _terra_sync->schedulePosition(floor(latitude),floor(longitude));
         }
         // save bucket
         previous_bucket = current_bucket;
Description: Allow enabling Terrasync while leaving the directory unchanged
Author: Rebecca Palmer
Bug-Debian: http://bugs.debian.org/252899
Forwarded: not-needed

Don't require the Terrasync directory to already be in fg-scenery before
allowing the user to turn on Terrasync from the GUI dialog.

This requires restarting the sim to automatically add the directory,
but avoids the need to use the command line.

--- flightgear-data-2.12.0.orig/gui/dialogs/terrasync.xml
+++ flightgear-data-2.12.0/gui/dialogs/terrasync.xml
@@ -53,7 +53,7 @@
       <halign>left</halign>
       <row>1</row><col>1</col><colspan>3</colspan>
       <property>/sim/terrasync/enabled</property>
-      <label>Enable automatic scenery download/update</label>
+      <label>Enable automatic scenery download/update (requires restart)</label>
       <live>true</live>
       <binding>
         <command>dialog-apply</command>
@@ -529,18 +529,22 @@
       var combo = gui.findElementByName(cmdarg(),"scenery-dir");
       var valid = 0;
 
-      for (var i = 0; i < size(fg_scenery); i = i + 1) {
-        var s = fg_scenery[i].getValue();
-        if ((s != fg_data ~ "/Scenery") and (s != fg_data ~ "\\Scenery")) {
+      for (var i = 0; i <= size(fg_scenery); i = i + 1) {
+        # Default to not changing the Terrasync directory
+        var s = getprop("/sim/terrasync/scenery-dir");
+        if (i > 0) {
+          s = fg_scenery[i-1].getValue();
+        }
+        if ((s != fg_data ~ "/Scenery") and (s != fg_data ~ "\\Scenery") and (s != "")) {
           # Do not allow Terrasync to run in the default directory.
-          combo.getNode("value[" ~ i ~ "]", 1).setValue(fg_scenery[i].getValue());
+          combo.getNode("value[" ~ i ~ "]", 1).setValue(s);
           valid = 1;
         }
       }
 
       # Add error text if the user only has fg-data/Scenery available and disable controls.
       if (!valid) {
-        var warning = cmdarg().getChildren("group")[1].getChildren("text")[1];
+        var warning = gui.findElementByName(cmdarg(),"warning_text");
         var txt = "You must configure a separate FG_SCENERY directory for automatic scenery download";
         warning.getNode("label").setValue(txt);
       }
Description: Document Terrasync + "Select airport" workaround
Author: Rebecca Palmer
Bug-Debian: http://bugs.debian.org/252899
Forwarded: not-needed

"Select airport" does not wait for scenery to be downloaded, and hence often
leaves one stuck "underground".  This tells the user how to get out of this.

(Upstream have really fixed this problem for 3.0, but the changes are
too large to sensibly backport.)

--- flightgear-data-2.12.0.orig/gui/dialogs/terrasync.xml
+++ flightgear-data-2.12.0/gui/dialogs/terrasync.xml
@@ -148,6 +148,21 @@
       </binding>
     </button>
 
+    <text>
+      <row>7</row>
+      <col>0</col><colspan>4</colspan>
+      <halign>center</halign>
+      <wrap>true</wrap>
+      <label>If you see only water after "Select airport", wait for scenery to download,</label>
+    </text>
+    <text>
+      <row>8</row>
+      <col>0</col><colspan>4</colspan>
+      <halign>center</halign>
+      <wrap>true</wrap>
+      <label>click "Manual Refresh" above (scenery will appear above you), then "Select airport" again.</label>
+    </text>
+
 <!--
     <checkbox>
       <name>internal-svn</name>

Reply via email to