From 5e5fdb7bc2a074622f51ea936b4c57249a6158a4 Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Tue, 2 Jul 2002 19:13:53 +0000 Subject: [PATCH] Kill MSG_WriteChar. --- libs/util/msg.c | 14 ++------------ nq/source/pr_cmds.c | 10 +++++----- nq/source/sv_main.c | 14 +++++++------- qw/source/cl_main.c | 4 ++-- qw/source/sv_nchan.c | 4 ++-- qw/source/sv_pr_cmds.c | 2 +- 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/libs/util/msg.c b/libs/util/msg.c index 6386a803c..effc44f78 100644 --- a/libs/util/msg.c +++ b/libs/util/msg.c @@ -49,16 +49,7 @@ static const char rcsid[] = Handles byte ordering and avoids alignment errors */ -// writing functions - -void -MSG_WriteChar (sizebuf_t *sb, unsigned int c) -{ - byte *buf; - - buf = SZ_GetSpace (sb, 1); - *buf = c; -} +// writing functions ========================================================== void MSG_WriteByte (sizebuf_t *sb, unsigned int c) @@ -173,8 +164,7 @@ MSG_WriteAngle16 (sizebuf_t *sb, float angle16) MSG_WriteShort (sb, (unsigned int) (angle16 * (65536.0 / 360.0)) & 65535); } - -// reading functions +// reading functions ========================================================== void MSG_BeginReading (msg_t *msg) diff --git a/nq/source/pr_cmds.c b/nq/source/pr_cmds.c index 9b9983672..4f4757692 100644 --- a/nq/source/pr_cmds.c +++ b/nq/source/pr_cmds.c @@ -305,7 +305,7 @@ PF_sprint (progs_t *pr) client = &svs.clients[entnum - 1]; - MSG_WriteChar (&client->message, svc_print); + MSG_WriteByte (&client->message, svc_print); MSG_WriteString (&client->message, s); } @@ -334,7 +334,7 @@ PF_centerprint (progs_t *pr) client = &svs.clients[entnum - 1]; - MSG_WriteChar (&client->message, svc_centerprint); + MSG_WriteByte (&client->message, svc_centerprint); MSG_WriteString (&client->message, s); } @@ -861,8 +861,8 @@ PF_lightstyle (progs_t *pr) for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) if (client->active || client->spawned) { - MSG_WriteChar (&client->message, svc_lightstyle); - MSG_WriteChar (&client->message, style); + MSG_WriteByte (&client->message, svc_lightstyle); + MSG_WriteByte (&client->message, style); MSG_WriteString (&client->message, val); } } @@ -1060,7 +1060,7 @@ PF_WriteByte (progs_t *pr) void PF_WriteChar (progs_t *pr) { - MSG_WriteChar (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); + MSG_WriteByte (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); } void diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index e7f2b4f3b..1e0951fa5 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -98,7 +98,7 @@ SV_StartParticle (const vec3_t org, const vec3_t dir, int color, int count) v = 127; else if (v < -128) v = -128; - MSG_WriteChar (&sv.datagram, v); + MSG_WriteByte (&sv.datagram, v); } MSG_WriteByte (&sv.datagram, count); MSG_WriteByte (&sv.datagram, color); @@ -584,16 +584,16 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) MSG_WriteShort (msg, bits); if (bits & SU_VIEWHEIGHT) - MSG_WriteChar (msg, SVvector (ent, view_ofs)[2]); + MSG_WriteByte (msg, SVvector (ent, view_ofs)[2]); if (bits & SU_IDEALPITCH) - MSG_WriteChar (msg, SVfloat (ent, idealpitch)); + MSG_WriteByte (msg, SVfloat (ent, idealpitch)); for (i = 0; i < 3; i++) { if (bits & (SU_PUNCH1 << i)) - MSG_WriteChar (msg, SVvector (ent, punchangle)[i]); + MSG_WriteByte (msg, SVvector (ent, punchangle)[i]); if (bits & (SU_VELOCITY1 << i)) - MSG_WriteChar (msg, SVvector (ent, velocity)[i] / 16); + MSG_WriteByte (msg, SVvector (ent, velocity)[i] / 16); } // [always sent] if (bits & SU_ITEMS) @@ -708,7 +708,7 @@ SV_SendNop (client_t *client) msg.maxsize = sizeof (buf); msg.cursize = 0; - MSG_WriteChar (&msg, svc_nop); + MSG_WriteByte (&msg, svc_nop); if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1) SV_DropClient (true); // if the message couldn't send, kick off @@ -859,7 +859,7 @@ SV_SendReconnect (void) msg.cursize = 0; msg.maxsize = sizeof (data); - MSG_WriteChar (&msg, svc_stufftext); + MSG_WriteByte (&msg, svc_stufftext); MSG_WriteString (&msg, "reconnect\n"); NET_SendToAll (&msg, 5); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 948c4cf1e..1c2d1fdac 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -862,7 +862,7 @@ CL_Reconnect_f (void) if (cls.state == ca_connected) { Con_Printf ("reconnecting...\n"); VID_SetCaption ("Reconnecting"); - MSG_WriteChar (&cls.netchan.message, clc_stringcmd); + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, "new"); return; } @@ -905,7 +905,7 @@ CL_ConnectionlessPacket (void) return; } Netchan_Setup (&cls.netchan, net_from, cls.qport); - MSG_WriteChar (&cls.netchan.message, clc_stringcmd); + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, "new"); CL_SetState (ca_connected); Con_Printf ("Connected.\n"); diff --git a/qw/source/sv_nchan.c b/qw/source/sv_nchan.c index e50e54745..50fd6acfd 100644 --- a/qw/source/sv_nchan.c +++ b/qw/source/sv_nchan.c @@ -137,10 +137,10 @@ void ClientReliableWrite_Char (client_t *cl, int c) { if (cl->num_backbuf) { - MSG_WriteChar (&cl->backbuf, c); + MSG_WriteByte (&cl->backbuf, c); ClientReliable_FinishWrite (cl); } else - MSG_WriteChar (&cl->netchan.message, c); + MSG_WriteByte (&cl->netchan.message, c); } void diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index 6d769b0ba..9fc0bba65 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -1070,7 +1070,7 @@ PF_WriteChar (progs_t *pr) ClientReliableCheckBlock (cl, 1); ClientReliableWrite_Char (cl, G_FLOAT (pr, OFS_PARM1)); } else - MSG_WriteChar (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); + MSG_WriteByte (WriteDest (pr), G_FLOAT (pr, OFS_PARM1)); } void