================= SV_SendServerCommand Sends a reliable command string to be interpreted by the client game module: "cp", "print", "chat", etc A NULL client will broadcast to all clients ================= */
| 121 | ================= |
| 122 | */ |
| 123 | void SV_SendServerCommand(client_t *cl, const char *fmt, ...) { |
| 124 | va_list argptr; |
| 125 | byte message[MAX_MSGLEN]; |
| 126 | client_t *client; |
| 127 | int j; |
| 128 | |
| 129 | message[0] = svc_serverCommand; |
| 130 | |
| 131 | va_start (argptr,fmt); |
| 132 | Q_vsnprintf( (char *)message+1, sizeof(message)-1, fmt, argptr ); |
| 133 | va_end (argptr); |
| 134 | |
| 135 | // Fix to http://aluigi.altervista.org/adv/q3msgboom-adv.txt |
| 136 | // The actual cause of the bug is probably further downstream |
| 137 | // and should maybe be addressed later, but this certainly |
| 138 | // fixes the problem for now |
| 139 | if ( strlen ((char *)message+1) > 1022 ) { |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | if ( cl != NULL ) { |
| 144 | SV_AddServerCommand( cl, (char *)message ); |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | // send the data to all relevent clients |
| 149 | for (j = 0, client = svs.clients; j < 1 ; j++, client++) { |
| 150 | if ( client->state < CS_PRIMED ) { |
| 151 | continue; |
| 152 | } |
| 153 | SV_AddServerCommand( client, (char *)message ); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | |
| 158 |
no test coverage detected