From 33a9f177608e87909f7929d9df355722b333449a Mon Sep 17 00:00:00 2001 From: ChrisL Date: Fri, 17 Oct 2008 15:56:58 +0000 Subject: [PATCH] Bugfix to resolve an assertion error relating to the helicopter. Change to BobbyRays information as proposed by Headrock. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2379 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/BobbyRGuns.cpp | 39 +++++++++++++++++++++++++++++++++++--- Strategic/strategicmap.cpp | 4 ++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 3014f9718..b2b8dffe5 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -19,6 +19,7 @@ #include "Text.h" #include "Weapons.h" #include "GameSettings.h" + #include "Points.h" #endif @@ -2393,9 +2394,39 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum //Info for weapons //if ( Item[ pItemNumbers[ i ] ].usItemClass == IC_GUN ) { - UINT16 gunDamage = (UINT16)( Weapon[ pItemNumbers[ i ] ].ubImpact + ( (double) Weapon[ pItemNumbers[ i ] ].ubImpact / 100) * gGameExternalOptions.ubGunDamageMultiplier ); + UINT16 gunDamage = (UINT16)( Weapon[ pItemNumbers[ i ] ].ubImpact + ( (double) Weapon[ pItemNumbers[ i ] ].ubImpact / 100) * gGameExternalOptions.ubGunDamageMultiplier ); + UINT16 readyAPs = (UINT16)(( Weapon[ pItemNumbers[ i ] ].ubReadyTime * (100 - Item[ pItemNumbers[ i ] ].percentreadytimeapreduction)) / 100); - swprintf( pStr, L"%s (%s)\n%s %d\n%s %d\n%s %d\n%s %s\n%s %1.1f %s", + //Calculate AP's + CHAR16 apStr[20]; + CHAR16 apStr2[20]; + OBJECTTYPE pObject; + + CreateItem(pItemNumbers[ i ], 100, &pObject); + UINT8 ubAttackAPs = BaseAPsToShootOrStab( DEFAULT_APS, DEFAULT_AIMSKILL, &pObject ); + + if ( Weapon[ pItemNumbers[ i ] ].NoSemiAuto ) + swprintf( apStr, L"-" ); + else + swprintf( apStr, L"%d", ubAttackAPs ); + + if (GetShotsPerBurst(&pObject) > 0) + { + swprintf( apStr2, L" / %d", ubAttackAPs + CalcAPsToBurst( DEFAULT_APS, &pObject ) ); + wcscat( apStr, apStr2 ); + } + else + wcscat( apStr, L" / -" ); + + if (GetAutofireShotsPerFiveAPs(&pObject) > 0) + { + swprintf( apStr2, L" / %d", ubAttackAPs + CalcAPsToAutofire( DEFAULT_APS, &pObject, 3 ) ); + wcscat( apStr, apStr2 ); + } + else + wcscat( apStr, L" / -" ); + + swprintf( pStr, L"%s (%s)\n%s %d\n%s %d\n%s %d\n%s (%d) %s\n%s %1.1f %s", ItemNames[ pItemNumbers[ i ] ], AmmoCaliber[ Weapon[ pItemNumbers[ i ] ].ubCalibre ], gWeaponStatsDesc[ 9 ], //Accuracy String @@ -2405,7 +2436,9 @@ void CreateMouseRegionForBigImage( UINT16 usPosY, UINT8 ubCount, INT16 *pItemNum gWeaponStatsDesc[ 10 ], //Range String gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? Weapon[ pItemNumbers[ i ] ].usRange/10 : Weapon[ pItemNumbers[ i ] ].usRange, //Gun Range gWeaponStatsDesc[ 5 ], //AP String - //apStr, //AP's + //"\n", + readyAPs, + apStr, //AP's L"- / - / -", gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 992440f3a..9cbd41e57 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1778,7 +1778,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) //CHRISL: We should only bother with this assertion if the soldier is alive. Dead soliders are moved to // GridNo = NOWHERE, which causes this assertion to fail if(!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD)) - Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE ); + Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); } if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && @@ -1820,7 +1820,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) //CHRISL: We should only bother with this assertion if the soldier is alive. Dead soliders are moved to // GridNo = NOWHERE, which causes this assertion to fail if(!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD)) - Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); + Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); } return( TRUE );