From 2c9469cbc23693acfa3704bcfe69e2748dad71f5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 6 May 2026 23:21:32 +0300 Subject: [PATCH 1/2] Fix crash when failing an attachment via item desc popup callback --- Tactical/Interface Items.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 532c288a5..0ea590819 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -643,7 +643,7 @@ void popupCallbackItem(INT16 itemId){ i++;p++; } - OBJECTTYPE pObjTmp; + static OBJECTTYPE pObjTmp; pObjTmp.initialize(); if( bestStack->RemoveObjectAtIndex(leastDamagedIndex, &pObjTmp) ){ From 10400ba451810b1f5ee38d02b4acf2687503a80c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 6 May 2026 23:22:07 +0300 Subject: [PATCH 2/2] Change mouse cursor if attachment attempt fails --- Tactical/Interface Items.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 0ea590819..4f3eb2377 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -649,7 +649,23 @@ void popupCallbackItem(INT16 itemId){ if( bestStack->RemoveObjectAtIndex(leastDamagedIndex, &pObjTmp) ){ gpItemPointer = &pObjTmp; // pick up the object (or stack) DoAttachment((UINT8)gubPopupStatusIndex, guiPopupItemPos); // try to attach it - //gpItemPointer = NULL; // dont drop it! + + // If attaching failed, change mouse cursor to item as we're still holding it + if ( gpItemPointer->exists() ) { + // Set mouse + guiExternVo = GetInterfaceGraphicForItem(&(Item[gpItemPointer->usItem])); + gusExternVoSubIndex = Item[gpItemPointer->usItem].ubGraphicNum; + + MSYS_ChangeRegionCursor(&gMPanelRegion, EXTERN_CURSOR); + MSYS_SetCurrentCursor(EXTERN_CURSOR); + fMapInventoryItem = TRUE; + fTeamPanelDirty = TRUE; + + //Dirty interface + fInterfacePanelDirty = DIRTYLEVEL2; + + UpdateItemHatches(); + } gItemDescAttachmentPopups[giActiveAttachmentPopup]->hide(); RenderItemDescriptionBox();