Clean up all the system shutdown calls

I added Sys_RegisterShutdown years ago and never really did anything
with it: now any system that needs to be shutdown can ensure it gets
shutdown on program exit, and in the correct order (ie, reverse to init
order).
This commit is contained in:
Bill Currie 2019-07-12 23:15:26 +09:00
parent b2e12d701b
commit 4e4d1b99b4
40 changed files with 135 additions and 176 deletions

View file

@ -84,9 +84,20 @@ Con_Interp_f (cvar_t *var)
}
}
static void
Con_shutdown (void)
{
if (con_module) {
con_module->functions->general->p_Shutdown ();
PI_UnloadPlugin (con_module);
}
}
VISIBLE void
Con_Init (const char *plugin_name)
{
Sys_RegisterShutdown (Con_shutdown);
con_module = PI_LoadPlugin ("console", plugin_name);
if (con_module) {
con_module->functions->general->p_Init ();
@ -123,15 +134,6 @@ Con_ExecLine (const char *line)
Sys_Printf ("%s\n", line);
}
VISIBLE void
Con_Shutdown (void)
{
if (con_module) {
con_module->functions->general->p_Shutdown ();
PI_UnloadPlugin (con_module);
}
}
VISIBLE void
Con_Printf (const char *fmt, ...)
{