add a recorder count to the status bar

... and this found the problem with the weird qtv behaviour on map change:
changing maps causes the server to add a new connection for the proxy. oops
This commit is contained in:
Bill Currie 2010-01-13 06:48:20 +00:00 committed by Jeff Teunissen
parent edabbd5abe
commit b05e9ea293
3 changed files with 32 additions and 0 deletions

View file

@ -47,5 +47,6 @@ struct sizebuf_s *SVR_Datagram (void);
void SVR_ForceFrame (void);
void SVR_SetDelta (recorder_t *r, int delta, int in_frame);
void SVR_SendMessages (void);
int SVR_NumRecorders (void);
#endif//__sv_recorder_h

View file

@ -623,3 +623,14 @@ SVR_SetDelta (recorder_t *r, int delta, int in_frame)
if (in_frame != -1)
r->delta.in_frame = in_frame & UPDATE_MASK;
}
int
SVR_NumRecorders (void)
{
recorder_t *rec;
int count;
for (count = 0, rec = sv.recorders; rec; count++, rec = rec->next)
;
return count;
}

View file

@ -41,6 +41,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "server.h"
#include "sv_console.h"
#include "sv_recorder.h"
static void
draw_cpu (view_t *view)
@ -65,6 +66,20 @@ draw_cpu (view_t *view)
}
}
static void
draw_rec (view_t *view)
{
sv_view_t *sv_view = view->data;
sv_sbar_t *sb = sv_view->obj;
const char *str;
const char *s;
char *d;
str = va ("[REC: %d]", SVR_NumRecorders ());
for (s = str, d = sb->text + view->xrel; *s; s++)
*d++ = *s;
}
void
SV_Sbar_Init (void)
{
@ -79,4 +94,9 @@ SV_Sbar_Init (void)
view->draw = draw_cpu;
view->data = status->data;
view_add (status, view);
view = view_new (11, 0, 8, 1, grav_northwest);
view->draw = draw_rec;
view->data = status->data;
view_add (status, view);
}