mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 06:42:26 +00:00
This change adds a new type of client connection state (cs_prespawned) to make sure
the client sends the prespawn, spawn, and begin commands in the correct order. This stops several interesting cheats in TF as well as the posibility of avoiding the map checksum.
This commit is contained in:
parent
06b06abc74
commit
75ecbe3032
2 changed files with 17 additions and 1 deletions
|
@ -120,7 +120,8 @@ typedef enum
|
|||
cs_zombie, // client has been disconnected, but don't reuse
|
||||
// connection for a couple seconds
|
||||
cs_connected, // has been assigned to a client_t, but not in game yet
|
||||
cs_spawned // client is fully in game
|
||||
cs_prespawned, // has sent both prespawn and spawn commands
|
||||
cs_spawned // client is fully in game (issued begin command)
|
||||
} sv_client_state_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -336,6 +336,13 @@ SV_Spawn_f (void)
|
|||
Con_Printf ("Spawn not valid -- allready spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!host_client->checksum) {
|
||||
Con_Printf ("Did not prespawn -- dropping client\n");
|
||||
SV_DropClient (host_client);
|
||||
return;
|
||||
}
|
||||
|
||||
// handle the case of a level changing while a client was connecting
|
||||
if (atoi (Cmd_Argv (1)) != svs.spawncount) {
|
||||
Con_Printf ("SV_Spawn_f from different level\n");
|
||||
|
@ -415,6 +422,9 @@ SV_Spawn_f (void)
|
|||
// when that is completed, a begin command will be issued
|
||||
ClientReliableWrite_Begin (host_client, svc_stufftext, 8);
|
||||
ClientReliableWrite_String (host_client, "skins\n");
|
||||
|
||||
// Now ready for begin command
|
||||
host_client->state = cs_prespawned;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -452,6 +462,11 @@ SV_Begin_f (void)
|
|||
|
||||
if (host_client->state == cs_spawned)
|
||||
return; // don't begin again
|
||||
if (host_client->state != cs_prespawned) {
|
||||
Con_Printf("Did not spawn before begin command -- dropping client\n");
|
||||
SV_DropClient (host_client);
|
||||
return;
|
||||
}
|
||||
|
||||
host_client->state = cs_spawned;
|
||||
|
||||
|
|
Loading…
Reference in a new issue