Skip to content

Commit e3a322c

Browse files
committed
Fixed loadout selection not working
1 parent f12035d commit e3a322c

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

Source/Menus/BuyMenuGUI.cpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,21 +1620,15 @@ void BuyMenuGUI::Update() {
16201620

16211621
GUIListPanel::Item* pItem = m_pShopList->GetItem(mousePosX, mousePosY);
16221622

1623+
// If the player clicked on a loadout preset, deploy it
16231624
if (pItem && m_MenuCategory == PRESETS) {
1624-
// The presets list must have a mouse-down event to select an item, whereas we implicitly select items on hover in other categories
1625-
m_LastHoveredMouseIndex = pItem->m_ID;
1626-
1627-
// Play select sound if new index
1628-
if (m_ListItemIndex != pItem->m_ID) {
1629-
g_GUISound.SelectionChangeSound()->Play(m_pController->GetPlayer());
1625+
// Beep if there's an error
1626+
if (!DeployLoadout(m_ListItemIndex)) {
1627+
g_GUISound.UserErrorSound()->Play(m_pController->GetPlayer());
16301628
}
1631-
1632-
m_pShopList->SetSelectedIndex(m_CategoryItemIndex[m_MenuCategory] = m_ListItemIndex = pItem->m_ID);
16331629
}
1634-
1635-
16361630
// If a module group list item, toggle its expansion and update the list
1637-
if (pItem && pItem->m_ExtraIndex >= 0) {
1631+
else if (pItem && pItem->m_ExtraIndex >= 0) {
16381632
// Make appropriate sound
16391633
if (!m_aExpandedModules[pItem->m_ExtraIndex])
16401634
g_GUISound.ItemChangeSound()->Play(m_pController->GetPlayer());
@@ -1646,12 +1640,6 @@ void BuyMenuGUI::Update() {
16461640
// Re-populate the item list with the new module expansion configuation
16471641
CategoryChange(false);
16481642
}
1649-
// Special case: user clicked on a loadout set, so load it into the menu
1650-
else if (pItem && m_MenuCategory == PRESETS) {
1651-
// Beep if there's an error
1652-
if (!DeployLoadout(m_ListItemIndex))
1653-
g_GUISound.UserErrorSound()->Play(m_pController->GetPlayer());
1654-
}
16551643
// Normal: only add an item if there's an entity attached to the list item
16561644
else if (pItem && pItem->m_pEntity) {
16571645
m_CategoryItemIndex[m_MenuCategory] = m_ListItemIndex = m_pShopList->GetSelectedIndex();
@@ -1714,8 +1702,7 @@ void BuyMenuGUI::Update() {
17141702
// See if it's hovering over any item
17151703
GUIListPanel::Item* pItem = m_pShopList->GetItem(mousePosX, mousePosY);
17161704
if (pItem) {
1717-
// On presets Menu, you must actively click to select an item. Anywhere else, an implicit hover will select
1718-
if (m_MenuCategory != PRESETS && m_LastHoveredMouseIndex != pItem->m_ID) {
1705+
if (m_LastHoveredMouseIndex != pItem->m_ID) {
17191706
// Don't let mouse movement change the index if it's still hovering inside the same item.
17201707
// This is to avoid erratic selection curosr if using both mouse and keyboard to work the menu
17211708
m_LastHoveredMouseIndex = pItem->m_ID;

0 commit comments

Comments
 (0)