From 8505cd45cd6a7852b28120d87503582afca63745 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Tue, 6 Jan 2009 16:33:16 +0000 Subject: [PATCH] Fixed a crash/freeze that could occur when trying to Sell All or Delete All items while the item description box was open. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2471 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/mapscreen.cpp | 48 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 53e2f7eb9..29dc5db18 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -1069,7 +1069,7 @@ void BeginSellAllCallBack( UINT8 bExitValue ) if( bExitValue == MSG_BOX_RETURN_YES ) { fRestoreBackgroundForMessageBox = TRUE; - if ( gpItemPointer != NULL ) + if ( gpItemPointer != NULL || InSectorStackPopup( ) || InItemStackPopup( ) || InItemDescriptionBox( ) || InKeyRingPopup( ) ) { return; } @@ -1107,7 +1107,7 @@ void BeginDeleteAllCallBack( UINT8 bExitValue ) if( bExitValue == MSG_BOX_RETURN_YES ) { fRestoreBackgroundForMessageBox = TRUE; - if ( gpItemPointer != NULL ) + if ( gpItemPointer != NULL || InSectorStackPopup( ) || InItemStackPopup( ) || InItemDescriptionBox( ) || InKeyRingPopup( ) ) { return; } @@ -6272,16 +6272,19 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case 'D': if( fCtrl ) { - //CHRISL: Delete all items - if(!fShowMapInventoryPool) + if ( !InSectorStackPopup( ) && !InItemStackPopup( ) && !InItemDescriptionBox( ) && !InKeyRingPopup( ) ) { - fShowMapInventoryPool = TRUE; - CreateDestroyMapInventoryPoolButtons( TRUE ); - } - DoMessageBox( MSG_BOX_BASIC_STYLE, NewInvMessage[NIV_DELETE_ALL], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, BeginDeleteAllCallBack, NULL ); - if(fShowMapInventoryPool) - { - fShowMapInventoryPool = FALSE; + //CHRISL: Delete all items + if(!fShowMapInventoryPool) + { + fShowMapInventoryPool = TRUE; + CreateDestroyMapInventoryPoolButtons( TRUE ); + } + DoMessageBox( MSG_BOX_BASIC_STYLE, NewInvMessage[NIV_DELETE_ALL], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, BeginDeleteAllCallBack, NULL ); + if(fShowMapInventoryPool) + { + fShowMapInventoryPool = FALSE; + } } } break; @@ -6625,18 +6628,21 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case 'S': if( fCtrl ) { - //CHRISL: Sell all items - if(gGameExternalOptions.fSellAll == TRUE) + if ( !InSectorStackPopup( ) && !InItemStackPopup( ) && !InItemDescriptionBox( ) && !InKeyRingPopup( ) ) { - if(!fShowMapInventoryPool) + //CHRISL: Sell all items + if(gGameExternalOptions.fSellAll == TRUE) { - fShowMapInventoryPool = TRUE; - CreateDestroyMapInventoryPoolButtons( TRUE ); - } - DoMessageBox( MSG_BOX_BASIC_STYLE, NewInvMessage[NIV_SELL_ALL], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, BeginSellAllCallBack, NULL ); - if(fShowMapInventoryPool) - { - fShowMapInventoryPool = FALSE; + if(!fShowMapInventoryPool) + { + fShowMapInventoryPool = TRUE; + CreateDestroyMapInventoryPoolButtons( TRUE ); + } + DoMessageBox( MSG_BOX_BASIC_STYLE, NewInvMessage[NIV_SELL_ALL], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, BeginSellAllCallBack, NULL ); + if(fShowMapInventoryPool) + { + fShowMapInventoryPool = FALSE; + } } } }