Resolved an inadvertent memory leak I put into the code while fixing a previous CTD.

Cleaned up the cursor graphics so that the cursor is properly updated when reloading stacks of weapons from the stack popup screen.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2058 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-04-21 06:39:01 +00:00
parent c9264b6101
commit ece7ec25bb
6 changed files with 40 additions and 35 deletions
+4 -4
View File
@@ -13,12 +13,12 @@
#ifdef JA2EDITOR
//MAP EDITOR BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.20469" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2058" };
#elif defined JA2BETAVERSION
//BETA/TEST BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2046" };
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2058" };
#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.2046" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.2058" };
#endif
CHAR8 czVersionNumber[16] = { "Build 08.04.18" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 08.04.20" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
@@ -826,16 +826,16 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
{
//CHRISL: Make it possible to right click and pull up stack popup and/or item description boxes
WORLDITEM * twItem = &(pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ]);
if ( !InSectorStackPopup( ) && !InItemStackPopup( ) && !InItemDescriptionBox( ) && !InKeyRingPopup( ) && twItem->object.exists() == true)
if ( !InSectorStackPopup( ) && !InItemStackPopup( ) && !InItemDescriptionBox( ) && !InKeyRingPopup( ) && twItem->object.exists() == true && (bSelectedInfoChar != -1 && gCharactersList[bSelectedInfoChar].fValid))
{
if(ItemSlotLimit( &twItem->object, STACK_SIZE_LIMIT ) == 1)
{
fShowInventoryFlag = TRUE;
MAPInternalInitItemDescriptionBox( &twItem->object, 0, 0 );
MAPInternalInitItemDescriptionBox( &twItem->object, 0, MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] );
}
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 ) );
InitSectorStackPopup( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID], twItem, iCounter, 0, INV_REGION_Y, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) );
fTeamPanelDirty=TRUE;
fInterfacePanelDirty = DIRTYLEVEL2;
}
+30 -20
View File
@@ -6163,7 +6163,7 @@ BOOLEAN InKeyRingPopup( )
return( gfInKeyRingPopup );
}
BOOLEAN InitSectorStackPopup( WORLDITEM *pInventoryPoolList, INT32 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight )
BOOLEAN InitSectorStackPopup( SOLDIERTYPE *pSoldier, WORLDITEM *pInventoryPoolList, INT32 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight )
{
VOBJECT_DESC VObjectDesc;
SGPRect aRect;
@@ -6184,6 +6184,8 @@ BOOLEAN InitSectorStackPopup( WORLDITEM *pInventoryPoolList, INT32 ubPosition, I
gsItemPopupInvY = sInvY;
gsItemPopupInvWidth = sInvWidth;
gsItemPopupInvHeight = sInvHeight;
// Set soldier
gpItemPopupSoldier = pSoldier;
// Determine # of items
gpItemPopupObject = &(pInventoryPoolList->object );
gubNumItemPopups = ItemSlotLimit( gpItemPopupObject, STACK_SIZE_LIMIT );
@@ -6225,10 +6227,10 @@ BOOLEAN InitSectorStackPopup( WORLDITEM *pInventoryPoolList, INT32 ubPosition, I
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 0, cnt );
//CHRISL: Include the pockets capacity as UserData 1
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 1, gubNumItemPopups );
//CHRISL: Let's also include the ubID for this merc as UserData so we can find the merc again if needed
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 2, pSoldier->ubID);
// Flag this as a sectory item
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 2, -1);
//CHRISL: Include the pocket we're looking at so we can display the right graphic
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 3, ubPosition);
MSYS_SetRegionUserData( &gItemPopupRegions[cnt], 3, -1);
//OK, for each item, set dirty text if applicable!
//CHRISL:
@@ -6458,7 +6460,8 @@ void RenderItemStackPopup( BOOLEAN fFullRender )
UINT32 cnt;
INT16 sX, sY, sNewX, sNewY;
INT16 sItemWidth = 0, sOffSetY = 0, sWidth = 29;
UINT8 ubPosition, image = 0;
INT8 ubPosition;
UINT8 image = 0;
int sID;
// CHRISL: Setup witdh and offset to layer inventory boxes if necessary
@@ -6498,9 +6501,9 @@ void RenderItemStackPopup( BOOLEAN fFullRender )
usWidth = (UINT32)pTrav->usWidth;
//CHRISL: resize usPopupWidth based on popup stack location
if(UsingNewInventorySystem() == true || sID == -1)
if(UsingNewInventorySystem() == true || ubPosition == -1)
{
if(sID == -1 || (ubPosition >=BIGPOCKSTART && ubPosition < BIGPOCKFINAL) || (gGameExternalOptions.fVehicleInventory && (MercPtrs[sID]->flags.uiStatusFlags & SOLDIER_VEHICLE)))
if(ubPosition == -1 || (ubPosition >=BIGPOCKSTART && ubPosition < BIGPOCKFINAL) || (gGameExternalOptions.fVehicleInventory && (MercPtrs[sID]->flags.uiStatusFlags & SOLDIER_VEHICLE)))
{
if(guiCurrentScreen != MAP_SCREEN)
sItemWidth -= 2;
@@ -7074,7 +7077,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason )
//If one in our hand, place it
if ( gpItemPointer != NULL )
{
if ( !PlaceObjectAtObjectIndex( gpItemPointer, gpItemPopupObject, (UINT8)uiItemPos, iItemCap ) )
if ( !PlaceObjectAtObjectIndex( gpItemPointer, gpItemPopupObject, (UINT8)uiItemPos, iItemCap ) || gpItemPointer->ubNumberOfObjects == 0 )
{
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
{
@@ -7096,6 +7099,23 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason )
// re-evaluate repairs
gfReEvaluateEveryonesNothingToDo = TRUE;
}
else
{
guiExternVo = GetInterfaceGraphicForItem( &(Item[ gpItemPointer->usItem ]) );
gusExternVoSubIndex = Item[ gpItemPointer->usItem ].ubGraphicNum;
MSYS_ChangeRegionCursor( &gMPanelRegion , EXTERN_CURSOR );
MSYS_SetCurrentCursor( EXTERN_CURSOR );
fMapInventoryItem=TRUE;
fTeamPanelDirty=TRUE;
// remember which gridno the object came from
sObjectSourceGridNo = MercPtrs[ubID]->sGridNo;
// and who owned it last
gpItemPointerSoldier = MercPtrs[ubID];
ReevaluateItemHatches( MercPtrs[ubID], FALSE );
}
//Dirty interface
//fInterfacePanelDirty = DIRTYLEVEL2;
@@ -7111,18 +7131,8 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason )
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
{
// pick it up
if(ubID != -1)
{
gpItemPopupObject->RemoveObjectAtIndex( uiItemPos, &gItemPointer );
InternalMAPBeginItemPointer( gpItemPopupSoldier );
}
else
{
OBJECTTYPE tSectorItem;
gpItemPopupObject->RemoveObjectAtIndex( uiItemPos, &tSectorItem );
BeginInventoryPoolPtr(&tSectorItem);
guiCurrentItemDescriptionScreen = MAP_SCREEN;
}
gpItemPopupObject->RemoveObjectAtIndex( uiItemPos, &gItemPointer );
InternalMAPBeginItemPointer( gpItemPopupSoldier );
}
else
{
+1 -1
View File
@@ -141,7 +141,7 @@ void DeleteItemDescriptionBox( );
BOOLEAN InItemStackPopup( );
BOOLEAN InitItemStackPopup( SOLDIERTYPE *pSoldier, UINT8 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight );
BOOLEAN InSectorStackPopup( );
BOOLEAN InitSectorStackPopup( WORLDITEM *pInventoryPoolList, INT32 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight );
BOOLEAN InitSectorStackPopup( SOLDIERTYPE *pSoldier, WORLDITEM *pInventoryPoolList, INT32 ubPosition, INT16 sInvX, INT16 sInvY, INT16 sInvWidth, INT16 sInvHeight );
void RenderItemStackPopup( BOOLEAN fFullRender );
void HandleItemStackPopup( );
void DeleteItemStackPopup( );
-5
View File
@@ -2850,11 +2850,6 @@ 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
+2 -2
View File
@@ -66,7 +66,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_deb_en_2046.exe"
OutputFile="$(OutDir)\ja2_deb_en_2058.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
@@ -145,7 +145,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_rel_en_2046.exe"
OutputFile="$(OutDir)\ja2_rel_en_2058.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"