]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_user.c
protocol/dp8: Implement parting messages
[xonotic/darkplaces.git] / sv_user.c
index 9395be62acf37d7fea8d4e6a0fe97010530e55e3..6a621bac6d293c9ec2a573187e7ee821f1f805c9 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -718,7 +718,7 @@ static void SV_ReadClientMove (void)
                }
                // as requested by FrikaC, cursor_trace_ent is reset to world if the
                // entity is free at time of receipt
-               if (PRVM_EDICT_NUM(move->cursor_entitynumber)->priv.server->free)
+               if (PRVM_EDICT_NUM(move->cursor_entitynumber)->free)
                        move->cursor_entitynumber = 0;
                if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
        }
@@ -811,7 +811,8 @@ static void SV_ExecuteClientMoves(void)
                                move->time = bound(sv.time - 1, move->time, sv.time); // prevent slowhack/speedhack combos
                                move->time = max(move->time, host_client->cmd.time); // prevent backstepping of time
                                // bones_was_here: limit moveframetime to a multiple of sv.frametime to match inputtimeout behaviour
-                               moveframetime = min(move->time - host_client->cmd.time, min(0.1, sys_ticrate.value > 0.0 ? sv.frametime * ceil(sv_clmovement_inputtimeout.value / sv.frametime) : sv_clmovement_inputtimeout.value));
+                               moveframetime = min(move->time - host_client->cmd.time, min(0.1, sys_ticrate.value > 0.0 && sv.frametime > 0.0 ? sv.frametime * ceil(sv_clmovement_inputtimeout.value / sv.frametime) : sv_clmovement_inputtimeout.value));
+
 
                                // discard (treat like lost) moves with too low distance from
                                // the previous one to prevent hacks using float inaccuracy
@@ -998,14 +999,14 @@ void SV_ReadClientMessage(void)
                if (!host_client->active)
                {
                        // a command caused an error
-                       SV_DropClient (false);
+                       SV_DropClient (false, "Connection closing");
                        return;
                }
 
                if (sv_message.badread)
                {
                        Con_Print("SV_ReadClientMessage: badread\n");
-                       SV_DropClient (false);
+                       SV_DropClient (false, "An internal server error occurred");
                        return;
                }
 
@@ -1024,7 +1025,7 @@ void SV_ReadClientMessage(void)
                        Con_Printf("SV_ReadClientMessage: unknown command char %i (at offset 0x%x)\n", netcmd, sv_message.readcount);
                        if (developer_networking.integer)
                                Com_HexDumpToConsole(sv_message.data, sv_message.cursize);
-                       SV_DropClient (false);
+                       SV_DropClient (false, "Unknown message sent to the server");
                        return;
 
                case clc_nop:
@@ -1075,7 +1076,9 @@ clc_stringcmd_invalid:
                        break;
 
                case clc_disconnect:
-                       SV_DropClient (false); // client wants to disconnect
+                       SV_DropClient (true, sv.protocol == PROTOCOL_DARKPLACES8
+                                      ? MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring))
+                                      : "Disconnect by user"); // client wants to disconnect
                        return;
 
                case clc_move: