]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cmd: Merge cmd_client and cmd_server into cmd_local. Third time's a charm. 97/merge
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Apr 2021 18:39:54 +0000 (18:39 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Apr 2021 18:39:54 +0000 (18:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13129 d7cf8633-e32d-0410-b094-e92efae38249

25 files changed:
cl_demo.c
cl_main.c
cl_parse.c
clvm_cmds.c
cmd.c
cmd.h
csprogs.c
cvar.c
fs.c
gl_rmain.c
host.c
keys.c
libcurl.c
menu.c
mvm_cmds.c
netconn.c
progsvm.h
prvm_cmds.c
prvm_cmds.h
r_shadow.c
sv_ccmds.c
sv_main.c
svvm_cmds.c
sys_shared.c
vid_sdl.c

index a3be2148d09709c6ab33208eec19313ea9e0f585..f8fbe5b5b3ff65862093762106da16ddda50763f 100644 (file)
--- 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++;
 }
 
@@ -274,7 +274,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)
@@ -531,7 +531,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
index c55c543e3537e2d48470b840016e3148f56c5564..e468e92a861074404f7d56786d76dc51019958a1 100644 (file)
--- 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)
@@ -555,8 +555,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)
                {
index 98c415ab1cfff6b225a6b61abc119d5def358ffd..39d1bbe4f534605297bea10d54cd769eaca88a23 100644 (file)
@@ -500,7 +500,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);
@@ -940,7 +940,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);
 
@@ -949,7 +949,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
@@ -1619,7 +1619,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");
@@ -1920,7 +1920,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
@@ -3695,7 +3695,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:
@@ -4204,7 +4204,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)
@@ -4307,7 +4307,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)
index ff68d4f8b4a0b2509a49fd5012002449604d59b0..1be822db3ae115043aff8ab8fedb35791c27a83d 100644 (file)
@@ -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");
 }
 
@@ -4982,7 +4982,7 @@ NULL,                                                     // #42 (QUAKE)
 VM_fabs,                                               // #43 float(float f) fabs (QUAKE)
 NULL,                                                  // #44 vector(entity e, float speed) aim (QUAKE)
 VM_cvar,                                               // #45 float(string s) cvar (QUAKE)
-VM_localcmd_client,                            // #46 void(string s) localcmd (QUAKE)
+VM_localcmd_local,                             // #46 void(string s) localcmd (QUAKE)
 VM_nextent,                                            // #47 entity(entity e) nextent (QUAKE)
 VM_CL_particle,                                        // #48 void(vector o, vector d, float color, float count) particle (QUAKE)
 VM_changeyaw,                                  // #49 void() ChangeYaw (QUAKE)
diff --git a/cmd.c b/cmd.c
index 903b923b2fb8f3c1d66fded30c658d0590ef8b69..7632fa14ff6cf22d78b70c3210e2d75f2ffa445a 100644 (file)
--- 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;
@@ -503,12 +502,7 @@ static void Cbuf_Frame_Input(void)
        char *line;
 
        while ((line = Sys_ConsoleInput()))
-       {
-               if (cls.state == ca_dedicated)
-                       Cbuf_AddText(cmd_server, line);
-               else
-                       Cbuf_AddText(cmd_client, line);
-       }
+                       Cbuf_AddText(cmd_local, line);
 }
 
 void Cbuf_Frame(cmd_buf_t *cbuf)
@@ -1662,24 +1656,19 @@ void Cmd_Init(void)
        cbuf->free.prev = cbuf->free.next = &(cbuf->free);
 
        // FIXME: Get rid of cmd_iter_all eventually. This is just a hack to reduce the amount of work to make the interpreters dynamic.
-       cmd_iter_all = (cmd_iter_t *)Mem_Alloc(tempmempool, sizeof(cmd_iter_t) * 4);
+       cmd_iter_all = (cmd_iter_t *)Mem_Alloc(tempmempool, sizeof(cmd_iter_t) * 3);
 
-       // client console can see server cvars because the user may start a server
-       cmd_iter_all[0].cmd = cmd_client = Cmd_AddInterpreter(cbuf, &cvars_all, CF_CLIENT | CF_SERVER, CF_CLIENT | CF_CLIENT_FROM_SERVER, &cmd_userdefined_all);
-       cmd_client->Handle = Cmd_CL_Callback;
-       cmd_client->NotFound = NULL;
-
-       // dedicated server console can only see server cvars, there is no client
-       cmd_iter_all[1].cmd = cmd_server = Cmd_AddInterpreter(cbuf, &cvars_all, CF_SERVER, CF_SERVER, &cmd_userdefined_all);
-       cmd_server->Handle = Cmd_SV_Callback;
-       cmd_server->NotFound = NULL;
+       // local console
+       cmd_iter_all[0].cmd = cmd_local = Cmd_AddInterpreter(cbuf, &cvars_all, CF_CLIENT | CF_SERVER, CF_CLIENT | CF_CLIENT_FROM_SERVER | CF_SERVER_FROM_CLIENT, &cmd_userdefined_all);
+       cmd_local->Handle = Cmd_CL_Callback;
+       cmd_local->NotFound = NULL;
 
        // server commands received from clients have no reason to access cvars, cvar expansion seems perilous.
-       cmd_iter_all[2].cmd = cmd_serverfromclient = Cmd_AddInterpreter(cbuf, &cvars_null, 0, CF_SERVER_FROM_CLIENT | CF_USERINFO, &cmd_userdefined_null);
+       cmd_iter_all[1].cmd = cmd_serverfromclient = Cmd_AddInterpreter(cbuf, &cvars_null, 0, CF_SERVER_FROM_CLIENT | CF_USERINFO, &cmd_userdefined_null);
        cmd_serverfromclient->Handle = Cmd_SV_Callback;
        cmd_serverfromclient->NotFound = Cmd_SV_NotFound;
 
-       cmd_iter_all[3].cmd = NULL;
+       cmd_iter_all[2].cmd = NULL;
 //
 // register our commands
 //
@@ -1850,7 +1839,7 @@ void Cmd_AddCommand(int flags, const char *cmd_name, xcommand_t function, const
        cmd_state_t *cmd;
        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)
@@ -2167,6 +2156,18 @@ void Cmd_ClearCSQCCommands (cmd_state_t *cmd)
 
 extern cvar_t sv_cheats;
 
+/*
+ * Cloudwalk FIXME: This idea sounded great in my head but...
+ * How do we handle commands that can be received by the client,
+ * but which the server can also execute locally?
+ * 
+ * If we create a callback where the engine will forward to server
+ * but try to execute the command locally if it's dedicated,
+ * we're back to intermixing client and server code which I'm
+ * trying to avoid. There's no other way I can think of to
+ * implement that behavior that doesn't involve an #ifdef, or
+ * making a mess of hooks.
+ */
 qbool Cmd_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, cmd_source_t src)
 {
        if (func->function)
@@ -2178,15 +2179,27 @@ qbool Cmd_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, cmd
 
 qbool Cmd_CL_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, cmd_source_t src)
 {
-       if(func->qcfunc && (func->flags & CF_CLIENT))
-               return CL_VM_ConsoleCommand(text);
-       else if ((func->flags & CF_SERVER_FROM_CLIENT) && src == src_local)
+       // TODO: Assign these functions to QC commands directly?
+       if(func->qcfunc)
        {
-               CL_ForwardToServer_f(cmd);
-               return true;
+               if(((func->flags & CF_CLIENT) && CL_VM_ConsoleCommand(text)) ||
+                  ((func->flags & CF_SERVER) && SV_VM_ConsoleCommand(text)))
+                       return true;
        }
-       else
-               return Cmd_Callback(cmd, func, text, src);
+       if (func->flags & CF_SERVER_FROM_CLIENT)
+       {
+               if(host_isclient.integer)
+               {
+                       CL_ForwardToServer_f(cmd);
+                       return true;
+               }
+               else if(!(func->flags & CF_SERVER))
+               {
+                       Con_Printf("Cannot execute client commands from a dedicated server console.\n");
+                       return true;
+               }
+       }
+       return Cmd_Callback(cmd, func, text, src);
 }
 
 qbool Cmd_SV_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, cmd_source_t src)
@@ -2201,8 +2214,7 @@ qbool Cmd_SV_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text,
                        func->function(cmd);
                return true;
        }
-       else
-               return Cmd_Callback(cmd, func, text, src);
+       return false;
 }
 
 qbool Cmd_SV_NotFound(cmd_state_t *cmd, cmd_function_t *func, const char *text, cmd_source_t src)
diff --git a/cmd.h b/cmd.h
index ffcd3c033eec8fd8545e7bb2a9f48d0410dd22f9..58c8a742067520430f77872f1dc0993e4ac53c72 100644 (file)
--- a/cmd.h
+++ b/cmd.h
@@ -166,12 +166,9 @@ typedef struct cmd_input_s
 extern cmd_userdefined_t cmd_userdefined_all; // aliases and csqc functions
 extern cmd_userdefined_t cmd_userdefined_null; // intentionally empty
 
-// command interpreter for client commands injected by CSQC, MQC or client engine code
+// command interpreter for local commands injected by SVQC, CSQC, MQC, server or client engine code
 // uses cmddefs_all
-extern cmd_state_t *cmd_client;
-// 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;
index 3c90ff138281745fadcf5159c756eb3c42b967ee..08b67d93aeec099b064f66c41ca4330d6c3cacde 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -555,7 +555,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;
        }
@@ -587,7 +587,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')
@@ -595,13 +595,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
@@ -615,7 +615,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
 }
 
@@ -1040,7 +1040,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);
@@ -1140,7 +1140,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 b4f18c6b30e9104c107a0a9cd585a4cf12f63754..68c65441f98d9f91cdb6c28c2687520f0c826bd0 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -621,7 +621,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;
@@ -685,7 +685,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 182d05f3ef55eb04d624e15d72a43ea457095232..a925ff3164743ff6ec191f04111fc17adfa7c436 100644 (file)
--- 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;
 }
index 6b37179ea9134dcb790596e71f9e9212fd6eec55..3efa46d2042499b24b106bef687b5505d42512fc 100644 (file)
@@ -3197,7 +3197,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));
@@ -5632,7 +5632,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 5c50ba791499266d80394d0f7392da7faf990fa0..1bba0f9e9b83f86b9b8a7cc3c16961cdb5616e84 100644 (file)
--- 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);
 }
 
 //============================================================================
@@ -640,13 +640,13 @@ static void Host_Init (void)
 
        // here comes the not so critical stuff
 
-       Host_AddConfigText(cmd_client);
+       Host_AddConfigText(cmd_local);
 
        // if quake.rc is missing, use default
        if (!FS_FileExists("quake.rc"))
        {
-               Cbuf_AddText(cmd_client, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
-               Cbuf_Execute(cmd_client->cbuf);
+               Cbuf_AddText(cmd_local, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
+               Cbuf_Execute(cmd_local->cbuf);
        }
 
        host.state = host_active;
@@ -667,8 +667,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
@@ -677,8 +677,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
@@ -687,24 +687,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 b41f46b332d458907331625908e55375682cc126..cef9dc91d2e21286aed5e1d02702230b34fb9e74 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1832,7 +1832,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;
@@ -1910,7 +1910,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;
@@ -1929,7 +1929,7 @@ Key_Event (int key, int ascii, qbool down)
 #endif
                                        }
                                        else
-                                               Con_ToggleConsole_f(cmd_client);
+                                               Con_ToggleConsole_f(cmd_local);
                                }
                                break;
 
@@ -1993,7 +1993,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;
                }
 
index 24b20fba6e6d6d9c8210e10e73c5eba40e7c07da..c29a189426b3c3abef143d51e6ac619df817d8d1 100644 (file)
--- 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 4ef7d081c2a92cdd25b88db2b24683d1c80d4d28..2dc43ec921834070a93bf383c764274a09b0f2cc 100644 (file)
--- 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";
index 337d196bd037d5794d44f06b4c785841b78de60a..69801a04a7078fa7d4916f0da00277f1fb69983e 100644 (file)
@@ -1058,7 +1058,7 @@ void VM_cin_restart(prvm_prog_t *prog)
 static void VM_M_registercommand(prvm_prog_t *prog)
 {
        VM_SAFEPARMCOUNT(1, VM_M_registercommand);
-       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");
 }
 
@@ -1076,7 +1076,7 @@ VM_vlen,                                                          //   #9
 VM_vectoyaw,                                           //  #10
 VM_vectoangles,                                        //  #11
 VM_random,                                                     //  #12
-VM_localcmd_client,                                            //  #13
+VM_localcmd_local,                                             //  #13
 VM_cvar,                                                               //  #14
 VM_cvar_set,                                           //  #15
 VM_dprint,                                                     //  #16
index 1d52b5ad78f8f5bf8151669a6a4b303d613740e4..32fb1f35000229956fddc63b45550838526cc524 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -2938,7 +2938,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)
                        }
index c2d70f144f86b3ef1905e0146e9fa7bfc3460ea2..ea08900d2d1ae0d35d43a3db91471cb6d6e932be 100644 (file)
--- 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 or &cmd_server), also used to access cvars
 
        // buffer for storing all tempstrings created during one invocation of ExecuteProgram
        sizebuf_t                       tempstringsbuf;
index 1711d33c256b647d818cc16a89516bb78ea5d305..8658085ecfe1f630c787bfecd31635cd4b57788f 100644 (file)
@@ -623,7 +623,7 @@ void VM_break(prvm_prog_t *prog)
 
 /*
 =================
-VM_localcmd_client
+VM_localcmd_local
 
 Sends text over to the client's execution buffer
 
@@ -631,12 +631,12 @@ Sends text over to the client's execution buffer
 cmd (string, ...)
 =================
 */
-void VM_localcmd_client(prvm_prog_t *prog)
+void VM_localcmd_local(prvm_prog_t *prog)
 {
        char string[VM_STRINGTEMP_LENGTH];
-       VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_client);
+       VM_SAFEPARMCOUNTRANGE(1, 8, VM_localcmd_local);
        VM_VarString(prog, 0, string, sizeof(string));
-       Cbuf_AddText(cmd_client, string);
+       Cbuf_AddText(cmd_local, string);
 }
 
 /*
@@ -654,7 +654,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)
@@ -1363,12 +1363,11 @@ coredump()
 */
 void VM_coredump(prvm_prog_t *prog)
 {
-       cmd_state_t *cmd =      !host_isclient.integer ? cmd_server : cmd_client;
        VM_SAFEPARMCOUNT(0,VM_coredump);
 
-       Cbuf_AddText(cmd, "prvm_edicts ");
-       Cbuf_AddText(cmd, prog->name);
-       Cbuf_AddText(cmd, "\n");
+       Cbuf_AddText(cmd_local, "prvm_edicts ");
+       Cbuf_AddText(cmd_local, prog->name);
+       Cbuf_AddText(cmd_local, "\n");
 }
 
 /*
@@ -1549,7 +1548,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)));
 }
 
 /*
@@ -1697,7 +1696,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;
index c3c83b2faf588987d7c732715f6360c6da5223d8..a5555cde87db8ca68f0fb71380fcc4ada18f1842 100644 (file)
@@ -238,7 +238,7 @@ void VM_vectoangles (prvm_prog_t *prog);
 void VM_random (prvm_prog_t *prog);
 void VM_localsound(prvm_prog_t *prog);
 void VM_break (prvm_prog_t *prog);
-void VM_localcmd_client(prvm_prog_t *prog);
+void VM_localcmd_local(prvm_prog_t *prog);
 void VM_localcmd_server(prvm_prog_t *prog);
 void VM_cvar (prvm_prog_t *prog);
 void VM_cvar_string(prvm_prog_t *prog);
index 3abad9d0aff13f50b902409dd993d798318baa46..7c23361bc73c8af913057b5a886c39d9c0b2aa33 100644 (file)
@@ -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);
index 31359d0f144d092c14a38f8c72167bd9225d178c..cbd91e62e9e17912ab56664f6b3a82d3fd7c133c 100644 (file)
@@ -1627,7 +1627,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)");
index 4730fa504c22064d68ba0cf1f9601c75fa63a510..ea6cce396b6cec932f255446b12e5c926fb9ff8b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2270,7 +2270,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]
index 8de1d444699c454e342d251f2af945325262699f..e17c24ea7feb7646d1f668204b3d61441d340358 100644 (file)
@@ -2860,7 +2860,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");
 }
 
index e9b76f4bc5a0800b2a777609ca960e94e6567fbb..3c6b0356698b63bb9bf8007ff6c5c9e8820739da 100644 (file)
@@ -48,10 +48,8 @@ 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);
        SV_UnlockThreadMutex();
        TaskQueue_Frame(true);
 
index 23e9fe9cab003c16fc8372d5df457e364373d309..2fb307c52d41b65ec095bf81b7ee9f5bfed7aceb 100644 (file)
--- 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