From: cloudwalk Date: Sat, 30 May 2020 19:59:12 +0000 (+0000) Subject: Clean up Host_Init a bit by moving other client init routines to CL_Init X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9a80ba43c8707aa586e95dfea40018da2d8c85d2;p=xonotic%2Fdarkplaces.git Clean up Host_Init a bit by moving other client init routines to CL_Init git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12612 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index 5d22ba7b..83f7d97c 100644 --- a/cl_main.c +++ b/cl_main.c @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "r_shadow.h" #include "libcurl.h" #include "snd_main.h" +#include "cdaudio.h" // we need to declare some mouse variables here, because the menu system // references them even when on a unix system. @@ -2644,6 +2645,26 @@ CL_Init */ void CL_Init (void) { + if (cls.state == ca_dedicated) + { + Cmd_AddCommand(&cmd_server, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); + } + else + { + Con_DPrintf("Initializing client\n"); + + R_Modules_Init(); + Palette_Init(); +#ifdef CONFIG_MENU + MR_Init_Commands(); +#endif + VID_Shared_Init(); + VID_Init(); + Render_Init(); + S_Init(); + CDAudio_Init(); + Key_Init(); + } cls.levelmempool = Mem_AllocPool("client (per-level memory)", 0, NULL); cls.permanentmempool = Mem_AllocPool("client (long term memory)", 0, NULL); diff --git a/host.c b/host.c index 313745a9..e659909f 100644 --- a/host.c +++ b/host.c @@ -1289,28 +1289,7 @@ static void Host_Init (void) Thread_Init(); TaskQueue_Init(); - if (cls.state == ca_dedicated) - { - cmd = &cmd_server; - Cmd_AddCommand(&cmd_server, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); - } - else - { - Con_DPrintf("Initializing client\n"); - - R_Modules_Init(); - Palette_Init(); -#ifdef CONFIG_MENU - MR_Init_Commands(); -#endif - VID_Shared_Init(); - VID_Init(); - Render_Init(); - S_Init(); - CDAudio_Init(); - Key_Init(); - CL_Init(); - } + CL_Init(); // save off current state of aliases, commands and cvars for later restore if FS_GameDir_f is called // NOTE: menu commands are freed by Cmd_RestoreInitState