From 9e418202fd40896e3292b834423fcd20509e2739 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 14 Feb 2022 00:22:41 -0800 Subject: [PATCH] Avoid some const_casts --- al/eax_fx_slots.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/al/eax_fx_slots.cpp b/al/eax_fx_slots.cpp index 284efd98..3a27dabd 100644 --- a/al/eax_fx_slots.cpp +++ b/al/eax_fx_slots.cpp @@ -43,21 +43,18 @@ void EaxFxSlots::uninitialize() noexcept } } -const ALeffectslot& EaxFxSlots::get( - EaxFxSlotIndex index) const +const ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index) const { - if (!index.has_value()) - { + if(!index.has_value()) fail("Empty index."); - } - return *fx_slots_[index.value()]; } -ALeffectslot& EaxFxSlots::get( - EaxFxSlotIndex index) +ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index) { - return const_cast(const_cast(this)->get(index)); + if(!index.has_value()) + fail("Empty index."); + return *fx_slots_[index.value()]; } void EaxFxSlots::unlock_legacy() noexcept