From 8a82802932fa368922073b543b1b59d2874f76a1 Mon Sep 17 00:00:00 2001 From: Flugente Date: Wed, 26 Jul 2017 13:57:29 +0000 Subject: [PATCH] - Fix: crash when handling flashing items - Fix: bad argument git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8433 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle Items.cpp | 23 +++++++++-------------- Tactical/Overhead.cpp | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 1e948e39..10f66227 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -89,7 +89,7 @@ #define NUM_ITEM_FLASH_SLOTS 50 #define MIN_LOB_RANGE 6 -// directory for fortification plans (locaed in Profiles sub-folder) +// directory for fortification plans (located in Profiles sub-folder) #define FORTIFICATIONPLAN_DIRECTORY "FortificationPlan\\" ITEM_POOL_LOCATOR FlashItemSlots[ NUM_ITEM_FLASH_SLOTS ]; @@ -4352,7 +4352,7 @@ BOOLEAN RemoveFlashItemSlot( ITEM_POOL *pItemPool ) CHECKF( pItemPool != NULL ); - for( uiCount=0; uiCount < guiNumFlashItemSlots; uiCount++) + for( uiCount=0; uiCount < guiNumFlashItemSlots; ++uiCount) { if ( FlashItemSlots[ uiCount ].fAllocated ) { @@ -4387,7 +4387,7 @@ void HandleFlashingItems( ) { RESETCOUNTER( CYCLERENDERITEMCOLOR ); - for ( cnt = 0; cnt < guiNumFlashItemSlots; cnt++ ) + for ( cnt = 0; cnt < guiNumFlashItemSlots; ++cnt ) { pLocator = &( FlashItemSlots[ cnt ] ); @@ -4414,9 +4414,7 @@ void HandleFlashingItems( ) // Update radio locator { - UINT32 uiClock; - - uiClock = GetJA2Clock( ); + UINT32 uiClock = GetJA2Clock( ); // Update frame values! if ( ( uiClock - pLocator->uiLastFrameUpdate ) > 80 ) @@ -4436,7 +4434,8 @@ void HandleFlashingItems( ) // UPDATE FLASH COLOR VALUE pItemPool->bFlashColor--; - if ( pItemPool->ubLevel == 0 ) + // Flugente: as someone commented out the changes to uiFlags, this part serves no purpose, so I'm commenting it out + /*if ( pItemPool->ubLevel == 0 ) { pObject = gpWorldLevelData[ pItemPool->sGridNo ].pStructHead; } @@ -4463,7 +4462,7 @@ void HandleFlashingItems( ) } pObject = pObject->pNext; - } + }*/ if ( pItemPool->bFlashColor == 1 ) { @@ -4479,9 +4478,7 @@ void HandleFlashingItems( ) } RecountFlashItemSlots( ); - } - } @@ -4491,7 +4488,7 @@ void RenderTopmostFlashingItems( ) ITEM_POOL *pItemPool; ITEM_POOL_LOCATOR *pLocator; - for ( cnt = 0; cnt < guiNumFlashItemSlots; cnt++ ) + for ( cnt = 0; cnt < guiNumFlashItemSlots; ++cnt ) { pLocator = &( FlashItemSlots[ cnt ] ); @@ -4546,12 +4543,10 @@ void RenderTopmostFlashingItems( ) BltVideoObjectFromIndex( FRAME_BUFFER, guiRADIO, pLocator->bRadioFrame, sXPos, sYPos, VO_BLT_SRCTRANSPARENCY, NULL ); DrawItemPoolList( pItemPool, pItemPool->sGridNo , ITEMLIST_DISPLAY, pItemPool->bRenderZHeightAboveLevel, sXPos, sYPos ); - } } } } - } @@ -5492,7 +5487,7 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue ) break; case 7: // test our disguise - if ( gpTempSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) ) + if (gpTempSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER)) gpTempSoldier->SpySelfTest(); break; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ee99d2d1..3e2227af 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -2964,7 +2964,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) } #ifdef LUA_OVERHEAD - LetLuaMyCustomHandleAtNewGridNo(NULL,pSoldier->ubProfile, 0); + LetLuaMyCustomHandleAtNewGridNo(0,pSoldier->ubProfile, 0); #else //----------------Lua------------------------