From 61d6152ce584011b6cc6ce2d28c5201b76e31708 Mon Sep 17 00:00:00 2001 From: lalien Date: Tue, 8 May 2007 22:44:08 +0000 Subject: [PATCH] bug fixes from Overhaul: - Disappearing corpses (and possibly items) when cursor hovers over a square on the rooftop; also fixes a "write to freed memory" heap check - Fixed improper printf field in a debug message git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@870 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 2 +- JA2.suo | Bin 197632 -> 197632 bytes JA2.vcproj | 2 +- Laptop/IMP Begin Screen.cpp | 36 +++++++++++++++---------------- Laptop/files.cpp | 2 +- Tactical/Points.cpp | 2 +- Tactical/Rotting Corpses.cpp | 17 ++++++++------- Tactical/Soldier Ani.cpp | 2 +- Tactical/Weapons.cpp | 2 +- Tactical/opplist.cpp | 2 +- TileEngine/Explosion Control.cpp | 4 ++-- Utils/PopUpBox.cpp | 6 +++--- Utils/Text Input.cpp | 2 +- Utils/message.cpp | 2 +- 14 files changed, 41 insertions(+), 40 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index ca7b5659..5f17dfa8 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -23,7 +23,7 @@ wchar_t zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - wchar_t zVersionLabel[256] = { L"Release v1.13.868" }; + wchar_t zVersionLabel[256] = { L"Release v1.13.870" }; #endif diff --git a/JA2.suo b/JA2.suo index 7bed14d76abf02443183969e4b9fa2d06ae12a15..b1c4d602d98b7416d39cd06eeede6929921a81b0 100644 GIT binary patch delta 333 zcmZqZ;A!aK*^tA+%JB93>w}vMSuU~jGV(DnF#Lyt$$=ayn@f0HnOL&L7#JouP8Jnr zV3^GTRFTDy$Y2Dd7lXtf&J-wK-C}vihw-n%_;ox%)AV;KsLxMkh{Q+`XUs- z$ioX1;YJdjTp|)M*@f3&@)r^R$rPfT4sTA4oDVWKUM)m#|sP17wB*1v43P z7>a>xX(1pH0#um{7EA`Ra)2VMK?b-oqyW`{3@8Hff;Xq|$1_iMUSPQSi%O5Ds2sfiFM- oek6g-C8w`AaL6KwY%k$q{J4O%gLi>VM|;*<#_d^anWlvS04ud|9RL6T diff --git a/JA2.vcproj b/JA2.vcproj index 4b80f8ad..73561fab 100644 --- a/JA2.vcproj +++ b/JA2.vcproj @@ -546,7 +546,7 @@ pString = (STR16) MemAlloc( ( wcslen( pString ) * 2 ) + 2 ); + pFileString-> pString = (STR16) MemAlloc( ( wcslen( pString ) * sizeof(CHAR16) ) + 2 ); wcscpy( pFileString->pString, pString ); pFileString->pString[ wcslen( pString ) ] = 0; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 1a7783ba..a97ea2c1 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -2146,7 +2146,7 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos else { #ifdef JA2TESTVERSION - ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %s", usInHand ); + ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %d", usInHand ); #endif return(0); } diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index b2a91314..1e297625 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -186,13 +186,14 @@ CHAR8 zNoBloodCorpseFilenames[ NUM_CORPSES ][70] = UINT8 gb4DirectionsFrom8[8] = { - 7, // NORTH +// 7, // NORTH + 0, 0, // NE - 0, // E + 1, // E 0, // SE - 1, // S + 2, // S 0, // SW, - 2, // W, + 3, // W, 0 // NW }; @@ -419,10 +420,10 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor // OK , these have 4 directions.... bDirection = gb4DirectionsFrom8[ pCorpseDef->bDirection ]; - if ( fForImage ) - { - bDirection = gOneCDirection[ bDirection ]; - } +// if ( fForImage ) +// { +// bDirection = gOneCDirection[ bDirection ]; +// } break; default: diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index b6ccf711..b303ab8c 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -2485,7 +2485,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // ATE: Here, reduce again if creaturequeen tentical attack... if ( pSoldier->usAnimState == QUEEN_SWIPE ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count for end of queen swipe" ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count for end of queen swipe\n" ) ); ReduceAttackBusyCount( (UINT8) pSoldier->ubID, FALSE ); } break; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 8fbe3ba3..eb3946c6 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1512,7 +1512,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ) UINT16 usItemNum; BOOLEAN fBuckshot; UINT8 ubVolume; - INT8 zBurstString[50]; + INT8 zBurstString[512]; UINT8 ubDirection; INT16 sNewGridNo; UINT8 ubMerc; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 28364769..29fd6568 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1561,7 +1561,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT { // if neither side is neutral AND // if this soldier is an opponent (fights for different side) - if (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide)) + if (pSoldier->bActive && pOpponent->bActive && !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide)) { RemoveOneOpponent(pSoldier); } diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 1e8aff30..c61b6883 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1224,10 +1224,10 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE sBaseGridNo = pBaseStructure->sGridNo; ubNumberOfTiles = pBaseStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles; fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 ); - ppTile = (DB_STRUCTURE_TILE **) MemAlloc( sizeof( DB_STRUCTURE_TILE ) * ubNumberOfTiles ); + ppTile = (DB_STRUCTURE_TILE **) MemAlloc( sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles ); // Lesh: CTD was in next line once - memcpy( ppTile, pBaseStructure->pDBStructureRef->ppTile, sizeof( DB_STRUCTURE_TILE ) * ubNumberOfTiles ); + memcpy( ppTile, pBaseStructure->pDBStructureRef->ppTile, sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles ); if ( bMultiStructSpecialFlag == -1 ) { diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index 61bb0383..bfd54bc7 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -393,7 +393,7 @@ void AddMonoString(UINT32 *hStringHandle, STR16 pString) if (pStringSt == NULL) return; - pLocalString=(STR16)(MemAlloc(wcslen(pString)*2+2)); + pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); if (pLocalString == NULL) return; @@ -443,7 +443,7 @@ void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) if (pStringSt == NULL) return; - pLocalString=(STR16)(MemAlloc(wcslen(pString)*2+2)); + pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); if (pLocalString == NULL) return; @@ -490,7 +490,7 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) if (pStringSt == NULL) return; - pLocalString=(STR16)(MemAlloc(wcslen(pString)*2+2)); + pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); if (pLocalString == NULL) return; diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 3401a95f..127f294f 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -1579,7 +1579,7 @@ void ExecuteCopyCommand() ubEnd = gubStartHilite; } ubCount = (UINT8)(ubEnd - ubStart); - szClipboard = (UINT16*)MemAlloc( ( ubCount + 1 ) * 2 ); + szClipboard = (UINT16*)MemAlloc( ( ubCount + 1 ) * sizeof(CHAR16) ); Assert( szClipboard ); for( ubCount = ubStart; ubCount < ubEnd; ubCount++ ) { diff --git a/Utils/message.cpp b/Utils/message.cpp index 67f78d44..ed6f5cf8 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -170,7 +170,7 @@ ScrollStringStPtr AddString(STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEA void SetString(ScrollStringStPtr pStringSt, STR16 pString) { // ARM: Why x2 + 4 ??? - pStringSt->pString16=(STR16)MemAlloc((wcslen(pString)*2)+4); + pStringSt->pString16=(STR16)MemAlloc((wcslen(pString)+2)*sizeof(CHAR16)); wcsncpy(pStringSt->pString16, pString, wcslen(pString)); pStringSt->pString16[wcslen(pString)]=0; }