mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 09:51:41 +00:00
more inline avoidance
This commit is contained in:
parent
0fec378e31
commit
63c804310c
2 changed files with 115 additions and 113 deletions
|
@ -200,16 +200,6 @@ SV_Print (const char *fmt, va_list args)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
SV_Printf (const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
SV_Print (fmt, argptr);
|
||||
va_end (argptr);
|
||||
}
|
||||
|
||||
/* EVENT MESSAGES */
|
||||
|
||||
static void
|
||||
|
@ -244,91 +234,6 @@ SV_PrintToClient (client_t *cl, int level, const char *string)
|
|||
ClientReliableWrite_String (cl, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_ClientPrintf
|
||||
|
||||
Sends text across to be displayed if the level passes
|
||||
*/
|
||||
void
|
||||
SV_ClientPrintf (int recorder, client_t *cl, int level, const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
if (level < cl->messagelevel)
|
||||
return;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (recorder && sv.demorecording) {
|
||||
DemoWrite_Begin (dem_single, cl - svs.clients, strlen (string) + 3);
|
||||
MSG_WriteByte (&demo.dbuf->sz, svc_print);
|
||||
MSG_WriteByte (&demo.dbuf->sz, level);
|
||||
MSG_WriteString (&demo.dbuf->sz, string);
|
||||
}
|
||||
|
||||
SV_PrintToClient (cl, level, string);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_BroadcastPrintf
|
||||
|
||||
Sends text to all active clients
|
||||
*/
|
||||
void
|
||||
SV_BroadcastPrintf (int level, const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
client_t *cl;
|
||||
int i;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
SV_Printf ("%s", string); // print to the console
|
||||
|
||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||
if (level < cl->messagelevel)
|
||||
continue;
|
||||
if (cl->state < cs_zombie)
|
||||
continue;
|
||||
|
||||
SV_PrintToClient (cl, level, string);
|
||||
}
|
||||
|
||||
if (sv.demorecording) {
|
||||
DemoWrite_Begin (dem_all, cl - svs.clients, strlen (string) + 3);
|
||||
MSG_WriteByte (&demo.dbuf->sz, svc_print);
|
||||
MSG_WriteByte (&demo.dbuf->sz, level);
|
||||
MSG_WriteString (&demo.dbuf->sz, string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SV_BroadcastCommand
|
||||
|
||||
Sends text to all active clients
|
||||
*/
|
||||
void
|
||||
SV_BroadcastCommand (const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
if (!sv.state)
|
||||
return;
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
MSG_WriteByte (&sv.reliable_datagram, svc_stufftext);
|
||||
MSG_WriteString (&sv.reliable_datagram, string);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_Multicast
|
||||
|
||||
|
@ -1013,3 +918,98 @@ SV_SendMessagesToAll (void)
|
|||
|
||||
SV_SendClientMessages ();
|
||||
}
|
||||
|
||||
void
|
||||
SV_Printf (const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
SV_Print (fmt, argptr);
|
||||
va_end (argptr);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_ClientPrintf
|
||||
|
||||
Sends text across to be displayed if the level passes
|
||||
*/
|
||||
void
|
||||
SV_ClientPrintf (int recorder, client_t *cl, int level, const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
if (level < cl->messagelevel)
|
||||
return;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (recorder && sv.demorecording) {
|
||||
DemoWrite_Begin (dem_single, cl - svs.clients, strlen (string) + 3);
|
||||
MSG_WriteByte (&demo.dbuf->sz, svc_print);
|
||||
MSG_WriteByte (&demo.dbuf->sz, level);
|
||||
MSG_WriteString (&demo.dbuf->sz, string);
|
||||
}
|
||||
|
||||
SV_PrintToClient (cl, level, string);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_BroadcastPrintf
|
||||
|
||||
Sends text to all active clients
|
||||
*/
|
||||
void
|
||||
SV_BroadcastPrintf (int level, const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
client_t *cl;
|
||||
int i;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
SV_Printf ("%s", string); // print to the console
|
||||
|
||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||
if (level < cl->messagelevel)
|
||||
continue;
|
||||
if (cl->state < cs_zombie)
|
||||
continue;
|
||||
|
||||
SV_PrintToClient (cl, level, string);
|
||||
}
|
||||
|
||||
if (sv.demorecording) {
|
||||
DemoWrite_Begin (dem_all, cl - svs.clients, strlen (string) + 3);
|
||||
MSG_WriteByte (&demo.dbuf->sz, svc_print);
|
||||
MSG_WriteByte (&demo.dbuf->sz, level);
|
||||
MSG_WriteString (&demo.dbuf->sz, string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
SV_BroadcastCommand
|
||||
|
||||
Sends text to all active clients
|
||||
*/
|
||||
void
|
||||
SV_BroadcastCommand (const char *fmt, ...)
|
||||
{
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
if (!sv.state)
|
||||
return;
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
MSG_WriteByte (&sv.reliable_datagram, svc_stufftext);
|
||||
MSG_WriteString (&sv.reliable_datagram, string);
|
||||
}
|
||||
|
|
|
@ -95,6 +95,8 @@ cvar_t *sv_timekick_interval;
|
|||
cvar_t *sv_timecheck_fuzz;
|
||||
cvar_t *sv_timecheck_decay;
|
||||
|
||||
static void OutofBandPrintf (netadr_t where, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
// USER STRINGCMD EXECUTION host_client and sv_player will be valid.
|
||||
|
||||
/*
|
||||
|
@ -585,24 +587,6 @@ SV_NextDownload_f (void *unused)
|
|||
|
||||
}
|
||||
|
||||
static void
|
||||
OutofBandPrintf (netadr_t where, const char *fmt, ...)
|
||||
{
|
||||
char send[1024];
|
||||
va_list argptr;
|
||||
|
||||
send[0] = 0xff;
|
||||
send[1] = 0xff;
|
||||
send[2] = 0xff;
|
||||
send[3] = 0xff;
|
||||
send[4] = A2C_PRINT;
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (send + 5, sizeof (send - 5), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
Netchan_SendPacket (strlen (send) + 1, send, where);
|
||||
}
|
||||
|
||||
static void
|
||||
SV_NextUpload (void)
|
||||
{
|
||||
|
@ -1878,3 +1862,21 @@ SV_UserInit (void)
|
|||
sv_kickfake = Cvar_Get ("sv_kickfake", "1", CVAR_NONE, NULL,
|
||||
"Kick users sending to send fake talk messages");
|
||||
}
|
||||
|
||||
static void
|
||||
OutofBandPrintf (netadr_t where, const char *fmt, ...)
|
||||
{
|
||||
char send[1024];
|
||||
va_list argptr;
|
||||
|
||||
send[0] = 0xff;
|
||||
send[1] = 0xff;
|
||||
send[2] = 0xff;
|
||||
send[3] = 0xff;
|
||||
send[4] = A2C_PRINT;
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (send + 5, sizeof (send - 5), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
Netchan_SendPacket (strlen (send) + 1, send, where);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue