Gentlemen,
It really irritates me that the starting runway is always set closest to
270degrees instead of into the wind when the [EMAIL PROTECTED] or --random-wind
options are used, unless --heading= or --runway= is specified explicity. The
patch below fixes that, but it also has one side-effect, so I guess I'd better
throw it open for discussion before sending it to Curt.
The side-effect is that when wind or random-wind is specifed explicitly (either
in .fgfsrc or on the commandline), then it becomes impossible to specify a
crosswind runway using the --heading= option. It *is* however possible to
specify a crosswind or specific runway using the --runway= option. So the only
change is that you now need to know the runway number instead of the general
heading. The heading option still works fine when the starting location has no
connection with a runway.
Personally I think the change is worthwhile. Currently one must use the
--heading= or --runway= option with the --wind= option in order to get a
sensible runway, and there is no way I know of to set a sensible runway with
--random-wind. With the patch a sensible runway is automatically set with the
--wind= or --random-wind options, and can be overridden with the --runway=
option.
Note that this doesn't work with the --enable-real-weather-fetch option - this
is completely unaffected. I'd love to get the starting runway set sensibly
with this option, but it's tricky. It seems to me that first general location
must be initialised to get the correct weather, then the environment system
needs to be initialised, and finally specific position needs to be set to get
the correct runway. Ie runway depends on weather which depends on location.
At the moment I'm stumped on getting the environment fully up and running
during init - I can't seem to force an update of the relevent environment_ctrl.
Cheers - Dave
$ cvs diff -u
cvs diff: Diffing .
Index: fg_init.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Main/fg_init.cxx,v
retrieving revision 1.115
diff -u -r1.115 fg_init.cxx
--- fg_init.cxx 27 Dec 2004 17:35:22 -0000 1.115
+++ fg_init.cxx 29 Dec 2004 01:09:18 -0000
@@ -1145,10 +1145,17 @@
if ( !set_pos && !apt.empty() ) {
// An airport is requested (find runway closest to hdg)
- if ( fgSetPosFromAirportIDandHdg( apt, hdg ) ) {
+ // DCL - When finding rwy, first set hdg into wind where possible
+ double d = fgGetDouble("/sim/presets/wind-from-heading-deg");
+ double s = fgGetDouble("/sim/presets/wind-speed-kt");
+ double rhdg = hdg;
+ if(d > 0 && s > 0) {
+ rhdg = d;
+ }
+ if ( fgSetPosFromAirportIDandHdg( apt, rhdg ) ) {
// set tower position (a little off the heading for single
// runway airports)
- fgSetTowerPosFromAirportID( apt, hdg );
+ fgSetTowerPosFromAirportID( apt, rhdg );
set_pos = true;
}
}
Index: options.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Main/options.cxx,v
retrieving revision 1.66
diff -u -r1.66 options.cxx
--- options.cxx 4 Dec 2004 21:06:57 -0000 1.66
+++ options.cxx 29 Dec 2004 01:09:26 -0000
@@ -977,6 +977,8 @@
double max_hdg = min_hdg + (20 - sqrt(sg_random() * 400));
double speed = sg_random() * sg_random() * 40;
double gust = speed + (10 - sqrt(sg_random() * 100));
+ fgSetDouble("/sim/presets/wind-from-heading-deg", (min_hdg + max_hdg) /
2.0);
+ fgSetDouble("/sim/presets/wind-speed-kt", speed);
fgSetupWind(min_hdg, max_hdg, speed, gust);
return FG_OPTIONS_OK;
}
@@ -989,6 +991,8 @@
SG_LOG( SG_GENERAL, SG_ALERT, "bad wind value " << arg );
return FG_OPTIONS_ERROR;
}
+ fgSetDouble("/sim/presets/wind-from-heading-deg", (min_hdg + max_hdg) /
2.0);
+ fgSetDouble("/sim/presets/wind-speed-kt", speed);
fgSetupWind(min_hdg, max_hdg, speed, gust);
return FG_OPTIONS_OK;
}
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d