From 1aea5efd1b714ab0ba53bca551087a23823c963f Mon Sep 17 00:00:00 2001 From: Wanne Date: Sat, 30 Mar 2013 12:53:22 +0000 Subject: [PATCH] Editor Fixes (by Buggler) - Fixed unable to delete items in Merc Inventory Display screen - Added keyboard hotkey item scrolling in Merc Inventory Selection screen git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5965 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/editscreen.cpp | 16 ++++++++-------- Tactical/Items.cpp | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 10ef0af9..dc16bc35 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -2054,7 +2054,7 @@ void HandleKeyboardShortcuts( ) break; case ',': // item left scroll - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex ) { @@ -2080,7 +2080,7 @@ void HandleKeyboardShortcuts( ) break; case '.': // item right scroll - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) { @@ -2105,7 +2105,7 @@ void HandleKeyboardShortcuts( ) break; case '<': // item left scroll by page - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex ) { @@ -2124,7 +2124,7 @@ void HandleKeyboardShortcuts( ) break; case '>': // item right scroll by page - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) { @@ -2176,7 +2176,7 @@ void HandleKeyboardShortcuts( ) { case ',': // item left scroll - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex ) { @@ -2195,7 +2195,7 @@ void HandleKeyboardShortcuts( ) break; case '.': // item right scroll - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) { @@ -2213,7 +2213,7 @@ void HandleKeyboardShortcuts( ) break; case '<': // item left scroll by page - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex ) { @@ -2229,7 +2229,7 @@ void HandleKeyboardShortcuts( ) break; case '>': // item right scroll by page - if( iCurrentTaskbar == TASK_ITEMS ) + if( iCurrentTaskbar == TASK_ITEMS || gubCurrMercMode == MERC_GETITEMMODE ) { if( eInfo.sScrollIndex < max( ((eInfo.sNumItems+1)/2)-6, 0) ) { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index f4e449c4..b2a46ab1 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -7677,12 +7677,20 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) if ( GetItemFromRandomItem(usItem, &newitemfromrandom) ) usItem = newitemfromrandom; +#ifdef JA2EDITOR + + // Buggler: usItem == 0 is technically an item too, so need to run code to delete existing item in editor/merc inventory mode + +#else //non-editor version + if (usItem == 0) { DebugBreakpoint(); return( FALSE ); } +#endif + if (Item[ usItem ].usItemClass == IC_GUN) { fRet = CreateGun( usItem, bStatus, pObj );