X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_props.cxx;h=a5726b79b00b7e7ad44d76565dc0acf9e971b9ca;hb=b7eb3bd0e128d39101dfa5846de991681aa5456f;hp=1e8885c3590bae3729c08368d30f8c4b45326020;hpb=83edcb294964866f2c53b93681727173a96ee2b6;p=flightgear.git diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 1e8885c35..a5726b79b 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -85,20 +85,26 @@ LogClassMapping log_class_mappings [] = { /** * Get the logging classes. */ +// XXX Making the result buffer be global is a band-aid that hopefully +// delays its destruction 'til after its last use. +namespace +{ +string loggingResult; +} + static const char * getLoggingClasses () { sgDebugClass classes = logbuf::get_log_classes(); - static string result; - result = ""; + loggingResult.clear(); for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) { if ((classes&log_class_mappings[i].c) > 0) { - if (!result.empty()) - result += '|'; - result += log_class_mappings[i].name; + if (!loggingResult.empty()) + loggingResult += '|'; + loggingResult += log_class_mappings[i].name; } } - return result.c_str(); + return loggingResult.c_str(); } @@ -222,12 +228,12 @@ setFreeze (bool f) frozen = f; // Stop sound on a pause - SGSoundMgr *s = globals->get_soundmgr(); - if ( s != NULL ) { + SGSoundMgr *smgr = globals->get_soundmgr(); + if ( smgr != NULL ) { if ( f ) { - s->pause(); - } else if (!fgGetBool("/sim/sound/pause")) { - s->resume(); + smgr->suspend(); + } else if (fgGetBool("/sim/sound/working")) { + smgr->resume(); } } } @@ -349,6 +355,18 @@ getHeadingMag () return magheading; } +/** + * Return the current track in degrees. + */ +static double +getTrackMag () +{ + double magtrack; + magtrack = current_aircraft.fdm_state->get_Track() - getMagVar(); + if (magtrack < 0) magtrack += 360; + return magtrack; +} + static long getWarp () { @@ -508,6 +526,7 @@ FGProperties::bind () // Orientation fgTie("/orientation/heading-magnetic-deg", getHeadingMag); + fgTie("/orientation/track-magnetic-deg", getTrackMag); fgTie("/environment/magnetic-variation-deg", getMagVar); fgTie("/environment/magnetic-dip-deg", getMagDip); @@ -537,6 +556,7 @@ FGProperties::unbind () // Orientation fgUntie("/orientation/heading-magnetic-deg"); + fgUntie("/orientation/track-magnetic-deg"); // Environment fgUntie("/environment/magnetic-variation-deg");