mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fix: deleting a face with invalid pointer leads to first mercs having Skyrider's face
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8581 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+6
-57
@@ -9190,69 +9190,18 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
|
||||
SOLDIERTYPE * pSoldier;
|
||||
UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID;
|
||||
UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID;
|
||||
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++)
|
||||
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID,pSoldier++)
|
||||
{
|
||||
if ( pSoldier->bCamo > 0 )
|
||||
if ( pSoldier )
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gCamoface = TRUE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
else
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
gCamoFace[pSoldier->ubProfile].gCamoface = ( pSoldier->bCamo > 0 );
|
||||
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = ( pSoldier->urbanCamo > 0 );
|
||||
gCamoFace[pSoldier->ubProfile].gDesertCamoface = ( pSoldier->desertCamo > 0 );
|
||||
gCamoFace[pSoldier->ubProfile].gSnowCamoface = ( pSoldier->snowCamo > 0 );
|
||||
|
||||
if ( pSoldier->urbanCamo > 0 )
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = TRUE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
else
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
|
||||
if ( pSoldier->desertCamo > 0 )
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gDesertCamoface = TRUE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
else
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
|
||||
if ( pSoldier->snowCamo > 0 )
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gSnowCamoface = TRUE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
else
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
|
||||
if ( pSoldier->snowCamo == 0 && pSoldier->bCamo == 0 && pSoldier->urbanCamo == 0 && pSoldier->desertCamo == 0)
|
||||
{
|
||||
gCamoFace[pSoldier->ubProfile].gCamoface = FALSE;
|
||||
gCamoFace[pSoldier->ubProfile].gUrbanCamoface = FALSE;
|
||||
gCamoFace[pSoldier->ubProfile].gDesertCamoface = FALSE;
|
||||
gCamoFace[pSoldier->ubProfile].gSnowCamoface = FALSE;
|
||||
DeleteSoldierFace( pSoldier );
|
||||
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,62 +325,38 @@ void ShutdownDialogueControl()
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InitalizeStaticExternalNPCFaces( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
// go and grab all external NPC faces that are needed for the game who won't exist as soldiertypes
|
||||
|
||||
if( fExternFacesLoaded == TRUE )
|
||||
{
|
||||
if( fExternFacesLoaded )
|
||||
return;
|
||||
}
|
||||
|
||||
fExternFacesLoaded = TRUE;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Code for loading miners' faces has been moved to LuaMines::InitMinerFaces ...
|
||||
//
|
||||
#ifdef JA2UB
|
||||
for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ )
|
||||
for( INT32 iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; ++iCounter )
|
||||
{
|
||||
uiExternalStaticNPCFacesUB[ iCounter ] = ( UINT32 )InitFace( ( UINT8 )( uiExternalFaceProfileIdsUB[ iCounter ] ), NOBODY, FACE_FORCE_SMALL );
|
||||
}
|
||||
#endif
|
||||
|
||||
//for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ )
|
||||
//{
|
||||
// uiExternalStaticNPCFaces[ iCounter ] = ( UINT32 )InitFace( ( UINT8 )( uiExternalFaceProfileIds[ iCounter ] ), NOBODY, FACE_FORCE_SMALL );
|
||||
//}
|
||||
// ... put Skyrider's face at index 0
|
||||
uiExternalStaticNPCFaces.push_back(( UINT32 )InitFace( ( UINT8 )( SKYRIDER ), NOBODY, FACE_FORCE_SMALL ));
|
||||
// anv: and put Waldo too
|
||||
uiExternalStaticNPCFaces.push_back(( UINT32 )InitFace( ( UINT8 )( WALDO ), NOBODY, FACE_FORCE_SMALL ));
|
||||
|
||||
return;
|
||||
fExternFacesLoaded = TRUE;
|
||||
}
|
||||
|
||||
void ShutdownStaticExternalNPCFaces( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
if( fExternFacesLoaded == FALSE )
|
||||
{
|
||||
if ( !fExternFacesLoaded )
|
||||
return;
|
||||
}
|
||||
|
||||
fExternFacesLoaded = FALSE;
|
||||
|
||||
// remove all external npc faces
|
||||
//for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ )
|
||||
//{
|
||||
// DeleteFace( uiExternalStaticNPCFaces[ iCounter ] );
|
||||
//}
|
||||
|
||||
#ifdef JA2UB
|
||||
for( iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; iCounter++ )
|
||||
for( INT32 iCounter = 0; iCounter < NUMBER_OF_EXTERNAL_NPC_FACES; ++iCounter )
|
||||
{
|
||||
DeleteFace( uiExternalStaticNPCFacesUB[ iCounter ] );
|
||||
}
|
||||
@@ -391,7 +367,10 @@ void ShutdownStaticExternalNPCFaces( void )
|
||||
{
|
||||
DeleteFace(*face);
|
||||
}
|
||||
|
||||
uiExternalStaticNPCFaces.clear();
|
||||
|
||||
fExternFacesLoaded = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,11 +409,9 @@ DEF: commented out because the Queue system ?? uses a contiguous memory block ??
|
||||
|
||||
BOOLEAN DialogueQueueIsEmpty( )
|
||||
{
|
||||
INT32 numDialogueItems;
|
||||
|
||||
if( ghDialogueQ != NULL )
|
||||
{
|
||||
numDialogueItems = QueueSize( ghDialogueQ );
|
||||
INT32 numDialogueItems = QueueSize( ghDialogueQ );
|
||||
|
||||
if ( numDialogueItems == 0 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user