Skip to content

Commit 9707ae4

Browse files
committed
More fixes
1 parent 78f0603 commit 9707ae4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Source/Menus/BuyMenuGUI.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,15 +1119,17 @@ void BuyMenuGUI::Update() {
11191119
if (pressDown && m_DraggedItemIndex < listSize - 1) {
11201120
m_IsDragging = true;
11211121
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex], (*m_pShopList->GetItemList())[m_DraggedItemIndex + 1]);
1122-
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex + 1]->m_ID, (*m_pShopList->GetItemList())[m_DraggedItemIndex]->m_ID);
1122+
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex]->m_ID, (*m_pShopList->GetItemList())[m_DraggedItemIndex + 1]->m_ID);
1123+
std::swap(m_Loadouts[m_DraggedItemIndex], m_Loadouts[m_DraggedItemIndex + 1]);
11231124
m_ListItemIndex = ++m_DraggedItemIndex;
11241125
m_SelectedLoadoutIndex = -1;
11251126
m_pShopList->SetSelectedIndex(m_ListItemIndex);
11261127
g_GUISound.SelectionChangeSound()->Play(m_pController->GetPlayer());
11271128
} else if (pressUp && m_DraggedItemIndex > 0) {
11281129
m_IsDragging = true;
11291130
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex], (*m_pShopList->GetItemList())[m_DraggedItemIndex - 1]);
1130-
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex - 1]->m_ID, (*m_pShopList->GetItemList())[m_DraggedItemIndex]->m_ID);
1131+
std::swap((*m_pShopList->GetItemList())[m_DraggedItemIndex]->m_ID, (*m_pShopList->GetItemList())[m_DraggedItemIndex - 1]->m_ID);
1132+
std::swap(m_Loadouts[m_DraggedItemIndex], m_Loadouts[m_DraggedItemIndex - 1]);
11311133
m_ListItemIndex = --m_DraggedItemIndex;
11321134
m_SelectedLoadoutIndex = -1;
11331135
m_pShopList->SetSelectedIndex(m_ListItemIndex);
@@ -1373,15 +1375,15 @@ void BuyMenuGUI::Update() {
13731375
m_IsDragging = true;
13741376
itemsChanged = true;
13751377
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex], (*m_pCartList->GetItemList())[m_DraggedItemIndex + 1]);
1376-
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex + 1]->m_ID, (*m_pCartList->GetItemList())[m_DraggedItemIndex]->m_ID);
1378+
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex]->m_ID, (*m_pCartList->GetItemList())[m_DraggedItemIndex + 1]->m_ID);
13771379
m_ListItemIndex = ++m_DraggedItemIndex;
13781380
m_pCartList->SetSelectedIndex(m_ListItemIndex);
13791381
g_GUISound.SelectionChangeSound()->Play(m_pController->GetPlayer());
13801382
} else if (pressUp && m_DraggedItemIndex > 0) {
13811383
m_IsDragging = true;
13821384
itemsChanged = true;
13831385
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex], (*m_pCartList->GetItemList())[m_DraggedItemIndex - 1]);
1384-
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex - 1]->m_ID, (*m_pCartList->GetItemList())[m_DraggedItemIndex]->m_ID);
1386+
std::swap((*m_pCartList->GetItemList())[m_DraggedItemIndex]->m_ID, (*m_pCartList->GetItemList())[m_DraggedItemIndex + 1]->m_ID);
13851387
m_ListItemIndex = --m_DraggedItemIndex;
13861388
m_pCartList->SetSelectedIndex(m_ListItemIndex);
13871389
g_GUISound.SelectionChangeSound()->Play(m_pController->GetPlayer());
@@ -1748,7 +1750,8 @@ void BuyMenuGUI::Update() {
17481750
m_DraggedItemIndex = oldIndex + direction;
17491751
m_SelectedLoadoutIndex = m_DraggedItemIndex;
17501752
std::swap((*m_pShopList->GetItemList())[oldIndex], (*m_pShopList->GetItemList())[oldIndex + direction]);
1751-
std::swap((*m_pShopList->GetItemList())[oldIndex + direction]->m_ID, (*m_pShopList->GetItemList())[oldIndex]->m_ID);
1753+
std::swap((*m_pShopList->GetItemList())[oldIndex]->m_ID, (*m_pShopList->GetItemList())[oldIndex + direction]->m_ID);
1754+
std::swap(m_Loadouts[oldIndex], m_Loadouts[oldIndex + direction]);
17521755
}
17531756
}
17541757

@@ -1853,7 +1856,7 @@ void BuyMenuGUI::Update() {
18531856

18541857
m_DraggedItemIndex = oldIndex + direction;
18551858
std::swap((*m_pCartList->GetItemList())[oldIndex], (*m_pCartList->GetItemList())[oldIndex + direction]);
1856-
std::swap((*m_pCartList->GetItemList())[oldIndex + direction]->m_ID, (*m_pCartList->GetItemList())[oldIndex]->m_ID);
1859+
std::swap((*m_pCartList->GetItemList())[oldIndex]->m_ID, (*m_pCartList->GetItemList())[oldIndex + direction]->m_ID);
18571860
}
18581861
UpdateItemNestingLevels();
18591862
}

0 commit comments

Comments
 (0)