Fix crash on starting cam2 where objects are released but animations that refer

to them are not. Bug looks like it has always been there, but hidden by old memory
management code.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2050 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-07-10 20:17:27 +00:00
parent 3cedbb58f5
commit e2879a2206
1 changed files with 8 additions and 0 deletions

View File

@ -3952,6 +3952,12 @@ void structureUpdate(STRUCTURE *psBuilding)
/* Release all resources associated with a structure */
void structureRelease(STRUCTURE *psBuilding)
{
/* remove animation if present */
if ( psBuilding->psCurAnim != NULL )
{
animObj_Remove( &psBuilding->psCurAnim, psBuilding->psCurAnim->psAnim->uwID );
psBuilding->psCurAnim = NULL;
}
// free up the space used by the functionality array
free(psBuilding->pFunctionality);
@ -5986,6 +5992,8 @@ void releasePowerGen(STRUCTURE *psRelease)
/*this is called whenever a structure has finished building*/
void buildingComplete(STRUCTURE *psBuilding)
{
CHECK_STRUCTURE(psBuilding);
psBuilding->currentBuildPts = (SWORD)psBuilding->pStructureType->buildPoints;
psBuilding->status = SS_BUILT;