diff --git a/src/Network/fgcom.cxx b/src/Network/fgcom.cxx index 5859d9192..a5eb46469 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -95,6 +95,8 @@ void FGCom::iaxTextEvent(struct iaxc_ev_text text) FGCom::FGCom() { + _maxRange = MAX_RANGE; + _minRange = MIN_RANGE; } @@ -195,7 +197,7 @@ void FGCom::init() _username = _username_node->getStringValue(); _password = _password_node->getStringValue(); - _currentCommFrequency = 0; + _currentCommFrequency = 0.0; _maxRange = MAX_RANGE; _minRange = MIN_RANGE; @@ -341,7 +343,7 @@ void FGCom::setupCommFrequency(int channel) { SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent); _currentCallIdent = -1; } - _currentCommFrequency = 0; + _currentCommFrequency = 0.0; return; } @@ -376,18 +378,18 @@ void FGCom::setupCommFrequency(int channel) { _commFrequencyNode->removeChangeListener(this); SG_LOG(SG_IO, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel); - _currentCommFrequency = 0; + _currentCommFrequency = 0.0; } void FGCom::connectToCommFrequency() { // ensure that the current comm is still in range - if (_currentCallFrequency && !isInRange(_currentCallFrequency)) { + if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) { SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency); - _currentCallFrequency = 0; + _currentCallFrequency = 0.0; } // don't connected (and disconnect if already connected) when tuned freq is 0 - if (_currentCommFrequency < 1) { + if (_currentCommFrequency < 1.0) { if (_currentCallIdent != -1) { iaxc_dump_call_number(_currentCallIdent); SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent); diff --git a/src/Network/fgcom.hxx b/src/Network/fgcom.hxx index 8feb89a5a..cd0c0df58 100644 --- a/src/Network/fgcom.hxx +++ b/src/Network/fgcom.hxx @@ -72,14 +72,14 @@ private: SGPropertyNode_ptr _mpTransmitFrequencyNode; // sim/multiplay/comm-transmit-frequency-mhz SGPropertyNode_ptr _mpTransmitPowerNode; // sim/multiplay/comm-transmit-power-norm - double _maxRange; - double _minRange; - double _currentCommFrequency; - double _currentCallFrequency; + double _maxRange = 0.0; + double _minRange = 0.0; + double _currentCommFrequency = 0.0; + double _currentCallFrequency = 0.0; bool _register = true; bool _enabled = false; bool _initialized = false; - int _regId; + int _regId = 0; int _currentCallIdent = -1; //int _callComm1; int _listener_active = 0;