From: divverent Date: Sun, 13 Apr 2008 14:17:10 +0000 (+0000) Subject: fix "wrong ping times" issue once and for all (I don't see another fix that wouldn... X-Git-Tag: xonotic-v0.1.0preview~2274 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8f105d4de2272df9dd09f502e7a250cf50b0ebcc;p=xonotic%2Fdarkplaces.git fix "wrong ping times" issue once and for all (I don't see another fix that wouldn't at the same time re-enable a speedhack) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8255 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/client.h b/client.h index 0401a277..7a96a475 100644 --- a/client.h +++ b/client.h @@ -355,8 +355,9 @@ typedef struct usercmd_s vec_t cursor_fraction; int cursor_entitynumber; - double time; - double receivetime; + double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime) + double receivetime; // time the move was received at + double clienttime; // time to which server state the move corresponds to int msec; // for predicted moves int buttons; int impulse; diff --git a/sv_user.c b/sv_user.c index 0bc1090f..525cf97b 100644 --- a/sv_user.c +++ b/sv_user.c @@ -461,7 +461,7 @@ void SV_ReadClientMove (void) // read ping time if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5 && sv.protocol != PROTOCOL_DARKPLACES6) move->sequence = MSG_ReadLong (); - move->time = MSG_ReadFloat (); + move->time = move->clienttime = MSG_ReadFloat (); if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__); move->receivetime = (float)sv.time; @@ -645,9 +645,9 @@ void SV_ExecuteClientMoves(void) } // calculate average ping time - host_client->ping = host_client->cmd.receivetime - host_client->cmd.time; + host_client->ping = host_client->cmd.receivetime - host_client->cmd.clienttime; #ifdef NUM_PING_TIMES - host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.time; + host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.clienttime; host_client->num_pings++; for (i=0, total = 0;i < NUM_PING_TIMES;i++) total += host_client->ping_times[i];