Delete the temporary files on sudden exit. Can be removed once we have
proper exiting. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@494 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -31,6 +31,7 @@ FRAME PlayFrame;
|
||||
GLOBDATA GlobData;
|
||||
|
||||
extern FRAME flagship_status, misc_data;
|
||||
BOOLEAN initedSIS = 0;
|
||||
|
||||
void
|
||||
CreateRadar (void)
|
||||
@@ -276,6 +277,17 @@ GLOBAL_SIS (ModuleSlots[i++]) = CANNON_WEAPON;
|
||||
CurStarDescPtr = 0;
|
||||
GLOBAL (autopilot.x) = GLOBAL (autopilot.y) = ~0;
|
||||
|
||||
/* In case the program is exited before the full game is terminated,
|
||||
* make sure that the temporary files are deleted.
|
||||
* This can be removed if we make sure if the full game is terminated
|
||||
* before the game is exited.
|
||||
* The initedSIS variable is added so the uninit won't happen more
|
||||
* than once, as you can't remove the atexit function (when the full game
|
||||
* ends).
|
||||
*/
|
||||
initedSIS = TRUE;
|
||||
atexit (UninitSIS);
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@@ -295,6 +307,9 @@ UninitSIS (void)
|
||||
{
|
||||
HSTARSHIP hStarShip;
|
||||
|
||||
if (!initedSIS)
|
||||
return;
|
||||
|
||||
UninitQueue (&GLOBAL (encounter_q));
|
||||
UninitQueue (&GLOBAL (npc_built_ship_q));
|
||||
UninitQueue (&GLOBAL (built_ship_q));
|
||||
@@ -322,5 +337,6 @@ UninitSIS (void)
|
||||
|
||||
DestroyDrawable (ReleaseDrawable (PlayFrame));
|
||||
PlayFrame = 0;
|
||||
initedSIS = FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user