mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
[qw] Correct client shutdown order
This is similar to the change in nq (and for the same reason), making sure that client shutdown (and thus config writing) happens before input system shutdown.
This commit is contained in:
parent
0b9d36b08d
commit
a2d50395d6
2 changed files with 32 additions and 33 deletions
|
@ -48,13 +48,11 @@ extern int host_framecount; // incremented every frame, never reset
|
|||
void Host_ServerFrame (void);
|
||||
void Host_InitCommands (void);
|
||||
void Host_Init (void);
|
||||
void Host_Shutdown(void *data);
|
||||
void Host_Error (const char *error, ...) __attribute__((format(PRINTF,1,2), noreturn));
|
||||
void Host_EndGame (const char *message, ...) __attribute__((format(PRINTF,1,2), noreturn));
|
||||
void Host_Frame (float time);
|
||||
void Host_Quit_f (void);
|
||||
void Host_ClientCommands (const char *fmt, ...) __attribute__((format(PRINTF,1,2)));
|
||||
void Host_ShutdownServer (qboolean crash);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -1446,6 +1446,36 @@ CL_SetState (cactive_t state)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CL_Shutdown (void *data)
|
||||
{
|
||||
static qboolean isdown = false;
|
||||
|
||||
if (isdown) {
|
||||
printf ("recursive shutdown\n");
|
||||
return;
|
||||
}
|
||||
isdown = true;
|
||||
|
||||
SL_Shutdown ();
|
||||
|
||||
Host_WriteConfiguration ();
|
||||
|
||||
CL_HTTP_Shutdown ();
|
||||
|
||||
if (cl.serverinfo) {
|
||||
Info_Destroy (cl.serverinfo);
|
||||
}
|
||||
Info_Destroy (cls.userinfo);
|
||||
Cbuf_DeleteStack (cl_stbuf);
|
||||
dstring_delete (centerprint);
|
||||
dstring_delete (cls.servername);
|
||||
dstring_delete (cls.downloadtempname);
|
||||
dstring_delete (cls.downloadname);
|
||||
dstring_delete (cls.downloadurl);
|
||||
free (cl.players);
|
||||
}
|
||||
|
||||
void
|
||||
CL_Init (void)
|
||||
{
|
||||
|
@ -1497,6 +1527,8 @@ CL_Init (void)
|
|||
Locs_Init ();
|
||||
V_Init (&cl.viewstate);
|
||||
|
||||
Sys_RegisterShutdown (CL_Shutdown, 0);
|
||||
|
||||
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
||||
|
||||
centerprint = dstring_newstr ();
|
||||
|
@ -2060,7 +2092,6 @@ Host_Init (void)
|
|||
QFS_GamedirCallback (CL_Autoexec);
|
||||
PI_Init ();
|
||||
|
||||
Sys_RegisterShutdown (Host_Shutdown, 0);
|
||||
Sys_RegisterShutdown (Net_LogStop, 0);
|
||||
|
||||
Netchan_Init_Cvars ();
|
||||
|
@ -2120,33 +2151,3 @@ Host_Init (void)
|
|||
}
|
||||
Cbuf_AddText (cl_cbuf, "set cmd_warncmd 1\n");
|
||||
}
|
||||
|
||||
void
|
||||
Host_Shutdown (void *data)
|
||||
{
|
||||
static qboolean isdown = false;
|
||||
|
||||
if (isdown) {
|
||||
printf ("recursive shutdown\n");
|
||||
return;
|
||||
}
|
||||
isdown = true;
|
||||
|
||||
SL_Shutdown ();
|
||||
|
||||
Host_WriteConfiguration ();
|
||||
|
||||
CL_HTTP_Shutdown ();
|
||||
|
||||
if (cl.serverinfo) {
|
||||
Info_Destroy (cl.serverinfo);
|
||||
}
|
||||
Info_Destroy (cls.userinfo);
|
||||
Cbuf_DeleteStack (cl_stbuf);
|
||||
dstring_delete (centerprint);
|
||||
dstring_delete (cls.servername);
|
||||
dstring_delete (cls.downloadtempname);
|
||||
dstring_delete (cls.downloadname);
|
||||
dstring_delete (cls.downloadurl);
|
||||
free (cl.players);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue