mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- fixed some variables not being initialized
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1089 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2424,6 +2424,8 @@ BOOLEAN NewWayOfLoadingBobbyRMailOrdersToSaveGameFile( HWFILE hFile )
|
|||||||
{
|
{
|
||||||
//Allocate memory for the list
|
//Allocate memory for the list
|
||||||
gpNewBobbyrShipments = (NewBobbyRayOrderStruct *) MemAlloc( sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment );
|
gpNewBobbyrShipments = (NewBobbyRayOrderStruct *) MemAlloc( sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment );
|
||||||
|
memset(gpNewBobbyrShipments, 0, (sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment) );
|
||||||
|
|
||||||
if( gpNewBobbyrShipments == NULL )
|
if( gpNewBobbyrShipments == NULL )
|
||||||
{
|
{
|
||||||
Assert(0);
|
Assert(0);
|
||||||
|
|||||||
@@ -777,6 +777,7 @@ void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject,
|
|||||||
|
|
||||||
// add new element onto list
|
// add new element onto list
|
||||||
pTempEmail = (EmailPtr) MemAlloc(sizeof(Email));
|
pTempEmail = (EmailPtr) MemAlloc(sizeof(Email));
|
||||||
|
memset( pTempEmail, 0, sizeof(Email) );
|
||||||
// add in strings
|
// add in strings
|
||||||
//while(pMessage !=NULL)
|
//while(pMessage !=NULL)
|
||||||
//{
|
//{
|
||||||
|
|||||||
+3
-1
@@ -3495,7 +3495,7 @@ BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile )
|
|||||||
FileClose( hSrcFile );
|
FileClose( hSrcFile );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
memset( pData, 0, uiFileSize);
|
||||||
|
|
||||||
// Read into the buffer
|
// Read into the buffer
|
||||||
FileRead( hFile, pData, uiFileSize, &uiNumBytesRead );
|
FileRead( hFile, pData, uiFileSize, &uiNumBytesRead );
|
||||||
@@ -5409,6 +5409,8 @@ void HandleOldBobbyRMailOrders()
|
|||||||
Assert(0);
|
Assert(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset( gpNewBobbyrShipments, 0, (sizeof( NewBobbyRayOrderStruct )* LaptopSaveInfo.usNumberOfBobbyRayOrderUsed) );
|
||||||
|
|
||||||
giNumberOfNewBobbyRShipment = LaptopSaveInfo.usNumberOfBobbyRayOrderUsed;
|
giNumberOfNewBobbyRShipment = LaptopSaveInfo.usNumberOfBobbyRayOrderUsed;
|
||||||
|
|
||||||
|
|||||||
@@ -1578,6 +1578,8 @@ INT32 CreateIconButton(INT16 Icon,INT16 IconIndex,INT16 GenImg,INT16 xloc,INT16
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(b, 0, sizeof(GUI_BUTTON));
|
||||||
|
|
||||||
// Init the values in the struct
|
// Init the values in the struct
|
||||||
b->uiFlags = BUTTON_DIRTY;
|
b->uiFlags = BUTTON_DIRTY;
|
||||||
b->uiOldFlags = 0;
|
b->uiOldFlags = 0;
|
||||||
@@ -1706,6 +1708,8 @@ INT32 CreateTextButton(STR16 string, UINT32 uiFont, INT16 sForeColor, INT16 sSha
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(b, 0, sizeof(GUI_BUTTON));
|
||||||
|
|
||||||
// Allocate memory for the button's text string...
|
// Allocate memory for the button's text string...
|
||||||
b->string = NULL;
|
b->string = NULL;
|
||||||
if ( string && wcslen( string ) )
|
if ( string && wcslen( string ) )
|
||||||
@@ -1836,6 +1840,8 @@ INT32 CreateHotSpot(INT16 xloc, INT16 yloc, INT16 Width, INT16 Height,INT16 Prio
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(b, 0, sizeof(GUI_BUTTON));
|
||||||
|
|
||||||
// Init the structure values
|
// Init the structure values
|
||||||
b->uiFlags = 0;
|
b->uiFlags = 0;
|
||||||
b->uiOldFlags = 0;
|
b->uiOldFlags = 0;
|
||||||
@@ -1955,6 +1961,8 @@ INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Prio
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(b, 0, sizeof(GUI_BUTTON));
|
||||||
|
|
||||||
// Set the values for this buttn
|
// Set the values for this buttn
|
||||||
b->uiFlags = BUTTON_DIRTY;
|
b->uiFlags = BUTTON_DIRTY;
|
||||||
b->uiOldFlags = 0;
|
b->uiOldFlags = 0;
|
||||||
@@ -2149,6 +2157,8 @@ INT32 CreateIconAndTextButton( INT32 Image, const STR16 string, UINT32 uiFont,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(b, 0, sizeof(GUI_BUTTON));
|
||||||
|
|
||||||
// Set the values for this button
|
// Set the values for this button
|
||||||
b->uiFlags = BUTTON_DIRTY;
|
b->uiFlags = BUTTON_DIRTY;
|
||||||
b->uiOldFlags = 0;
|
b->uiOldFlags = 0;
|
||||||
|
|||||||
@@ -1283,6 +1283,8 @@ FontTranslationTable *CreateEnglishTransTable( )
|
|||||||
UINT16 *temp;
|
UINT16 *temp;
|
||||||
|
|
||||||
pTable = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable));
|
pTable = (FontTranslationTable *)MemAlloc(sizeof(FontTranslationTable));
|
||||||
|
memset(pTable, 0, sizeof(FontTranslationTable) );
|
||||||
|
|
||||||
#ifdef JA2
|
#ifdef JA2
|
||||||
// ha ha, we have more than Wizardry now (again)
|
// ha ha, we have more than Wizardry now (again)
|
||||||
pTable->usNumberOfSymbols = 255;
|
pTable->usNumberOfSymbols = 255;
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ BOOLEAN Copy8BPPCompressedImageTo8BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UINT
|
|||||||
// Allocate memory for one scanline
|
// Allocate memory for one scanline
|
||||||
pScanLine = (UINT8*) MemAlloc( hImage->usWidth );
|
pScanLine = (UINT8*) MemAlloc( hImage->usWidth );
|
||||||
CHECKF( pScanLine );
|
CHECKF( pScanLine );
|
||||||
|
memset( pScanLine, 0, hImage->usWidth );
|
||||||
|
|
||||||
// go past all the scanlines we don't need to process
|
// go past all the scanlines we don't need to process
|
||||||
for (uiCnt = 0; uiCnt < (UINT32) srcRect->iTop; uiCnt++)
|
for (uiCnt = 0; uiCnt < (UINT32) srcRect->iTop; uiCnt++)
|
||||||
@@ -436,6 +437,7 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN
|
|||||||
// Allocate memory for one scanline
|
// Allocate memory for one scanline
|
||||||
pScanLine = MemAlloc( hImage->usWidth );
|
pScanLine = MemAlloc( hImage->usWidth );
|
||||||
CHECKF( pScanLine );
|
CHECKF( pScanLine );
|
||||||
|
memset( pScanLine, 0, hImage->usWidth );
|
||||||
|
|
||||||
// go past all the scanlines we don't need to process
|
// go past all the scanlines we don't need to process
|
||||||
for (uiLine = 0; uiLine < (UINT32) srcRect->iTop; uiLine++)
|
for (uiLine = 0; uiLine < (UINT32) srcRect->iTop; uiLine++)
|
||||||
@@ -650,6 +652,7 @@ UINT16 *Create16BPPPalette( SGPPaletteEntry *pPalette )
|
|||||||
Assert( pPalette != NULL );
|
Assert( pPalette != NULL );
|
||||||
|
|
||||||
p16BPPPalette = (UINT16 *) MemAlloc( sizeof( UINT16 ) * 256 );
|
p16BPPPalette = (UINT16 *) MemAlloc( sizeof( UINT16 ) * 256 );
|
||||||
|
memset( p16BPPPalette, 0, sizeof( UINT16 ) * 256 );
|
||||||
|
|
||||||
for ( cnt = 0; cnt < 256; cnt++ )
|
for ( cnt = 0; cnt < 256; cnt++ )
|
||||||
{
|
{
|
||||||
@@ -723,6 +726,7 @@ UINT16 *Create16BPPPaletteShaded( SGPPaletteEntry *pPalette, UINT32 rscale, UINT
|
|||||||
Assert( pPalette != NULL );
|
Assert( pPalette != NULL );
|
||||||
|
|
||||||
p16BPPPalette = (UINT16 *) MemAlloc( sizeof( UINT16 ) * 256 );
|
p16BPPPalette = (UINT16 *) MemAlloc( sizeof( UINT16 ) * 256 );
|
||||||
|
memset( p16BPPPalette, 0, sizeof( UINT16 ) * 256 );
|
||||||
|
|
||||||
for ( cnt = 0; cnt < 256; cnt++ )
|
for ( cnt = 0; cnt < 256; cnt++ )
|
||||||
{
|
{
|
||||||
@@ -870,21 +874,24 @@ UINT32 GetRGBColor( UINT16 Value16BPP )
|
|||||||
SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPalette)
|
SGPPaletteEntry *ConvertRGBToPaletteEntry(UINT8 sbStart, UINT8 sbEnd, UINT8 *pOldPalette)
|
||||||
{
|
{
|
||||||
UINT16 Index;
|
UINT16 Index;
|
||||||
SGPPaletteEntry *pPalEntry;
|
SGPPaletteEntry *pPalEntry;
|
||||||
SGPPaletteEntry *pInitEntry;
|
SGPPaletteEntry *pInitEntry;
|
||||||
|
|
||||||
pPalEntry = (SGPPaletteEntry *)MemAlloc(sizeof(SGPPaletteEntry) * 256);
|
pPalEntry = (SGPPaletteEntry *)MemAlloc(sizeof(SGPPaletteEntry) * 256);
|
||||||
|
memset( pPalEntry, 0, sizeof(SGPPaletteEntry) * 256 );
|
||||||
pInitEntry = pPalEntry;
|
pInitEntry = pPalEntry;
|
||||||
DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry");
|
|
||||||
for(Index=0; Index <= (sbEnd-sbStart);Index++)
|
DbgMessage(TOPIC_HIMAGE, DBG_LEVEL_0, "Converting RGB palette to SGPPaletteEntry");
|
||||||
{
|
|
||||||
pPalEntry->peRed = *(pOldPalette + (Index*3));
|
for(Index=0; Index <= (sbEnd-sbStart);Index++)
|
||||||
pPalEntry->peGreen = *(pOldPalette + (Index*3) + 1);
|
{
|
||||||
pPalEntry->peBlue = *(pOldPalette + (Index*3) + 2);
|
pPalEntry->peRed = *(pOldPalette + (Index*3));
|
||||||
pPalEntry->peFlags = 0;
|
pPalEntry->peGreen = *(pOldPalette + (Index*3) + 1);
|
||||||
pPalEntry++;
|
pPalEntry->peBlue = *(pOldPalette + (Index*3) + 2);
|
||||||
}
|
pPalEntry->peFlags = 0;
|
||||||
return pInitEntry;
|
pPalEntry++;
|
||||||
|
}
|
||||||
|
return pInitEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
||||||
@@ -899,6 +906,7 @@ BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
|||||||
// Create buffer for objects
|
// Create buffer for objects
|
||||||
pBuffer->pETRLEObject = (ETRLEObject *) MemAlloc( sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
pBuffer->pETRLEObject = (ETRLEObject *) MemAlloc( sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
||||||
CHECKF( pBuffer->pETRLEObject != NULL );
|
CHECKF( pBuffer->pETRLEObject != NULL );
|
||||||
|
memset( pBuffer->pETRLEObject, 0, sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
||||||
|
|
||||||
// Copy into buffer
|
// Copy into buffer
|
||||||
memcpy( pBuffer->pETRLEObject, hImage->pETRLEObject, sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
memcpy( pBuffer->pETRLEObject, hImage->pETRLEObject, sizeof( ETRLEObject ) * pBuffer->usNumberOfObjects );
|
||||||
@@ -906,6 +914,7 @@ BOOLEAN GetETRLEImageData( HIMAGE hImage, ETRLEData *pBuffer )
|
|||||||
// Allocate memory for pixel data
|
// Allocate memory for pixel data
|
||||||
pBuffer->pPixData = MemAlloc( hImage->uiSizePixData );
|
pBuffer->pPixData = MemAlloc( hImage->uiSizePixData );
|
||||||
CHECKF( pBuffer->pPixData != NULL );
|
CHECKF( pBuffer->pPixData != NULL );
|
||||||
|
memset( pBuffer->pPixData, 0, hImage->uiSizePixData );
|
||||||
|
|
||||||
pBuffer->uiSizePixData = hImage->uiSizePixData;
|
pBuffer->uiSizePixData = hImage->uiSizePixData;
|
||||||
|
|
||||||
|
|||||||
@@ -2982,7 +2982,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
{
|
{
|
||||||
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) && (gWorldItems[ uiLoop ].sGridNo != pSoldier->sGridNo) )//item exists and is reachable and is not already on soldiers tile
|
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) && (gWorldItems[ uiLoop ].sGridNo != pSoldier->sGridNo) )//item exists and is reachable and is not already on soldiers tile
|
||||||
{
|
{
|
||||||
MoveItemPools(gWorldItems[ uiLoop ].sGridNo, pSoldier->sGridNo, gWorldItems[ uiLoop ].ubLevel, pSoldier->bLevel);
|
MoveItemPools(gWorldItems[ uiLoop ].sGridNo, pSoldier->sGridNo, gWorldItems[ uiLoop ].ubLevel, pSoldier->bLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user