]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_ccmds.c
cmd: Re-re-re-implement the cbuf. This time using the new generic linked list.
[xonotic/darkplaces.git] / sv_ccmds.c
index e4fd309deb6c3202c37aadc0a9800b896720fbfd..e3331dce0995c96997267b6b8f1ee50a1e2494e4 100644 (file)
@@ -84,8 +84,9 @@ static void SV_Map_f(cmd_state_t *cmd)
        svs.serverflags = 0;                    // haven't completed an episode yet
        strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
        SV_SpawnServer(level);
-       if (sv.active && cls.state == ca_disconnected)
-               CL_EstablishConnection("local:1", -2);
+
+       if(sv.active && host.hook.ConnectLocal != NULL)
+               host.hook.ConnectLocal();
 }
 
 /*
@@ -121,8 +122,9 @@ static void SV_Changelevel_f(cmd_state_t *cmd)
        SV_SaveSpawnparms ();
        strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
        SV_SpawnServer(level);
-       if (sv.active && cls.state == ca_disconnected)
-               CL_EstablishConnection("local:1", -2);
+       
+       if(sv.active && host.hook.ConnectLocal != NULL)
+               host.hook.ConnectLocal();
 }
 
 /*
@@ -156,8 +158,9 @@ static void SV_Restart_f(cmd_state_t *cmd)
 
        strlcpy(mapname, sv.name, sizeof(mapname));
        SV_SpawnServer(mapname);
-       if (sv.active && cls.state == ca_disconnected)
-               CL_EstablishConnection("local:1", -2);
+       
+       if(sv.active && host.hook.ConnectLocal != NULL)
+               host.hook.ConnectLocal();
 }
 
 //===========================================================================
@@ -408,7 +411,7 @@ SV_Pause_f
 static void SV_Pause_f(cmd_state_t *cmd)
 {
        void (*print) (const char *fmt, ...);
-       if (cmd->source == src_command)
+       if (cmd->source == src_local)
                print = Con_Printf;
        else
                print = SV_ClientPrintf;
@@ -426,7 +429,7 @@ static void SV_Pause_f(cmd_state_t *cmd)
        }
        
        sv.paused ^= 1;
-       if (cmd->source != src_command)
+       if (cmd->source != src_local)
                SV_BroadcastPrintf("%s %spaused the game\n", host_client->name, sv.paused ? "" : "un");
        else if(*(sv_adminnick.string))
                SV_BroadcastPrintf("%s %spaused the game\n", sv_adminnick.string, sv.paused ? "" : "un");
@@ -448,18 +451,10 @@ static void SV_Say(cmd_state_t *cmd, qboolean teamonly)
        char text[1024];
        qboolean fromServer = false;
 
-       if (cmd->source == src_command)
+       if (cmd->source == src_local)
        {
-               if (cls.state == ca_dedicated)
-               {
-                       fromServer = true;
-                       teamonly = false;
-               }
-               else
-               {
-                       CL_ForwardToServer_f(cmd);
-                       return;
-               }
+               fromServer = true;
+               teamonly = false;
        }
 
        if (Cmd_Argc (cmd) < 2)
@@ -526,16 +521,8 @@ static void SV_Tell_f(cmd_state_t *cmd)
        char text[MAX_INPUTLINE]; // LadyHavoc: FIXME: temporary buffer overflow fix (was 64)
        qboolean fromServer = false;
 
-       if (cmd->source == src_command)
-       {
-               if (cls.state == ca_dedicated)
-                       fromServer = true;
-               else
-               {
-                       CL_ForwardToServer_f(cmd);
-                       return;
-               }
-       }
+       if (cmd->source == src_local)
+               fromServer = true;
 
        if (Cmd_Argc (cmd) < 2)
                return;
@@ -655,16 +642,8 @@ static void SV_Ping_f(cmd_state_t *cmd)
        client_t *client;
        void (*print) (const char *fmt, ...);
 
-       if (cmd->source == src_command)
-       {
-               // if running a client, try to send over network so the client's ping report parser will see the report
-               if (cls.state == ca_connected)
-               {
-                       CL_ForwardToServer_f(cmd);
-                       return;
-               }
+       if (cmd->source == src_local)
                print = Con_Printf;
-       }
        else
                print = SV_ClientPrintf;
 
@@ -817,7 +796,7 @@ static void SV_Status_f(cmd_state_t *cmd)
        int frags;
        char vabuf[1024];
 
-       if (cmd->source == src_command)
+       if (cmd->source == src_local)
                print = Con_Printf;
        else
                print = SV_ClientPrintf;
@@ -879,7 +858,7 @@ static void SV_Status_f(cmd_state_t *cmd)
                        ping = bound(0, (int)floor(client->ping*1000+0.5), 9999);
                }
 
-               if(sv_status_privacy.integer && cmd->source != src_command && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
+               if(sv_status_privacy.integer && cmd->source != src_local && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
                        strlcpy(ip, client->netconnection ? "hidden" : "botclient", 48);
                else
                        strlcpy(ip, (client->netconnection && *client->netconnection->address) ? client->netconnection->address : "botclient", 48);
@@ -969,7 +948,7 @@ static void SV_Name_f(cmd_state_t *cmd)
 
        strlcpy(newName, newNameSource, sizeof(newName));
 
-       if (cmd->source == src_command)
+       if (cmd->source == src_local)
                return;
 
        if (host.realtime < host_client->nametime && strcmp(newName, host_client->name))
@@ -1057,7 +1036,7 @@ static void SV_Rate_f(cmd_state_t *cmd)
 
        rate = atoi(Cmd_Argv(cmd, 1));
 
-       if (cmd->source == src_command)
+       if (cmd->source == src_local)
                return;
 
        host_client->rate = rate;
@@ -1156,7 +1135,7 @@ static void SV_Kick_f(cmd_state_t *cmd)
 
        if (i < svs.maxclients)
        {
-               if (cmd->source == src_command)
+               if (cmd->source == src_local)
                {
                        if (cls.state == ca_dedicated)
                                who = "Console";
@@ -1508,7 +1487,7 @@ static void SV_Ent_Create_f(cmd_state_t *cmd)
 {
        prvm_prog_t *prog = SVVM_prog;
        prvm_edict_t *ed;
-       ddef_t *key;
+       mdef_t *key;
        int i;
        qboolean haveorigin;