@@ -115,7 +115,6 @@ void BuyMenuGUI::Clear()
115
115
m_pClearButton = 0 ;
116
116
m_Loadouts.clear ();
117
117
m_PurchaseMade = false ;
118
- m_CursorPos.Reset ();
119
118
120
119
m_EnforceMaxPassengersConstraint = true ;
121
120
m_EnforceMaxMassConstraint = true ;
@@ -1019,9 +1018,9 @@ void BuyMenuGUI::Update()
1019
1018
// ///////////////////////////////////////////////////
1020
1019
// Mouse cursor logic
1021
1020
1022
- int mouseX, mouseY ;
1023
- m_pGUIInput-> GetMousePosition (&mouseX, &mouseY) ;
1024
- m_CursorPos. SetXY (mouseX, mouseY );
1021
+ int mousePosX ;
1022
+ int mousePosY ;
1023
+ m_pGUIInput-> GetMousePosition (&mousePosX, &mousePosY );
1025
1024
1026
1025
// //////////////////////////////////////////
1027
1026
// Notification blinking logic
@@ -1227,7 +1226,7 @@ void BuyMenuGUI::Update()
1227
1226
for (int category = 0 ; category < CATEGORYCOUNT; ++category) {
1228
1227
if (!m_pCategoryTabs[category]->IsEnabled ()) {
1229
1228
if (m_MenuCategory == category) { m_pCategoryTabs[m_MenuCategory]->SetEnabled (true ); }
1230
- if (m_pCategoryTabs[category]->PointInside (m_CursorPos. GetFloorIntX () + 3 , m_CursorPos. GetFloorIntY () )) {
1229
+ if (m_pCategoryTabs[category]->PointInside (mousePosX + 3 , mousePosY )) {
1231
1230
if (m_pController->IsState (PRESS_PRIMARY)) {
1232
1231
m_MenuCategory = category;
1233
1232
m_pCategoryTabs[m_MenuCategory]->SetFocus ();
@@ -1715,7 +1714,7 @@ void BuyMenuGUI::Update()
1715
1714
if (m_MenuEnabled == ENABLED) {
1716
1715
if (m_pController->IsState (WEAPON_RELOAD)) {
1717
1716
TryPurchase ();
1718
- } else if (m_pController->IsMouseControlled () && (m_pController->IsState (PRESS_PRIMARY) || m_pController->IsState (PRESS_SECONDARY)) && m_CursorPos. m_X > m_pParentBox->GetWidth ()) {
1717
+ } else if (m_pController->IsMouseControlled () && (m_pController->IsState (PRESS_PRIMARY) || m_pController->IsState (PRESS_SECONDARY)) && mousePosX > m_pParentBox->GetWidth ()) {
1719
1718
if (m_pController->IsState (PRESS_PRIMARY)) {
1720
1719
TryPurchase ();
1721
1720
} else {
@@ -1822,7 +1821,7 @@ void BuyMenuGUI::Update()
1822
1821
m_pShopList->SetFocus ();
1823
1822
m_MenuFocus = ITEMS;
1824
1823
1825
- GUIListPanel::Item *pItem = m_pShopList->GetItem (m_CursorPos. m_X , m_CursorPos. m_Y );
1824
+ GUIListPanel::Item *pItem = m_pShopList->GetItem (mousePosX, mousePosY );
1826
1825
1827
1826
// If a module group list item, toggle its expansion and update the list
1828
1827
if (pItem && pItem->m_ExtraIndex >= 0 )
@@ -1920,7 +1919,7 @@ void BuyMenuGUI::Update()
1920
1919
m_MenuFocus = ITEMS;
1921
1920
1922
1921
// See if it's hovering over any item
1923
- GUIListPanel::Item *pItem = m_pShopList->GetItem (m_CursorPos. m_X , m_CursorPos. m_Y );
1922
+ GUIListPanel::Item *pItem = m_pShopList->GetItem (mousePosX, mousePosY );
1924
1923
if (pItem)
1925
1924
{
1926
1925
// Don't let mouse movement change the index if it's still hovering inside the same item.
@@ -1998,7 +1997,7 @@ void BuyMenuGUI::Update()
1998
1997
m_MenuFocus = ORDER;
1999
1998
2000
1999
// See if it's hovering over any item
2001
- GUIListPanel::Item *pItem = m_pCartList->GetItem (m_CursorPos. m_X , m_CursorPos. m_Y );
2000
+ GUIListPanel::Item *pItem = m_pCartList->GetItem (mousePosX, mousePosY );
2002
2001
if (pItem)
2003
2002
{
2004
2003
// Don't let mouse movement change the index if it's still hovering inside the same item.
@@ -2061,7 +2060,10 @@ void BuyMenuGUI::Draw(BITMAP *drawBitmap) const {
2061
2060
m_pGUIController->Draw (&drawScreen);
2062
2061
if (IsEnabled () && m_pController->IsMouseControlled ()) {
2063
2062
if (g_SettingsMan.FactionBuyMenuThemeCursorsDisabled ()) {
2064
- draw_sprite (drawBitmap, s_pCursor, m_CursorPos.GetFloorIntX (), m_CursorPos.GetFloorIntY ());
2063
+ int mousePosX;
2064
+ int mousePosY;
2065
+ m_pGUIInput->GetMousePosition (&mousePosX, &mousePosY);
2066
+ draw_sprite (drawBitmap, s_pCursor, mousePosX, mousePosY);
2065
2067
} else {
2066
2068
m_pGUIController->DrawMouse (&drawScreen);
2067
2069
}
0 commit comments