UTIL ValidateSoundName: Difference between revisions
Jump to navigation
Jump to search
(Added UTIL_ValidateSoundName.) |
m (Syntax highlighting.) |
||
Line 5: | Line 5: | ||
==Examples== | ==Examples== | ||
<source lang=cpp> | |||
// If the hit sound string is not set, then play the generic hit sound. | // If the hit sound string is not set, then play the generic hit sound. | ||
UTIL_ValidateSoundName( m_WeaponHit, "Generic.WeaponHit" ); | UTIL_ValidateSoundName( m_WeaponHit, "Generic.WeaponHit" ); | ||
EmitSound( m_WeaponHit ); | EmitSound( m_WeaponHit ); | ||
</source> |
Revision as of 13:51, 29 July 2021
This UTIL function allocates a string to a set value if said string is a null string or simply "0". It is typically used for keeping sound names valid, as the name suggests.
Usage
void UTIL_ValidateSoundName( string_t &name, const char *defaultStr )
Examples
// If the hit sound string is not set, then play the generic hit sound.
UTIL_ValidateSoundName( m_WeaponHit, "Generic.WeaponHit" );
EmitSound( m_WeaponHit );