diff options
author | Chris Robinson <[email protected]> | 2019-05-26 21:28:51 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-05-26 21:28:51 -0700 |
commit | f57fedec7f8878230fb77be1d91d7c056f7e6de4 (patch) | |
tree | b10f6bf16db0f2e792b64f74388ec9ffde47791a /OpenAL32/alEffect.cpp | |
parent | f6f220025bd9674a33d896258b315c006cfd78f1 (diff) |
Get rid of the COUNTOF macro
Diffstat (limited to 'OpenAL32/alEffect.cpp')
-rw-r--r-- | OpenAL32/alEffect.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index 36a09442..51474af0 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -320,11 +320,17 @@ START_API_FUNC { if(param == AL_EFFECT_TYPE) { - ALboolean isOk = (value == AL_EFFECT_NULL); - for(size_t i{0u};!isOk && i < countof(gEffectList);i++) + ALboolean isOk{value == AL_EFFECT_NULL}; + if(!isOk) { - if(value == gEffectList[i].val && !DisabledEffects[gEffectList[i].type]) - isOk = AL_TRUE; + for(const EffectList &effectitem : gEffectList) + { + if(value == effectitem.val && !DisabledEffects[effectitem.type]) + { + isOk = AL_TRUE; + break; + } + } } if(isOk) @@ -669,8 +675,6 @@ static const struct { void LoadReverbPreset(const char *name, ALeffect *effect) { - size_t i; - if(strcasecmp(name, "NONE") == 0) { InitEffectParams(effect, AL_EFFECT_NULL); @@ -684,15 +688,15 @@ void LoadReverbPreset(const char *name, ALeffect *effect) InitEffectParams(effect, AL_EFFECT_REVERB); else InitEffectParams(effect, AL_EFFECT_NULL); - for(i = 0;i < COUNTOF(reverblist);i++) + for(const auto &reverbitem : reverblist) { const EFXEAXREVERBPROPERTIES *props; - if(strcasecmp(name, reverblist[i].name) != 0) + if(strcasecmp(name, reverbitem.name) != 0) continue; - TRACE("Loading reverb '%s'\n", reverblist[i].name); - props = &reverblist[i].props; + TRACE("Loading reverb '%s'\n", reverbitem.name); + props = &reverbitem.props; effect->Props.Reverb.Density = props->flDensity; effect->Props.Reverb.Diffusion = props->flDiffusion; effect->Props.Reverb.Gain = props->flGain; |