grtux wrote:I suspect something wrong within the new weather nasal code, sorry i could not find the bug.
If you are talking about the "local weather system", I don't think this is related at all.
However, you can easily see for yourself by completely disabling the local weather system, I don't think there is currently such an option (?) - but you could simply rename the LW related Nasal files in $FG_ROOT/Nasal/ to *.txt files, that would prevent them from getting loaded and run. If your problems still appear, it's obviously not related to LW.
I think we will need to add an option to be able to disable LW using a property, at least during startup - preferably even at runtime (using a listener).
I already talked to Thorsten about restructuring some things, so that the $FG_ROOT/Nasal folder doesn't get more and more cluttered as the LW system is getting more and more modular...
I suggested to move the local weather system to a dedicated folder either as a sub directory within the Nasal directory or possibly even outside the Nasal folder (e.g. $FG_ROOT/LocalWeather ?). The only thing that we would then leave in $FG_ROOT/Nasal would be a small wrapper script that provides control capabilities for loading and unloading the LW system dynamically. That way, we would end up with a less cluttered $FG_ROOT/Nasal folder and the LW system would get its own "home" within the base package, where we can keep all file and continue modularizing the system.
For adding a new command line option, we could just add options to $FG_ROOT/options.xml and $FG_ROOT/Translations/strings-default.xml:
- Code: Select all
diff --git a/Translations/strings-default.xml b/Translations/strings-default.xml
index 3988548..3fa2770 100644
--- a/Translations/strings-default.xml
+++ b/Translations/strings-default.xml
@@ -299,5 +299,9 @@
<trace-read-desc>Trace the reads for a property;</trace-read-desc>
<trace-write-desc>Trace the writes for a property;</trace-write-desc>
<log-level-desc>Specify which logging level to use</log-level-desc>
+
+ <!-- Local Weather Options -->
+ <local-weather-options>Local Weather Options</local-weather-options>
+ <disable-local-weather>disable the local weather system, so that it does not even get loaded</disable-local-weather>
</PropertyList>
diff --git a/options.xml b/options.xml
index 25e3d8b..6dfcbf7 100644
--- a/options.xml
+++ b/options.xml
@@ -1111,6 +1111,16 @@
</option>
</section>
+ <section>
+ <name>strings/local-weather-options</name>
+
+ <option>
+ <name>disable-local-weather</name>
+ <description>strings/disable-local-weather</description>
+ </option>
+
+ </section>
+
</options>
</PropertyList>
So that we see a new option when running fgfs --help --verbose:
Debugging Options:
--enable-fpe Abort on encountering a floating point
exception;
--fgviewer Use a model viewer rather than load the entire
simulator;
--log-level={bulk,debug,info,warn,alert}
Specify which logging level to use
--trace-read=property Trace the reads for a property;
multiple instances can be used
--trace-write=property Trace the writes for a property;
multiple instances can be used
Local Weather Options:
--disable-local-weather disable the local weather system, so that it
does not even get loaded
And then add a corresponding line to $FG_SRC/Main/options.cxx to the fgOptionArray[]
This would be the most elegant thing, however it would require a very small C++ patch. For the time being, just using --prop:/sim/startup/disable-local-weather=1 would be easier, because it requires not C++ changes.
To be honest, I find it surprising that it is at all necessary to add command line options to the C++ source code, especially if they just set properties, this could be completely XML configurable:
- Code: Select all
<option>
<name>disable-local-weather</name>
<description>strings/disable-local-weather</description>
<property>/sim/startup/disable-local-weather</property>
<type>bool</type>
<value>true</value>
<default>false</default>
</option>
In other words, define an option:
- "--disable-local-weather"
- get the translation from "/strings/disable-local-weather"
- set the property "/sim/startup/disable-local-weather"
- make it type "bool"
- set the value to "true" if the option is specified
- set the default setting to "false" if not specified
That would seem useful for many other configuration settings, and users could then directly add those to the base package, without C++ patches.
Many of the options in the fgOptions array could then be moved to options.xml instead.
In Nasal, we would then just see if /sim/startup/disable-local-weather was set or not, and accordingly prevent the startup() function from being run:
- Code: Select all
diff --git a/Nasal/compat_layer.nas b/Nasal/compat_layer.nas
index a91a0cc..b52cb60 100644
--- a/Nasal/compat_layer.nas
+++ b/Nasal/compat_layer.nas
@@ -121,6 +121,7 @@ var check_geodinfo_vec = func {
return 0;
}
+if (! getprop("/sim/startup/disable-local-weather"))
_setlistener("/sim/signals/nasal-dir-initialized", func {
print ("Compatibility layer: Checking available Nasal APIs:");
print ("(this may cause harmless error messages when hard-coded support is lacking)");
@@ -129,7 +130,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
print("features.geodinfo_supports_vectors=", features.geodinfo_supports_vectors);
print ("##########################################");
print("Compatibility checks done.");
-});
+}) or print("not running compat_layer.nas (local weather disabled)");
# this is now where we can simply refer to features.geodinfo_supports_vectors
# for checking if vector support is available or not - to use the most appropriate
diff --git a/Nasal/local_weather.nas b/Nasal/local_weather.nas
index 21badfc..c177120 100644
--- a/Nasal/local_weather.nas
+++ b/Nasal/local_weather.nas
@@ -3239,6 +3239,6 @@ setprop(lwi~"ipoint-number",0);
# wait for Nasal to be available and do what is in startup()
_setlistener("/sim/signals/nasal-dir-initialized", func {
- startup();
+ if (!getprop("/sim/startup/disable-local-weather")) startup() or print("not running local-weather.nas (local weather disabled)");
});
Once the local weather system has its own sub directory, we could the script not just prevent from running, but also from being loaded this way.