From 4f120f152f9df3a1890e8e21becc578d4e3d5e54 Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 24 Apr 2012 14:42:59 +0000 Subject: [PATCH] - Bugfix: Fixed crash when showing attachment slots in EDB (strategy) and left clicking on a attachment slot (for non weapons) o This bug was introduced when merging HAM 5 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5224 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index b4b3fcc1..f6743bc3 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -607,15 +607,21 @@ bool popupCallbackItemInSector(INT16 itemId){ void hideAttachmentPopup(){ giActiveAttachmentPopup = -1; - if (giInvDescTabButton[0] != giItemDescAmmoButton) - ShowButton(giItemDescAmmoButton); + if (giItemDescAmmoButton > -1) + { + if (giInvDescTabButton[0] != giItemDescAmmoButton) + ShowButton(giItemDescAmmoButton); + } } void hideOtherAttachmentPopups(UINT32 cnt){ // if there's a bullet icon, hide it. It tends to overlap my popup boxes - if (giInvDescTabButton[0] != giItemDescAmmoButton) - HideButton(giItemDescAmmoButton); + if (giItemDescAmmoButton != -1) + { + if (giInvDescTabButton[0] != giItemDescAmmoButton) + HideButton(giItemDescAmmoButton); + } RenderItemDescriptionBox(); // also, redraw the IDB to clean up helptext @@ -11915,7 +11921,7 @@ void ItemDescTabButtonCallback( GUI_BUTTON *btn, INT32 reason ) InternalInitEDBTooltipRegion( gpItemDescObject, guiCurrentItemDescriptionScreen ); RenderItemDescriptionBox(); - if (giItemDescAmmoButton != -1) + if (giItemDescAmmoButton > -1) MarkAButtonDirty( giItemDescAmmoButton ); // Required for tactical screen ItemDescTabButtonOn( 0 ); @@ -11927,7 +11933,7 @@ void ItemDescTabButtonCallback( GUI_BUTTON *btn, INT32 reason ) InternalInitEDBTooltipRegion( gpItemDescObject, guiCurrentItemDescriptionScreen ); RenderItemDescriptionBox(); - if (giItemDescAmmoButton != -1) + if (giItemDescAmmoButton > -1) MarkAButtonDirty( giItemDescAmmoButton ); // Required for tactical screen ItemDescTabButtonOff( 0 ); @@ -11939,7 +11945,7 @@ void ItemDescTabButtonCallback( GUI_BUTTON *btn, INT32 reason ) InternalInitEDBTooltipRegion( gpItemDescObject, guiCurrentItemDescriptionScreen ); RenderItemDescriptionBox(); - if (giItemDescAmmoButton != -1) + if (giItemDescAmmoButton > -1) MarkAButtonDirty( giItemDescAmmoButton ); // Required for tactical screen ItemDescTabButtonOff( 0 ); @@ -11994,7 +12000,10 @@ void ItemDescAdvButtonCallback( GUI_BUTTON *btn, INT32 reason ) InternalInitEDBTooltipRegion( gpItemDescObject, guiCurrentItemDescriptionScreen ); RenderItemDescriptionBox(); // Required for tactical screen - MarkAButtonDirty( giItemDescAmmoButton ); + + if (giItemDescAmmoButton > -1) + MarkAButtonDirty( giItemDescAmmoButton ); + for (INT8 x = 0; x < 3; x++) { if (giInvDescTabButton[x] != -1) @@ -12012,7 +12021,9 @@ void ItemDescAdvButtonCallback( GUI_BUTTON *btn, INT32 reason ) InternalInitEDBTooltipRegion( gpItemDescObject, guiCurrentItemDescriptionScreen ); RenderItemDescriptionBox(); // Required for tactical screen - MarkAButtonDirty( giItemDescAmmoButton ); + if (giItemDescAmmoButton > -1) + MarkAButtonDirty( giItemDescAmmoButton ); + for (INT8 x = 0; x < 3; x++) { if (giInvDescTabButton[x] != -1)