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:
meep-eep
2002-12-28 22:42:47 +00:00
parent 0056003092
commit 1769162f34
+16
View File
@@ -31,6 +31,7 @@ FRAME PlayFrame;
GLOBDATA GlobData; GLOBDATA GlobData;
extern FRAME flagship_status, misc_data; extern FRAME flagship_status, misc_data;
BOOLEAN initedSIS = 0;
void void
CreateRadar (void) CreateRadar (void)
@@ -276,6 +277,17 @@ GLOBAL_SIS (ModuleSlots[i++]) = CANNON_WEAPON;
CurStarDescPtr = 0; CurStarDescPtr = 0;
GLOBAL (autopilot.x) = GLOBAL (autopilot.y) = ~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); return (TRUE);
} }
@@ -295,6 +307,9 @@ UninitSIS (void)
{ {
HSTARSHIP hStarShip; HSTARSHIP hStarShip;
if (!initedSIS)
return;
UninitQueue (&GLOBAL (encounter_q)); UninitQueue (&GLOBAL (encounter_q));
UninitQueue (&GLOBAL (npc_built_ship_q)); UninitQueue (&GLOBAL (npc_built_ship_q));
UninitQueue (&GLOBAL (built_ship_q)); UninitQueue (&GLOBAL (built_ship_q));
@@ -322,5 +337,6 @@ UninitSIS (void)
DestroyDrawable (ReleaseDrawable (PlayFrame)); DestroyDrawable (ReleaseDrawable (PlayFrame));
PlayFrame = 0; PlayFrame = 0;
initedSIS = FALSE;
} }