From: cloudwalk Date: Mon, 22 Jun 2020 15:36:12 +0000 (+0000) Subject: (Round 3) Break up host_cmd.c X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=516aaf656300a6fa075b693e816bc39f81844148;p=xonotic%2Fdarkplaces.git (Round 3) Break up host_cmd.c The quit and version commands. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12720 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index 5c9da7eb..51f3bd32 100644 --- a/host.c +++ b/host.c @@ -213,6 +213,24 @@ static void Host_ServerOptions (void) Cvar_SetValueQuick(&deathmatch, 1); } +/* +================== +Host_Quit_f +================== +*/ +void Host_Quit_f(cmd_state_t *cmd) +{ + if(host.state == host_shutdown) + Con_Printf("shutting down already!\n"); + else + host.state = host_shutdown; +} + +static void Host_Version_f(cmd_state_t *cmd) +{ + Con_Printf("Version: %s build %s\n", gamename, buildstring); +} + /* ======================= Host_InitLocal @@ -224,6 +242,8 @@ extern cvar_t sv_writepicture_quality; extern cvar_t r_texture_jpeg_fastpicmip; static void Host_InitLocal (void) { + Cmd_AddCommand(CMD_SHARED, "quit", Host_Quit_f, "quit the game"); + Cmd_AddCommand(CMD_SHARED, "version", Host_Version_f, "print engine version"); Cmd_AddCommand(CMD_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)"); Cmd_AddCommand(CMD_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs"); Cvar_RegisterVariable (&cl_maxphysicsframesperserverframe); diff --git a/host_cmd.c b/host_cmd.c index 7e4cebfa..dc270cf4 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -44,22 +44,6 @@ cvar_t skin = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW player s cvar_t noaim = {CVAR_CLIENT | CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"}; cvar_t r_fixtrans_auto = {CVAR_CLIENT, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"}; -extern cvar_t developer_entityparsing; - -/* -================== -Host_Quit_f -================== -*/ - -void Host_Quit_f(cmd_state_t *cmd) -{ - if(host.state == host_shutdown) - Con_Printf("shutting down already!\n"); - else - host.state = host_shutdown; -} - /* ================== CL_Reconnect_f @@ -393,11 +377,6 @@ static void CL_Playerskin_f(cmd_state_t *cmd) } } -static void Host_Version_f(cmd_state_t *cmd) -{ - Con_Printf("Version: %s build %s\n", gamename, buildstring); -} - /* ================== CL_Color_f @@ -1011,10 +990,6 @@ void Host_InitCommands (void) Cvar_RegisterVariable(&skin); Cvar_RegisterVariable(&noaim); - // client commands - this includes server commands because the client can host a server, so they must exist - Cmd_AddCommand(CMD_SHARED, "quit", Host_Quit_f, "quit the game"); - Cmd_AddCommand(CMD_SHARED, "version", Host_Version_f, "print engine version"); - Cmd_AddCommand(CMD_CLIENT | CMD_SERVER_FROM_CLIENT, "name", CL_Name_f, "change your player name"); Cmd_AddCommand(CMD_CLIENT | CMD_SERVER_FROM_CLIENT, "color", CL_Color_f, "change your player shirt and pants colors"); Cmd_AddCommand(CMD_CLIENT | CMD_SERVER_FROM_CLIENT, "rate", CL_Rate_f, "change your network connection speed");