MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SV_AddServerCommand

Function SV_AddServerCommand

code/server/sv_main.cpp:96–111  ·  view source on GitHub ↗

====================== SV_AddServerCommand The given command will be transmitted to the client, and is guaranteed to not have future snapshot_t executed before it is executed ====================== */

Source from the content-addressed store, hash-verified

94======================
95*/
96void SV_AddServerCommand( client_t *client, const char *cmd ) {
97 int index;
98
99 // if we would be losing an old command that hasn't been acknowledged,
100 // we must drop the connection
101 if ( client->reliableSequence - client->reliableAcknowledge > MAX_RELIABLE_COMMANDS ) {
102 SV_DropClient( client, "Server command overflow" );
103 return;
104 }
105 client->reliableSequence++;
106 index = client->reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 );
107 if ( client->reliableCommands[ index ] ) {
108 Z_Free( client->reliableCommands[ index ] );
109 }
110 client->reliableCommands[ index ] = CopyString( cmd );
111}
112
113
114/*

Callers 1

SV_SendServerCommandFunction · 0.70

Calls 3

SV_DropClientFunction · 0.70
Z_FreeFunction · 0.50
CopyStringFunction · 0.50

Tested by

no test coverage detected