//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <Main/fg_props.hxx>
#include <simgear/constants.h>
void FGClouds::init(void) {
if( snd_lightning == NULL ) {
- snd_lightning = new SGSoundSample(globals->get_fg_root().c_str(), "Sounds/thunder.wav", true);
+ snd_lightning = new SGSoundSample(globals->get_fg_root().c_str(), "Sounds/thunder.wav");
snd_lightning->set_max_dist(7000.0f);
snd_lightning->set_reference_dist(3000.0f);
SGSoundMgr *soundMgr = globals->get_soundmgr();
}
}
-SGNewCloud *FGClouds::buildCloud(SGPropertyNode *cloud_def_root, string name) {
+SGNewCloud *FGClouds::buildCloud(SGPropertyNode *cloud_def_root, const string& name) {
SGPropertyNode *cld_def=NULL;
cld_def = cloud_def_root->getChild(name.c_str());
return cld;
}
-void FGClouds::buildLayer(SGCloudField *layer, string name, double alt, double coverage) {
+void FGClouds::buildLayer(SGCloudField *layer, const string& name, double alt, double coverage) {
struct {
string name;
double count;
// copy from FGMetarEnvironmentCtrl until better
void
-FGClouds::update_metar_properties( FGMetar *m )
+FGClouds::update_metar_properties( const FGMetar *m )
{
int i;
double d;
fgSetDouble("/environment/metar/max-visibility-m",
m->getMaxVisibility().getVisibility_m() );
- SGMetarVisibility *dirvis = m->getDirVisibility();
+ const SGMetarVisibility *dirvis = m->getDirVisibility();
for (i = 0; i < 8; i++, dirvis++) {
const char *min = "/environment/metar/visibility[%d]/min-m";
const char *max = "/environment/metar/visibility[%d]/max-m";
m->getPressure_inHg() );
vector<SGMetarCloud> cv = m->getClouds();
- vector<SGMetarCloud>::iterator cloud;
+ vector<SGMetarCloud>::const_iterator cloud;
const char *cl = "/environment/clouds/layer[%i]";
for (i = 0, cloud = cv.begin(); cloud != cv.end(); cloud++, i++) {
}
-void FGClouds::setLayer( int iLayer, float alt_ft, string coverage, string layer_type ) {
+void FGClouds::setLayer( int iLayer, float alt_ft, const string& coverage, const string& layer_type ) {
double coverage_norm = 0.0;
if( coverage == "few" )
coverage_norm = 2.0/8.0; // <1-2
buildLayer(layer3D, layer_type, station_elevation_ft + alt_ft * SG_FEET_TO_METER, coverage_norm);
}
-void FGClouds::buildScenario( string scenario ) {
+void FGClouds::buildScenario( const string& scenario ) {
string fakeMetar="";
string station = fgGetString("/environment/metar/station-id", "XXXX");
if( station == "XXXX" )
station_elevation_ft = fgGetDouble("/position/ground-elev-m", 0.0);
else {
- FGAirport a = globals->get_airports()->search( station );
- station_elevation_ft = a.getElevation();
+ const FGAirport* a = globals->get_airports()->search( station );
+ station_elevation_ft = (a ? a->getElevation() : 0.0);
}
for(int iLayer = 0 ; iLayer < thesky->get_cloud_layer_count(); iLayer++) {