From: cloudwalk Date: Tue, 27 Oct 2020 14:50:20 +0000 (+0000) Subject: cmd: Merge cmd_server and cmd_client into cmd_local again X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aadd101471d0227217f84d3dc6ed03fec4aacd4c;p=xonotic%2Fdarkplaces.git cmd: Merge cmd_server and cmd_client into cmd_local again git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13035 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index 4b91f9e3..651e1dc4 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -67,7 +67,7 @@ void CL_NextDemo (void) } dpsnprintf (str, sizeof(str), "playdemo %s\n", cls.demos[cls.demonum]); - Cbuf_InsertText(&cmd_client, str); + Cbuf_InsertText(&cmd_local, str); cls.demonum++; } @@ -277,7 +277,7 @@ void CL_ReadDemoMessage(void) CL_ParseServerMessage(); if (cls.signon != SIGNONS) - Cbuf_Execute((&cmd_client)->cbuf); // immediately execute svc_stufftext if in the demo before connect! + Cbuf_Execute((&cmd_local)->cbuf); // immediately execute svc_stufftext if in the demo before connect! // In case the demo contains a "svc_disconnect" message if (!cls.demoplayback) @@ -532,7 +532,7 @@ static void CL_FinishTimeDemo (void) if(atoi(sys.argv[i + 1]) > benchmark_runs) { // restart the benchmark - Cbuf_AddText(&cmd_client, va(vabuf, sizeof(vabuf), "timedemo %s\n", cls.demoname)); + Cbuf_AddText(&cmd_local, va(vabuf, sizeof(vabuf), "timedemo %s\n", cls.demoname)); // cannot execute here } else diff --git a/cl_main.c b/cl_main.c index 2a2b9976..614ee65a 100644 --- a/cl_main.c +++ b/cl_main.c @@ -397,7 +397,7 @@ void CL_Disconnect(void) sizebuf_t buf; unsigned char bufdata[8]; if (cls.demorecording) - CL_Stop_f(&cmd_client); + CL_Stop_f(&cmd_local); // send disconnect message 3 times to improve chances of server // receiving it (but it still fails sometimes) @@ -553,8 +553,8 @@ void CL_EstablishConnection(const char *address, int firstarg) { int i; *cls.connect_userinfo = 0; - for(i = firstarg; i+2 <= Cmd_Argc(&cmd_client); i += 2) - InfoString_SetValue(cls.connect_userinfo, sizeof(cls.connect_userinfo), Cmd_Argv(&cmd_client, i), Cmd_Argv(&cmd_client, i+1)); + for(i = firstarg; i+2 <= Cmd_Argc(&cmd_local); i += 2) + InfoString_SetValue(cls.connect_userinfo, sizeof(cls.connect_userinfo), Cmd_Argv(&cmd_local, i), Cmd_Argv(&cmd_local, i+1)); } else if(firstarg < -1) { diff --git a/cl_parse.c b/cl_parse.c index 30b2d3cc..96edfffe 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -499,7 +499,7 @@ static void CL_SetupWorldModel(void) World_Start(&cl.world); // load or reload .loc file for team chat messages - CL_Locs_Reload_f(&cmd_client); + CL_Locs_Reload_f(&cmd_local); // make sure we send enough keepalives CL_KeepaliveMessage(false); @@ -939,7 +939,7 @@ void QW_CL_StartUpload(unsigned char *data, int size) return; // abort existing upload if in progress - QW_CL_StopUpload_f(&cmd_client); + QW_CL_StopUpload_f(&cmd_local); Con_DPrintf("Starting upload of %d bytes...\n", size); @@ -948,7 +948,7 @@ void QW_CL_StartUpload(unsigned char *data, int size) cls.qw_uploadsize = size; cls.qw_uploadpos = 0; - QW_CL_NextUpload_f(&cmd_client); + QW_CL_NextUpload_f(&cmd_local); } #if 0 @@ -1618,7 +1618,7 @@ static void CL_SignonReply (void) // execute cl_begindownloads next frame // (after any commands added by svc_stufftext have been executed) // when done with downloads the "prespawn" will be sent - Cbuf_AddText(&cmd_client, "\ncl_begindownloads\n"); + Cbuf_AddText(&cmd_local, "\ncl_begindownloads\n"); //MSG_WriteByte (&cls.netcon->message, clc_stringcmd); //MSG_WriteString (&cls.netcon->message, "prespawn"); @@ -1919,7 +1919,7 @@ static void CL_ParseServerInfo (void) if (cls.demorecording) { // finish the previous level's demo file - CL_Stop_f(&cmd_client); + CL_Stop_f(&cmd_local); } // start a new demo file @@ -3658,7 +3658,7 @@ void CL_ParseServerMessage(void) break; case qw_svc_sellscreen: - Cmd_ExecuteString(&cmd_client, "help", src_local, true); + Cmd_ExecuteString(&cmd_local, "help", src_local, true); break; case qw_svc_smallkick: @@ -4165,7 +4165,7 @@ void CL_ParseServerMessage(void) break; case svc_sellscreen: - Cmd_ExecuteString(&cmd_client, "help", src_local, true); + Cmd_ExecuteString(&cmd_local, "help", src_local, true); break; case svc_hidelmp: if (gamemode == GAME_TENEBRAE) @@ -4268,7 +4268,7 @@ void CL_Parse_DumpPacket(void) void CL_Parse_ErrorCleanUp(void) { CL_StopDownload(0, 0); - QW_CL_StopUpload_f(&cmd_client); + QW_CL_StopUpload_f(&cmd_local); } void CL_Parse_Init(void) diff --git a/clvm_cmds.c b/clvm_cmds.c index adf20144..88771af2 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -2402,7 +2402,7 @@ static void VM_CL_setlistener (prvm_prog_t *prog) static void VM_CL_registercmd (prvm_prog_t *prog) { VM_SAFEPARMCOUNT(1, VM_CL_registercmd); - if(!Cmd_Exists(&cmd_client, PRVM_G_STRING(OFS_PARM0))) + if(!Cmd_Exists(&cmd_local, PRVM_G_STRING(OFS_PARM0))) Cmd_AddCommand(CF_CLIENT, PRVM_G_STRING(OFS_PARM0), NULL, "console command created by QuakeC"); } diff --git a/cmd.c b/cmd.c index ba5e5467..c353b4c8 100644 --- a/cmd.c +++ b/cmd.c @@ -22,8 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "thread.h" -cmd_state_t cmd_client; -cmd_state_t cmd_server; +cmd_state_t cmd_local; cmd_state_t cmd_serverfromclient; cmd_userdefined_t cmd_userdefined_all; @@ -35,8 +34,7 @@ typedef struct cmd_iter_s { cmd_iter_t; static cmd_iter_t cmd_iter_all[] = { - {&cmd_client}, - {&cmd_server}, + {&cmd_local}, {&cmd_serverfromclient}, {NULL}, }; @@ -1631,19 +1629,12 @@ void Cmd_Init(void) cmd->null_string = ""; } // client console can see server cvars because the user may start a server - cmd_client.cvars = &cvars_all; - cmd_client.cvars_flagsmask = CF_CLIENT | CF_SERVER; - cmd_client.cmd_flags = CF_CLIENT | CF_CLIENT_FROM_SERVER; - cmd_client.auto_flags = CF_SERVER_FROM_CLIENT; - cmd_client.auto_function = CL_ForwardToServer_f; // FIXME: Move this to the client. - cmd_client.userdefined = &cmd_userdefined_all; - // dedicated server console can only see server cvars, there is no client - cmd_server.cvars = &cvars_all; - cmd_server.cvars_flagsmask = CF_SERVER; - cmd_server.cmd_flags = CF_SERVER; - cmd_server.auto_flags = 0; - cmd_server.auto_function = NULL; - cmd_server.userdefined = &cmd_userdefined_all; + cmd_local.cvars = &cvars_all; + cmd_local.cvars_flagsmask = CF_CLIENT | CF_SERVER; + cmd_local.cmd_flags = CF_SERVER | CF_CLIENT | CF_CLIENT_FROM_SERVER; + cmd_local.auto_flags = CF_SERVER_FROM_CLIENT; + cmd_local.auto_function = CL_ForwardToServer_f; // FIXME: Move this to the client. + cmd_local.userdefined = &cmd_userdefined_all; // server commands received from clients have no reason to access cvars, cvar expansion seems perilous. cmd_serverfromclient.cvars = &cvars_null; cmd_serverfromclient.cvars_flagsmask = 0; @@ -1824,7 +1815,7 @@ void Cmd_AddCommand(int flags, const char *cmd_name, xcommand_t function, const qbool auto_add = false; int i; - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) { cmd = cmd_iter_all[i].cmd; if ((flags & cmd->cmd_flags) || (flags & cmd->auto_flags)) diff --git a/cmd.h b/cmd.h index b1056007..31f8a08f 100644 --- a/cmd.h +++ b/cmd.h @@ -170,10 +170,10 @@ extern cmd_userdefined_t cmd_userdefined_null; // intentionally empty // command interpreter for client commands injected by CSQC, MQC or client engine code // uses cmddefs_all -extern cmd_state_t cmd_client; +extern cmd_state_t cmd_local; // command interpreter for server commands injected by MQC, SVQC, menu engine code or server engine code // uses cmddefs_all -extern cmd_state_t cmd_server; +extern cmd_state_t cmd_local; // command interpreter for server commands received over network from clients // uses cmddefs_null extern cmd_state_t cmd_serverfromclient; diff --git a/csprogs.c b/csprogs.c index 94e3b9d0..05919e59 100644 --- a/csprogs.c +++ b/csprogs.c @@ -564,7 +564,7 @@ void CL_VM_Parse_StuffCmd (const char *msg) int crcflags = csqc_progcrc.flags; csqc_progcrc.flags &= ~CF_READONLY; csqc_progsize.flags &= ~CF_READONLY; - Cmd_ExecuteString(&cmd_client, msg, src_local, true); + Cmd_ExecuteString(&cmd_local, msg, src_local, true); csqc_progcrc.flags = csqc_progsize.flags = crcflags; return; } @@ -596,7 +596,7 @@ void CL_VM_Parse_StuffCmd (const char *msg) l = sizeof(buf) - 1; strlcpy(buf, p, l + 1); // strlcpy needs a + 1 as it includes the newline! - Cmd_ExecuteString(&cmd_client, buf, src_local, true); + Cmd_ExecuteString(&cmd_local, buf, src_local, true); p += l; if(*p == '\n') @@ -604,13 +604,13 @@ void CL_VM_Parse_StuffCmd (const char *msg) else break; // end of string or overflow } - Cmd_ExecuteString(&cmd_client, "curl --clear_autodownload", src_local, true); // don't inhibit CSQC loading + Cmd_ExecuteString(&cmd_local, "curl --clear_autodownload", src_local, true); // don't inhibit CSQC loading return; } if(!cl.csqc_loaded) { - Cbuf_AddText(&cmd_client, msg); + Cbuf_AddText(&cmd_local, msg); return; } CSQC_BEGIN @@ -624,7 +624,7 @@ void CL_VM_Parse_StuffCmd (const char *msg) prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize; } else - Cbuf_AddText(&cmd_client, msg); + Cbuf_AddText(&cmd_local, msg); CSQC_END } @@ -1049,7 +1049,7 @@ void CL_VM_Init (void) return; } - PRVM_Prog_Init(prog, &cmd_client); + PRVM_Prog_Init(prog, &cmd_local); // allocate the mempools prog->progs_mempool = Mem_AllocPool(csqc_progname.string, 0, NULL); @@ -1149,7 +1149,7 @@ void CL_VM_Init (void) void CL_VM_ShutDown (void) { prvm_prog_t *prog = CLVM_prog; - Cmd_ClearCSQCCommands(&cmd_client); + Cmd_ClearCSQCCommands(&cmd_local); //Cvar_SetValueQuick(&csqc_progcrc, -1); //Cvar_SetValueQuick(&csqc_progsize, -1); if(!cl.csqc_loaded) diff --git a/cvar.c b/cvar.c index 4adee745..1124494d 100644 --- a/cvar.c +++ b/cvar.c @@ -605,7 +605,7 @@ void Cvar_RegisterVariable (cvar_t *variable) } // check for overlap with a command - if (Cmd_Exists(&cmd_client, variable->name) || Cmd_Exists(&cmd_server, variable->name)) + if (Cmd_Exists(&cmd_local, variable->name) || Cmd_Exists(&cmd_local, variable->name)) { Con_Printf("Cvar_RegisterVariable: %s is a command\n", variable->name); return; @@ -668,7 +668,7 @@ cvar_t *Cvar_Get(cvar_state_t *cvars, const char *name, const char *value, int f } // check for overlap with a command - if (Cmd_Exists(&cmd_client, name) || Cmd_Exists(&cmd_server, name)) + if (Cmd_Exists(&cmd_local, name) || Cmd_Exists(&cmd_local, name)) { Con_Printf("Cvar_Get: %s is a command\n", name); return NULL; diff --git a/fs.c b/fs.c index 26949074..32e1eaee 100644 --- a/fs.c +++ b/fs.c @@ -1574,15 +1574,15 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl if (cls.demoplayback) { - CL_Disconnect_f(&cmd_client); + CL_Disconnect_f(&cmd_local); cls.demonum = 0; } // unload all sounds so they will be reloaded from the new files as needed - S_UnloadAllSounds_f(&cmd_client); + S_UnloadAllSounds_f(&cmd_local); // restart the video subsystem after the config is executed - Cbuf_InsertText(&cmd_client, "\nloadconfig\nvid_restart\n\n"); + Cbuf_InsertText(&cmd_local, "\nloadconfig\nvid_restart\n\n"); return true; } diff --git a/gl_rmain.c b/gl_rmain.c index 5fc7862b..4a33fd9f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3189,7 +3189,7 @@ static void gl_main_shutdown(void) r_texture_numcubemaps = 0; //r_texture_fogintensity = NULL; memset(&r_fb, 0, sizeof(r_fb)); - R_GLSL_Restart_f(&cmd_client); + R_GLSL_Restart_f(&cmd_local); r_glsl_permutation = NULL; memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash)); @@ -5681,7 +5681,7 @@ void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, i rsurface.entity = NULL; // used only by R_GetCurrentTexture and RSurf_ActiveModelEntity if(R_CompileShader_CheckStaticParms()) - R_GLSL_Restart_f(&cmd_client); + R_GLSL_Restart_f(&cmd_local); if (!r_drawentities.integer) r_refdef.scene.numentities = 0; diff --git a/host.c b/host.c index 268c1467..06139472 100644 --- a/host.c +++ b/host.c @@ -293,10 +293,10 @@ void Host_LoadConfig_f(cmd_state_t *cmd) Cmd_RestoreInitState(); #ifdef CONFIG_MENU // prepend a menu restart command to execute after the config - Cbuf_InsertText(&cmd_client, "\nmenu_restart\n"); + Cbuf_InsertText(&cmd_local, "\nmenu_restart\n"); #endif // reset cvars to their defaults, and then exec startup scripts again - Host_AddConfigText(&cmd_client); + Host_AddConfigText(&cmd_local); } //============================================================================ @@ -315,9 +315,9 @@ static void Host_GetConsoleCommands (void) while ((line = Sys_ConsoleInput())) { if (cls.state == ca_dedicated) - Cbuf_AddText(&cmd_server, line); + Cbuf_AddText(&cmd_local, line); else - Cbuf_AddText(&cmd_client, line); + Cbuf_AddText(&cmd_local, line); } } @@ -558,7 +558,7 @@ static void Host_Init (void) int i; const char* os; char vabuf[1024]; - cmd_state_t *cmd = &cmd_client; + cmd_state_t *cmd = &cmd_local; host.hook.ConnectLocal = NULL; host.hook.Disconnect = NULL; @@ -699,8 +699,8 @@ static void Host_Init (void) if (i && i + 1 < sys.argc) if (!sv.active && !cls.demoplayback && !cls.connect_trying) { - Cbuf_AddText(&cmd_client, va(vabuf, sizeof(vabuf), "timedemo %s\n", sys.argv[i + 1])); - Cbuf_Execute((&cmd_client)->cbuf); + Cbuf_AddText(&cmd_local, va(vabuf, sizeof(vabuf), "timedemo %s\n", sys.argv[i + 1])); + Cbuf_Execute((&cmd_local)->cbuf); } // check for special demo mode @@ -709,8 +709,8 @@ static void Host_Init (void) if (i && i + 1 < sys.argc) if (!sv.active && !cls.demoplayback && !cls.connect_trying) { - Cbuf_AddText(&cmd_client, va(vabuf, sizeof(vabuf), "playdemo %s\n", sys.argv[i + 1])); - Cbuf_Execute((&cmd_client)->cbuf); + Cbuf_AddText(&cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\n", sys.argv[i + 1])); + Cbuf_Execute((&cmd_local)->cbuf); } #ifdef CONFIG_VIDEO_CAPTURE @@ -719,24 +719,24 @@ static void Host_Init (void) if (i && i + 1 < sys.argc) if (!sv.active && !cls.demoplayback && !cls.connect_trying) { - Cbuf_AddText(&cmd_client, va(vabuf, sizeof(vabuf), "playdemo %s\ncl_capturevideo 1\n", sys.argv[i + 1])); - Cbuf_Execute((&cmd_client)->cbuf); + Cbuf_AddText(&cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\ncl_capturevideo 1\n", sys.argv[i + 1])); + Cbuf_Execute((&cmd_local)->cbuf); } #endif if (cls.state == ca_dedicated || Sys_CheckParm("-listen")) if (!sv.active && !cls.demoplayback && !cls.connect_trying) { - Cbuf_AddText(&cmd_client, "startmap_dm\n"); - Cbuf_Execute((&cmd_client)->cbuf); + Cbuf_AddText(&cmd_local, "startmap_dm\n"); + Cbuf_Execute((&cmd_local)->cbuf); } if (!sv.active && !cls.demoplayback && !cls.connect_trying) { #ifdef CONFIG_MENU - Cbuf_AddText(&cmd_client, "togglemenu 1\n"); + Cbuf_AddText(&cmd_local, "togglemenu 1\n"); #endif - Cbuf_Execute((&cmd_client)->cbuf); + Cbuf_Execute((&cmd_local)->cbuf); } Con_DPrint("========Initialized=========\n"); diff --git a/keys.c b/keys.c index 3038eba6..902c6f91 100644 --- a/keys.c +++ b/keys.c @@ -1831,7 +1831,7 @@ void Key_EventQueue_Unblock(void) void Key_Event (int key, int ascii, qbool down) { - cmd_state_t *cmd = &cmd_client; + cmd_state_t *cmd = &cmd_local; const char *bind; qbool q; keydest_t keydest = key_dest; @@ -1909,7 +1909,7 @@ Key_Event (int key, int ascii, qbool down) { if(down) { - Con_ToggleConsole_f(&cmd_client); + Con_ToggleConsole_f(&cmd_local); tbl_keydest[key] = key_void; // esc release should go nowhere (especially not to key_menu or key_game) } return; @@ -1928,7 +1928,7 @@ Key_Event (int key, int ascii, qbool down) #endif } else - Con_ToggleConsole_f(&cmd_client); + Con_ToggleConsole_f(&cmd_local); } break; @@ -1992,7 +1992,7 @@ Key_Event (int key, int ascii, qbool down) // (special exemption for german keyboard layouts) if (con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && (key_consoleactive & KEY_CONSOLEACTIVE_USER) && (con_closeontoggleconsole.integer >= ((ascii != STRING_COLOR_TAG) ? 2 : 3) || key_linepos == 1)) { - Con_ToggleConsole_f(&cmd_client); + Con_ToggleConsole_f(&cmd_local); return; } diff --git a/libcurl.c b/libcurl.c index 9373d21a..7c73e5c4 100644 --- a/libcurl.c +++ b/libcurl.c @@ -331,16 +331,16 @@ static void Curl_CheckCommandWhenDone(void) if(numdownloads_fail == 0) { Con_DPrintf("cURL downloads occurred, executing %s\n", command_when_done); - Cbuf_AddText(&cmd_client, "\n"); - Cbuf_AddText(&cmd_client, command_when_done); - Cbuf_AddText(&cmd_client, "\n"); + Cbuf_AddText(&cmd_local, "\n"); + Cbuf_AddText(&cmd_local, command_when_done); + Cbuf_AddText(&cmd_local, "\n"); } else { Con_DPrintf("cURL downloads FAILED, executing %s\n", command_when_error); - Cbuf_AddText(&cmd_client, "\n"); - Cbuf_AddText(&cmd_client, command_when_error); - Cbuf_AddText(&cmd_client, "\n"); + Cbuf_AddText(&cmd_local, "\n"); + Cbuf_AddText(&cmd_local, command_when_error); + Cbuf_AddText(&cmd_local, "\n"); } Curl_Clear_forthismap(); } @@ -1553,7 +1553,7 @@ void Curl_Init_Commands(void) Cvar_RegisterVariable (&cl_curl_useragent); Cvar_RegisterVariable (&cl_curl_useragent_append); Cmd_AddCommand(CF_CLIENT | CF_CLIENT_FROM_SERVER, "curl", Curl_Curl_f, "download data from an URL and add to search path"); - //Cmd_AddCommand(&cmd_client, "curlcat", Curl_CurlCat_f, "display data from an URL (debugging command)"); + //Cmd_AddCommand(&cmd_local, "curlcat", Curl_CurlCat_f, "display data from an URL (debugging command)"); } /* diff --git a/menu.c b/menu.c index 95202cac..0480198c 100644 --- a/menu.c +++ b/menu.c @@ -282,7 +282,7 @@ static void M_ToggleMenu(int mode) { if(mode == 0) return; // the menu is off, and we want it off - M_Menu_Main_f (&cmd_client); + M_Menu_Main_f (&cmd_local); } else { @@ -4910,7 +4910,7 @@ void M_Draw (void) void M_KeyEvent (int key, int ascii, qbool downevent) { - cmd_state_t *cmd = &cmd_client; + cmd_state_t *cmd = &cmd_local; if (!downevent) return; switch (m_state) @@ -5378,7 +5378,7 @@ static void MP_Shutdown (void) static void MP_Init (void) { prvm_prog_t *prog = MVM_prog; - PRVM_Prog_Init(prog, &cmd_client); + PRVM_Prog_Init(prog, &cmd_local); prog->edictprivate_size = 0; // no private struct used prog->name = "menu"; diff --git a/netconn.c b/netconn.c index 1b48ac69..5dc1818f 100755 --- a/netconn.c +++ b/netconn.c @@ -2923,7 +2923,7 @@ static void RCon_Execute(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress, c if(l) { client_t *host_client_save = host_client; - Cmd_ExecuteString(&cmd_server, s, src_local, true); + Cmd_ExecuteString(&cmd_local, s, src_local, true); host_client = host_client_save; // in case it is a command that changes host_client (like restart) } diff --git a/progsvm.h b/progsvm.h index 0b624265..4f0c36b4 100644 --- a/progsvm.h +++ b/progsvm.h @@ -631,7 +631,7 @@ typedef struct prvm_prog_s struct fssearch_s *opensearches[PRVM_MAX_OPENSEARCHES]; const char * opensearches_origin[PRVM_MAX_OPENSEARCHES]; struct skeleton_s *skeletons[MAX_EDICTS]; - struct cmd_state_s *console_cmd; // points to the relevant console command interpreter for this vm (&cmd_client or &cmd_server), also used to access cvars + struct cmd_state_s *console_cmd; // points to the relevant console command interpreter for this vm (&cmd_local), also used to access cvars // buffer for storing all tempstrings created during one invocation of ExecuteProgram sizebuf_t tempstringsbuf; diff --git a/prvm_cmds.c b/prvm_cmds.c index 4990834d..590d3d5c 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -608,7 +608,7 @@ void VM_localcmd_client(prvm_prog_t *prog) char string[VM_STRINGTEMP_LENGTH]; VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_client); VM_VarString(prog, 0, string, sizeof(string)); - Cbuf_AddText(&cmd_client, string); + Cbuf_AddText(&cmd_local, string); } /* @@ -626,7 +626,7 @@ void VM_localcmd_server(prvm_prog_t *prog) char string[VM_STRINGTEMP_LENGTH]; VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_server); VM_VarString(prog, 0, string, sizeof(string)); - Cbuf_AddText(&cmd_server, string); + Cbuf_AddText(&cmd_local, string); } static qbool PRVM_Cvar_ReadOk(prvm_prog_t *prog, const char *string) @@ -1335,7 +1335,7 @@ coredump() */ void VM_coredump(prvm_prog_t *prog) { - cmd_state_t *cmd = !host_isclient.integer ? &cmd_server : &cmd_client; + cmd_state_t *cmd = !host_isclient.integer ? &cmd_local : &cmd_local; VM_SAFEPARMCOUNT(0,VM_coredump); Cbuf_AddText(cmd, "prvm_edicts "); @@ -1521,7 +1521,7 @@ void VM_changelevel(prvm_prog_t *prog) return; svs.changelevel_issued = true; - Cbuf_AddText(&cmd_server, va(vabuf, sizeof(vabuf), "changelevel %s\n", PRVM_G_STRING(OFS_PARM0))); + Cbuf_AddText(&cmd_local, va(vabuf, sizeof(vabuf), "changelevel %s\n", PRVM_G_STRING(OFS_PARM0))); } /* @@ -1669,7 +1669,7 @@ void VM_registercvar(prvm_prog_t *prog) return; // check for overlap with a command - if (Cmd_Exists(&cmd_client, name) || Cmd_Exists(&cmd_server, name)) + if (Cmd_Exists(&cmd_local, name) || Cmd_Exists(&cmd_local, name)) { VM_Warning(prog, "VM_registercvar: %s is a command\n", name); return; diff --git a/r_shadow.c b/r_shadow.c index 67cf27ce..a3442622 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -372,7 +372,7 @@ static void R_Shadow_SetShadowMode(void) } if(R_CompileShader_CheckStaticParms()) - R_GLSL_Restart_f(&cmd_client); + R_GLSL_Restart_f(&cmd_local); } qbool R_Shadow_ShadowMappingEnabled(void) @@ -597,7 +597,7 @@ static void r_shadow_newmap(void) if (r_editlights_sprcubemapnoshadowlight) { R_SkinFrame_MarkUsed(r_editlights_sprcubemapnoshadowlight); } if (r_editlights_sprselection) { R_SkinFrame_MarkUsed(r_editlights_sprselection); } if (strncmp(cl.worldname, r_shadow_mapname, sizeof(r_shadow_mapname))) - R_Shadow_EditLights_Reload_f(&cmd_client); + R_Shadow_EditLights_Reload_f(&cmd_local); } void R_Shadow_Init(void) @@ -5742,7 +5742,7 @@ static void R_Shadow_EditLights_EditAll_f(cmd_state_t *cmd) if (!light) continue; R_Shadow_SelectLight(light); - R_Shadow_EditLights_Edit_f(&cmd_client); + R_Shadow_EditLights_Edit_f(&cmd_local); } // return to old selected (to not mess editing once selection is locked) R_Shadow_SelectLight(oldselected); diff --git a/sv_ccmds.c b/sv_ccmds.c index d9e08c04..95796d5c 100644 --- a/sv_ccmds.c +++ b/sv_ccmds.c @@ -1635,7 +1635,7 @@ void SV_InitOperatorCommands(void) Cmd_AddCommand(CF_SHARED, "maxplayers", SV_MaxPlayers_f, "sets limit on how many players (or bots) may be connected to the server at once"); host.hook.SV_SendCvar = SV_SendCvar_f; - // commands that do not have automatic forwarding from cmd_client, these are internal details of the network protocol and not of interest to users (if they know what they are doing they can still use a generic "cmd prespawn" or similar) + // commands that do not have automatic forwarding from cmd_local, these are internal details of the network protocol and not of interest to users (if they know what they are doing they can still use a generic "cmd prespawn" or similar) Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "prespawn", SV_PreSpawn_f, "internal use - signon 1 (client acknowledges that server information has been received)"); Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "spawn", SV_Spawn_f, "internal use - signon 2 (client has sent player information, and is asking server to send scoreboard rankings)"); Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "begin", SV_Begin_f, "internal use - signon 3 (client asks server to start sending entities, and will go to signon 4 (playing) when the first entity update is received)"); diff --git a/sv_main.c b/sv_main.c index 10b321e2..320136dd 100644 --- a/sv_main.c +++ b/sv_main.c @@ -2268,7 +2268,7 @@ static qbool SVVM_load_edict(prvm_prog_t *prog, prvm_edict_t *ent) static void SV_VM_Setup(void) { prvm_prog_t *prog = SVVM_prog; - PRVM_Prog_Init(prog, &cmd_server); + PRVM_Prog_Init(prog, &cmd_local); // allocate the mempools // TODO: move the magic numbers/constants into #defines [9/13/2006 Black] diff --git a/svvm_cmds.c b/svvm_cmds.c index 5147a324..1f88fa7d 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -2879,7 +2879,7 @@ qbool SV_VM_ConsoleCommand (const char *text) static void VM_SV_registercommand (prvm_prog_t *prog) { VM_SAFEPARMCOUNT(1, VM_SV_registercmd); - if(!Cmd_Exists(&cmd_server, PRVM_G_STRING(OFS_PARM0))) + if(!Cmd_Exists(&cmd_local, PRVM_G_STRING(OFS_PARM0))) Cmd_AddCommand(CF_SERVER, PRVM_G_STRING(OFS_PARM0), NULL, "console command created by QuakeC"); } diff --git a/sys_shared.c b/sys_shared.c index 2149dff6..e1afbd3d 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -48,10 +48,10 @@ char *Sys_TimeString(const char *timeformat) void Sys_Quit (int returnvalue) { // Unlock mutexes because the quit command may jump directly here, causing a deadlock - if ((&cmd_client)->cbuf->lock) - Cbuf_Unlock((&cmd_client)->cbuf); - if ((&cmd_server)->cbuf->lock) - Cbuf_Unlock((&cmd_server)->cbuf); + if ((&cmd_local)->cbuf->lock) + Cbuf_Unlock((&cmd_local)->cbuf); + if ((&cmd_local)->cbuf->lock) + Cbuf_Unlock((&cmd_local)->cbuf); SV_UnlockThreadMutex(); TaskQueue_Frame(true); diff --git a/vid_sdl.c b/vid_sdl.c index 97e54735..8e76896b 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -894,7 +894,7 @@ static void IN_Move_TouchScreen_Quake(void) if (!VID_ShowingKeyboard()) { // user entered a command, close the console now - Con_ToggleConsole_f(&cmd_client); + Con_ToggleConsole_f(&cmd_local); } VID_TouchscreenArea( 0, 0, 0, 0, 0, NULL , 0.0f, NULL, NULL, &buttons[15], (keynum_t)0, NULL, 0, 0, 0, true); VID_TouchscreenArea( 0, 0, 0, 0, 0, NULL , 0.0f, NULL, move, &buttons[0], K_MOUSE4, NULL, 0, 0, 0, true); @@ -1179,7 +1179,7 @@ void Sys_SendKeyEvents( void ) // so, let's better queue it for next frame if(!sdl_needs_restart) { - Cbuf_AddText(&cmd_client, "\nr_restart\n"); + Cbuf_AddText(&cmd_local, "\nr_restart\n"); sdl_needs_restart = true; } #endif