From 8560495ae6a7e73821177ba74b4b31451bd165dc Mon Sep 17 00:00:00 2001 From: William JCM Date: Sat, 11 Jan 2020 11:02:45 +0100 Subject: [PATCH] EvtMainFrame: rewrite getActiveSlot. It was pretty bad, not gonna lie. --- GUI/EvtMainFrame.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/GUI/EvtMainFrame.cpp b/GUI/EvtMainFrame.cpp index 8be80e3..9ae0088 100644 --- a/GUI/EvtMainFrame.cpp +++ b/GUI/EvtMainFrame.cpp @@ -346,8 +346,22 @@ void EvtMainFrame::getActiveSlot() { wxFont tmp_font = _installedListView->GetItemFont(_activeSlot); tmp_font.SetWeight(wxFONTWEIGHT_NORMAL); _installedListView->SetItemFont(_activeSlot, tmp_font); - _activeSlot = (iter == mmap.end() && std::strncmp(&mmap[0x3F6], "Credit", 6) == 0) ? 0 : *(iter + 41); - _installedListView->SetItemFont(_activeSlot, _installedListView->GetItemFont(_activeSlot).Bold()); + + if(iter == mmap.end()) { + if(std::strncmp(&mmap[0x3F6], "Credit", 6)) { + _activeSlot = 0; + } + else { + _activeSlot = -1; + } + } + else { + _activeSlot = *(iter + 41); + } + + if(_activeSlot != -1) { + _installedListView->SetItemFont(_activeSlot, _installedListView->GetItemFont(_activeSlot).Bold()); + } } void EvtMainFrame::updateCommandsState() {