]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_user.c
fix for server dying when someone times out
[xonotic/darkplaces.git] / sv_user.c
index 135a6d50abfb370bf1e7bd6ad3f8792d285b4546..152ec7849a9199a54748c4d2d22dec22eef75eb4 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -534,7 +534,7 @@ nextmsg:
                ret = NET_GetMessage (host_client->netconnection);
                if (ret == -1)
                {
-                       Sys_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
+                       Con_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n");
                        return false;
                }
                if (!ret)
@@ -550,7 +550,7 @@ nextmsg:
 
                        if (msg_badread)
                        {
-                               Sys_Printf ("SV_ReadClientMessage: badread\n");
+                               Con_Printf ("SV_ReadClientMessage: badread\n");
                                return false;
                        }
 
@@ -571,7 +571,7 @@ nextmsg:
                                goto nextmsg;
 
                        default:
-                               Sys_Printf ("SV_ReadClientMessage: unknown command char %i\n", cmd);
+                               Con_Printf ("SV_ReadClientMessage: unknown command char %i\n", cmd);
                                return false;
 
                        case clc_nop:
@@ -580,29 +580,29 @@ nextmsg:
                        case clc_stringcmd:
                                s = MSG_ReadString ();
                                ret = 0;
-                               if (Q_strncasecmp(s, "status", 6) == 0
-                                || Q_strncasecmp(s, "name", 4) == 0
-                                || Q_strncasecmp(s, "say", 3) == 0
-                                || Q_strncasecmp(s, "say_team", 8) == 0
-                                || Q_strncasecmp(s, "tell", 4) == 0
-                                || Q_strncasecmp(s, "color", 5) == 0
-                                || Q_strncasecmp(s, "kill", 4) == 0
-                                || Q_strncasecmp(s, "pause", 5) == 0
-                                || Q_strncasecmp(s, "spawn", 5) == 0
-                                || Q_strncasecmp(s, "begin", 5) == 0
-                                || Q_strncasecmp(s, "prespawn", 8) == 0
-                                || Q_strncasecmp(s, "kick", 4) == 0
-                                || Q_strncasecmp(s, "ping", 4) == 0
-                                || Q_strncasecmp(s, "ban", 3) == 0
-                                || Q_strncasecmp(s, "pmodel", 6) == 0
-                                || (gamemode == GAME_NEHAHRA && (Q_strncasecmp(s, "max", 3) == 0 || Q_strncasecmp(s, "monster", 7) == 0 || Q_strncasecmp(s, "scrag", 5) == 0 || Q_strncasecmp(s, "gimme", 5) == 0 || Q_strncasecmp(s, "wraith", 6) == 0))
-                                || (gamemode != GAME_NEHAHRA && (Q_strncasecmp(s, "god", 3) == 0 || Q_strncasecmp(s, "notarget", 8) == 0 || Q_strncasecmp(s, "fly", 3) == 0 || Q_strncasecmp(s, "give", 4) == 0 || Q_strncasecmp(s, "noclip", 6) == 0)))
+                               if (strncasecmp(s, "status", 6) == 0
+                                || strncasecmp(s, "name", 4) == 0
+                                || strncasecmp(s, "say", 3) == 0
+                                || strncasecmp(s, "say_team", 8) == 0
+                                || strncasecmp(s, "tell", 4) == 0
+                                || strncasecmp(s, "color", 5) == 0
+                                || strncasecmp(s, "kill", 4) == 0
+                                || strncasecmp(s, "pause", 5) == 0
+                                || strncasecmp(s, "spawn", 5) == 0
+                                || strncasecmp(s, "begin", 5) == 0
+                                || strncasecmp(s, "prespawn", 8) == 0
+                                || strncasecmp(s, "kick", 4) == 0
+                                || strncasecmp(s, "ping", 4) == 0
+                                || strncasecmp(s, "ban", 3) == 0
+                                || strncasecmp(s, "pmodel", 6) == 0
+                                || (gamemode == GAME_NEHAHRA && (strncasecmp(s, "max", 3) == 0 || strncasecmp(s, "monster", 7) == 0 || strncasecmp(s, "scrag", 5) == 0 || strncasecmp(s, "gimme", 5) == 0 || strncasecmp(s, "wraith", 6) == 0))
+                                || (gamemode != GAME_NEHAHRA && (strncasecmp(s, "god", 3) == 0 || strncasecmp(s, "notarget", 8) == 0 || strncasecmp(s, "fly", 3) == 0 || strncasecmp(s, "give", 4) == 0 || strncasecmp(s, "noclip", 6) == 0)))
                                {
                                        ret = 1;
                                        Cmd_ExecuteString (s, src_client);
                                }
                                else
-                                       Con_DPrintf("%s tried to %s\n", host_client->name, s);
+                                       Con_Printf("%s tried to %s\n", host_client->name, s);
                                break;
 
                        case clc_disconnect:
@@ -642,8 +642,7 @@ void SV_RunClients (void)
 
                if (!SV_ReadClientMessage ())
                {
-                       // client misbehaved...
-                       SV_DropClient (false);
+                       SV_DropClient (false); // client misbehaved...
                        continue;
                }
 
@@ -665,6 +664,15 @@ void SV_RunClients (void)
                        }
                        else
                                SV_ClientThink ();
+
+                       SV_CheckVelocity (sv_player);
+
+                       // LordHavoc: a hack to ensure that the (rather silly) id1 quakec
+                       // player_run/player_stand1 does not horribly malfunction if the
+                       // velocity becomes a number that is both == 0 and != 0
+                       // (sounds to me like NaN but to be absolutely safe...)
+                       if (DotProduct(sv_player->v->velocity, sv_player->v->velocity) < 0.0001)
+                               VectorClear(sv_player->v->velocity);
                }
        }
 }