Cleaning up some logic and coding style.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2400 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-10-05 22:10:09 +00:00
parent b4cb2a66b6
commit 83bcdc0cc7
2 changed files with 23 additions and 15 deletions

View file

@ -498,14 +498,14 @@ void SV_DropClient (client_t *drop)
drop->frameunion.frames = NULL; drop->frameunion.frames = NULL;
} }
if (svs.gametype != GT_PROGS) //gamecode should do it all for us. if (svs.gametype == GT_PROGS) //gamecode should do it all for us.
return; {
// send notification to all remaining clients // send notification to all remaining clients
SV_FullClientUpdate (drop, &sv.reliable_datagram, 0); SV_FullClientUpdate (drop, &sv.reliable_datagram, 0);
#ifdef NQPROT #ifdef NQPROT
SVNQ_FullClientUpdate (drop, &sv.nqreliable_datagram); SVNQ_FullClientUpdate (drop, &sv.nqreliable_datagram);
#endif #endif
}
if (drop->controlled) if (drop->controlled)
{ {
@ -3594,17 +3594,21 @@ void SV_ExtractFromUserinfo (client_t *cl)
if (strncmp(newname, cl->name, sizeof(cl->namebuf)-1)) if (strncmp(newname, cl->name, sizeof(cl->namebuf)-1))
{ {
if (cl->ismuted) if (cl->ismuted && *cl->name)
SV_ClientTPrintf (cl, PRINT_HIGH, STL_NONAMEASMUTE); SV_ClientTPrintf (cl, PRINT_HIGH, STL_NONAMEASMUTE);
else else
{ {
Info_SetValueForKey (cl->userinfo, "name", newname, sizeof(cl->userinfo)); Info_SetValueForKey (cl->userinfo, "name", newname, sizeof(cl->userinfo));
if (!sv.paused) { if (!sv.paused && *cl->name)
if (!cl->lastnametime || realtime - cl->lastnametime > 5) { {
if (!cl->lastnametime || realtime - cl->lastnametime > 5)
{
cl->lastnamecount = 0; cl->lastnamecount = 0;
cl->lastnametime = realtime; cl->lastnametime = realtime;
} else if (cl->lastnamecount++ > 4) { }
else if (cl->lastnamecount++ > 4)
{
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTKICKEDNAMESPAM, cl->name); SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTKICKEDNAMESPAM, cl->name);
SV_ClientTPrintf (cl, PRINT_HIGH, STL_YOUWEREKICKEDNAMESPAM); SV_ClientTPrintf (cl, PRINT_HIGH, STL_YOUWEREKICKEDNAMESPAM);
SV_DropClient (cl); SV_DropClient (cl);
@ -3612,7 +3616,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
} }
} }
if (cl->state >= cs_spawned && !cl->spectator) if (*cl->name && cl->state >= cs_spawned && !cl->spectator)
{ {
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTNAMECHANGE, cl->name, val); SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTNAMECHANGE, cl->name, val);
} }

View file

@ -4102,23 +4102,27 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
// (also extra inside parm on all SV_RunCmds that follow) // (also extra inside parm on all SV_RunCmds that follow)
// To prevent a infinite loop // To prevent a infinite loop
if (!recurse) { if (!recurse)
{
host_client->msecs += ucmd->msec; host_client->msecs += ucmd->msec;
if ((tmp_time = realtime - host_client->last_check) >= sv_cheatspeedchecktime.value) { if ((tmp_time = realtime - host_client->last_check) >= sv_cheatspeedchecktime.value)
{
tmp_time = tmp_time * 1000.0 * sv_cheatpc.value/100.0; tmp_time = tmp_time * 1000.0 * sv_cheatpc.value/100.0;
if (host_client->msecs > tmp_time) { if (host_client->msecs > tmp_time)
{
host_client->msec_cheating++; host_client->msec_cheating++;
SV_BroadcastTPrintf(PRINT_HIGH, SV_BroadcastTPrintf(PRINT_HIGH,
STL_SPEEDCHEATPOSSIBLE, STL_SPEEDCHEATPOSSIBLE,
host_client->msecs, tmp_time, host_client->msecs, tmp_time,
host_client->msec_cheating, host_client->name); host_client->msec_cheating, host_client->name);
if (host_client->msec_cheating >= 2) { if (host_client->msec_cheating >= 2)
{
SV_BroadcastTPrintf(PRINT_HIGH, SV_BroadcastTPrintf(PRINT_HIGH,
STL_SPEEDCHEATKICKED, STL_SPEEDCHEATKICKED,
host_client->name, NET_AdrToString(host_client->netchan.remote_address)); host_client->name, NET_AdrToString(host_client->netchan.remote_address));
SV_DropClient(host_client); host_client->drop = true; //drop later
} }
} }