Fixed a CTD that occured when reloading a weapon from the sector inventory panel.

Fixed the sector inventory panel so that you could reload weapons that could be stacked.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2046 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-04-18 22:41:09 +00:00
parent 38ee990e9f
commit 896891431d
4 changed files with 18 additions and 7 deletions
+4 -4
View File
@@ -13,12 +13,12 @@
#ifdef JA2EDITOR
//MAP EDITOR BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2039" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.20469" };
#elif defined JA2BETAVERSION
//BETA/TEST BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2039" };
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2046" };
#elif defined CRIPPLED_VERSION
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else
//RELEASE BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Release v1.13.2039" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.2046" };
#endif
CHAR8 czVersionNumber[16] = { "Build 08.04.17" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 08.04.18" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
@@ -833,7 +833,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
fShowInventoryFlag = TRUE;
MAPInternalInitItemDescriptionBox( &twItem->object, 0, 0 );
}
else if(gpItemPointer == NULL || gpItemPointer->usItem == twItem->object.usItem || ValidAttachment(gpItemPointer->usItem, twItem->object.usItem) == TRUE)
else if(gpItemPointer == NULL || gpItemPointer->usItem == twItem->object.usItem || ValidAttachment(gpItemPointer->usItem, twItem->object.usItem) == TRUE || ValidAmmoType(twItem->object.usItem, gpItemPointer->usItem) == TRUE)
{
InitSectorStackPopup( twItem, iCounter, 0, INV_REGION_Y, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) );
fTeamPanelDirty=TRUE;
+11
View File
@@ -2850,6 +2850,11 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo
bAPs = 0;
//CHRISL: If we enter here from the sector inventory panel, we won't have soldier info. So setup a blank soldier to
// avoid a crash later in the code.
if(pSoldier == NULL)
pSoldier = new SOLDIERTYPE;
if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
{
//CHRISL: Alter this so we treat clip fed weapons differently from weapons that load with loose rounds
@@ -2926,6 +2931,12 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo
}
}
//CHRISL: We need to verify that the passed subObject actually exists. We could get passed an empty subObject if we
// reload a stack of weapons from the stack popup. If this is the case, reset subObject to the last item in the
// stack
if(subObject >= pGun->ubNumberOfObjects)
subObject = ammoObject = pGun->ubNumberOfObjects-1;
//CHRISL: If reloading with a stack, we probably want the item with the most ammo still in it
if (fReloadingWithStack)
{
+2 -2
View File
@@ -66,7 +66,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_deb_en_2039.exe"
OutputFile="$(OutDir)\ja2_deb_en_2046.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
@@ -145,7 +145,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_rel_en_2039.exe"
OutputFile="$(OutDir)\ja2_rel_en_2046.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"