From 3a28fdae6fe74bf84325f77e3b4123c14df750b6 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:39:21 -0700 Subject: [PATCH] improve readability of MxBackgroundAudioManager::Enable While the previous iteration wasn't incorrect, it definitely reads like pseudocode (i.e. it's very unlikely any actual developers would have written that). This is much more readable/likely to have been written and still results in the same asm. --- LEGO1/mxbackgroundaudiomanager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/LEGO1/mxbackgroundaudiomanager.cpp b/LEGO1/mxbackgroundaudiomanager.cpp index f6f4df11..a24286ad 100644 --- a/LEGO1/mxbackgroundaudiomanager.cpp +++ b/LEGO1/mxbackgroundaudiomanager.cpp @@ -31,9 +31,12 @@ void MxBackgroundAudioManager::Stop() // OFFSET: LEGO1 0x1007f5f0 void MxBackgroundAudioManager::Enable(MxBool p) { - if ((this->m_musicEnabled != p) && (this->m_musicEnabled = p, !p)) { - Stop(); - } + if (this->m_musicEnabled != p) { + this->m_musicEnabled = p; + if (!p) { + Stop(); + } + } } // OFFSET: LEGO1 0x1007f650