From: cloudwalk Date: Sat, 6 Jun 2020 18:11:34 +0000 (+0000) Subject: Rename a few of the fake loss and fake latency cvars X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=24e4e3c27a1e3d0f50172f735810c9c1f56072bf;p=xonotic%2Fdarkplaces.git Rename a few of the fake loss and fake latency cvars git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12646 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/lhnet.c b/lhnet.c index 40b5148b..6bacc224 100644 --- a/lhnet.c +++ b/lhnet.c @@ -1110,7 +1110,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, continue; } #ifndef STANDALONETEST - if (cl_netlocalping.value && (realtime - cl_netlocalping.value * (1.0 / 2000.0)) < p->sentdoubletime) + if (net_fakelag.value && (realtime - net_fakelag.value * (1.0 / 2000.0)) < p->sentdoubletime) continue; #endif if (value == 0 && p->destinationport == lhnetsocket->address.port) diff --git a/netconn.c b/netconn.c index b7527d74..b48e89a7 100755 --- a/netconn.c +++ b/netconn.c @@ -85,9 +85,13 @@ cvar_t net_sourceaddresscheck = {CVAR_CLIENT, "net_sourceaddresscheck", "1", "co cvar_t hostname = {CVAR_SERVER | CVAR_SAVE, "hostname", "UNNAMED", "server message to show in server browser"}; cvar_t developer_networking = {CVAR_CLIENT | CVAR_SERVER, "developer_networking", "0", "prints all received and sent packets (recommended only for debugging)"}; -cvar_t cl_netlocalping = {CVAR_CLIENT, "cl_netlocalping","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"}; -static cvar_t cl_netpacketloss_send = {CVAR_CLIENT, "cl_netpacketloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"}; -static cvar_t cl_netpacketloss_receive = {CVAR_CLIENT, "cl_netpacketloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"}; +cvar_t net_fakelag = {CVAR_CLIENT, "net_fakelag","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"}; +cvar_t cl_netlocalping = {CVAR_ALIAS, "cl_netlocalping"}; +static cvar_t net_fakeloss_send = {CVAR_CLIENT, "cl_netpacketloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"}; +static cvar_t net_fakeloss_receive = {CVAR_CLIENT, "cl_netpacketloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"}; +static cvar_t cl_netpacketloss_send = {CVAR_ALIAS, "cl_netpacketloss_send"}; +static cvar_t cl_netpacketloss_receive = {CVAR_ALIAS, "cl_netpacketloss_receive"}; + static cvar_t net_slist_queriespersecond = {CVAR_CLIENT, "net_slist_queriespersecond", "20", "how many server information requests to send per second"}; static cvar_t net_slist_queriesperframe = {CVAR_CLIENT, "net_slist_queriesperframe", "4", "maximum number of server information requests to send each rendered frame (guards against low framerates causing problems)"}; static cvar_t net_slist_timeout = {CVAR_CLIENT, "net_slist_timeout", "4", "how long to listen for a server information response before giving up"}; @@ -618,9 +622,9 @@ int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddres Thread_UnlockMutex(netconn_mutex); if (length == 0) return 0; - if (cl_netpacketloss_receive.integer) + if (net_fakeloss_receive.integer) for (i = 0;i < cl_numsockets;i++) - if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_receive.integer) + if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_receive.integer) return 0; if (developer_networking.integer) { @@ -642,9 +646,9 @@ int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const l { int ret; int i; - if (cl_netpacketloss_send.integer) + if (net_fakeloss_send.integer) for (i = 0;i < cl_numsockets;i++) - if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_send.integer) + if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_send.integer) return length; if (mysocket->address.addresstype == LHNETADDRESSTYPE_LOOP && netconn_mutex) Thread_LockMutex(netconn_mutex); @@ -3899,9 +3903,12 @@ void NetConn_Init(void) Cvar_RegisterVariable(&net_challengefloodblockingtimeout); Cvar_RegisterVariable(&net_getstatusfloodblockingtimeout); Cvar_RegisterVariable(&net_sourceaddresscheck); - Cvar_RegisterVariable(&cl_netlocalping); - Cvar_RegisterVariable(&cl_netpacketloss_send); - Cvar_RegisterVariable(&cl_netpacketloss_receive); + Cvar_RegisterVariable(&net_fakelag); + Cvar_RegisterVariable(&net_fakeloss_send); + Cvar_RegisterVariable(&net_fakeloss_receive); + Cvar_RegisterAlias(&cl_netlocalping, &net_fakelag); + Cvar_RegisterAlias(&cl_netpacketloss_send, &net_fakeloss_send); + Cvar_RegisterAlias(&cl_netpacketloss_receive, &net_fakeloss_receive); Cvar_RegisterVariable(&hostname); Cvar_RegisterVariable(&developer_networking); Cvar_RegisterVariable(&cl_netport); diff --git a/netconn.h b/netconn.h index 6f0d762e..7120c531 100755 --- a/netconn.h +++ b/netconn.h @@ -421,7 +421,7 @@ extern char sv_readstring[MAX_INPUTLINE]; extern cvar_t sv_public; -extern cvar_t cl_netlocalping; +extern cvar_t net_fakelag; extern cvar_t cl_netport; extern cvar_t sv_netport;