diff options
| author | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
|---|---|---|
| committer | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
| commit | 0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch) | |
| tree | c831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/tier1/convar.cpp | |
| parent | Updated the SDK with the latest code from the TF and HL2 branches. (diff) | |
| download | source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.tar.xz source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.zip | |
Diffstat (limited to 'mp/src/tier1/convar.cpp')
| -rw-r--r-- | mp/src/tier1/convar.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/mp/src/tier1/convar.cpp b/mp/src/tier1/convar.cpp index 956ad91d..772586f2 100644 --- a/mp/src/tier1/convar.cpp +++ b/mp/src/tier1/convar.cpp @@ -592,7 +592,7 @@ void ConCommand::Dispatch( const CCommand &command ) } // Command without callback!!! - AssertMsg( 0, ( "Encountered ConCommand '%s' without a callback!\n", GetName() ) ); + AssertMsg( 0, "Encountered ConCommand '%s' without a callback!\n", GetName() ); } @@ -777,10 +777,10 @@ void ConVar::InternalSetValue( const char *value ) Q_snprintf( tempVal,sizeof(tempVal), "%f", fNewValue ); val = tempVal; } - + // Redetermine value m_fValue = fNewValue; - m_nValue = ( int )( m_fValue ); + m_nValue = ( int )( fNewValue ); if ( !( m_nFlags & FCVAR_NEVER_AS_STRING ) ) { @@ -821,13 +821,17 @@ void ConVar::ChangeStringValue( const char *tempVal, float flOldValue ) *m_pszString = 0; } - // Invoke any necessary callback function - if ( m_fnChangeCallback ) + // If nothing has changed, don't do the callbacks. + if (V_strcmp(pszOldValue, m_pszString) != 0) { - m_fnChangeCallback( this, pszOldValue, flOldValue ); - } + // Invoke any necessary callback function + if ( m_fnChangeCallback ) + { + m_fnChangeCallback( this, pszOldValue, flOldValue ); + } - g_pCVar->CallGlobalChangeCallbacks( this, pszOldValue, flOldValue ); + g_pCVar->CallGlobalChangeCallbacks( this, pszOldValue, flOldValue ); + } stackfree( pszOldValue ); } |