- make NET_SVC_Delta_* static inline

- fix handling of sv_maxrate > 10000
- make SV_ExtractFromUserInfo only update netchan.rate when the rate
  is changed
- make SV_ExtractFromUserInfo use if (*val) instead of if
  (strlen(val))
This commit is contained in:
Adam Olsen 2001-11-28 21:33:41 +00:00
parent 7f10b0f237
commit 980fd84300
3 changed files with 13 additions and 11 deletions

View file

@ -765,7 +765,7 @@ NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg)
}
// this is a sub-block, not a real block
void
static inline void
NET_SVC_Delta_Emit (entity_state_t *es, unsigned int bits, sizebuf_t *buf)
{
// bytes of bits: [EXT2][EXT1][ORIG][MORE]
@ -824,7 +824,7 @@ NET_SVC_Delta_Emit (entity_state_t *es, unsigned int bits, sizebuf_t *buf)
}
// this is a sub-block, not a real block
static void
static inline void
NET_SVC_Delta_Parse (entity_state_t *es, unsigned int bits, msg_t *msg)
{
// bytes of bits: [EXT2][EXT1][ORIG][MORE]

View file

@ -222,6 +222,7 @@ typedef struct client_s
//===== NETWORK ============
int chokecount;
int last_rate;
int delta_sequence; // -1 = no compression
netchan_t netchan;
int msecs, msec_cheating;

View file

@ -882,6 +882,7 @@ SVC_DirectConnect (void)
newcl->edict = ent;
// parse some info from the info strings
newcl->last_rate = 0;
SV_ExtractFromUserinfo (newcl);
// JACK: Init the floodprot stuff.
@ -2201,6 +2202,8 @@ SV_ExtractFromUserinfo (client_t *cl)
client_t *client;
int i;
qboolean badname = false;
int newrate;
int maxrate;
// name from the info string
val = Info_ValueForKey (cl->userinfo, "name");
@ -2298,20 +2301,18 @@ SV_ExtractFromUserinfo (client_t *cl)
// rate command
val = Info_ValueForKey (cl->userinfo, "rate");
if (strlen (val)) {
i = atoi (val);
newrate = *val ? atoi (val) : 2500;
maxrate = sv_maxrate->int_val ?: 10000;
if ((sv_maxrate->int_val) && (i > sv_maxrate->int_val)) {
i = bound (500, i, sv_maxrate->int_val);
} else {
i = bound (500, i, 10000);
}
cl->netchan.rate = 1.0 / i;
newrate = bound (500, newrate, maxrate);
if (newrate != cl->last_rate) {
cl->last_rate = newrate;
cl->netchan.rate = 1.0 / newrate;
}
// msg command
val = Info_ValueForKey (cl->userinfo, "msg");
if (strlen (val)) {
if (*val) {
cl->messagelevel = atoi (val);
}