summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2012-03-09 19:12:22 +0400
committerAndrey Nazarov <skuller@skuller.net>2012-04-03 01:25:48 +0400
commit17e81672d286d61dd36a06ab980fc4c50f10d10c (patch)
tree52908ec7b5c1ab06a1ae223f4ea383ee20fd98ec
parent73507acb9ff840b8ea7dbb002d1af4bd8b6c9900 (diff)
Print less verbose stats at demo stop.
-rw-r--r--src/cl_demo.c25
-rw-r--r--src/cl_local.h2
-rw-r--r--src/cl_parse.c2
3 files changed, 20 insertions, 9 deletions
diff --git a/src/cl_demo.c b/src/cl_demo.c
index 1405f49..51e09ee 100644
--- a/src/cl_demo.c
+++ b/src/cl_demo.c
@@ -239,10 +239,14 @@ static void emit_zero_frame(void)
cls.demo.frames_written++;
}
+static size_t format_demo_size(char *buffer, size_t size)
+{
+ return Com_FormatSizeLong(buffer, size, FS_Tell(cls.demo.recording));
+}
+
static size_t format_demo_status(char *buffer, size_t size)
{
- off_t pos = FS_Tell(cls.demo.recording);
- size_t len = Com_FormatSizeLong(buffer, size, pos);
+ size_t len = format_demo_size(buffer, size);
int min, sec, frames = cls.demo.frames_written;
sec = frames / 10; frames %= 10;
@@ -251,9 +255,16 @@ static size_t format_demo_status(char *buffer, size_t size)
len += Q_scnprintf(buffer + len, size - len, ", %d:%02d.%d",
min, sec, frames);
- if (cls.demo.frames_dropped || cls.demo.messages_dropped) {
- len += Q_scnprintf(buffer + len, size - len, ", %d/%d dropped",
- cls.demo.frames_dropped, cls.demo.messages_dropped);
+ if (cls.demo.frames_dropped) {
+ len += Q_scnprintf(buffer + len, size - len, ", %d frame%s dropped",
+ cls.demo.frames_dropped,
+ cls.demo.frames_dropped == 1 ? "" : "s");
+ }
+
+ if (cls.demo.others_dropped) {
+ len += Q_scnprintf(buffer + len, size - len, ", %d message%s dropped",
+ cls.demo.others_dropped,
+ cls.demo.others_dropped == 1 ? "" : "s");
}
return len;
@@ -288,7 +299,7 @@ void CL_Stop_f(void)
msglen = (uint32_t)-1;
FS_Write(&msglen, 4, cls.demo.recording);
- format_demo_status(buffer, sizeof(buffer));
+ format_demo_size(buffer, sizeof(buffer));
// close demofile
FS_FCloseFile(cls.demo.recording);
@@ -296,7 +307,7 @@ void CL_Stop_f(void)
cls.demo.paused = qfalse;
cls.demo.frames_written = 0;
cls.demo.frames_dropped = 0;
- cls.demo.messages_dropped = 0;
+ cls.demo.others_dropped = 0;
// print some statistics
Com_Printf("Stopped demo (%s).\n", buffer);
diff --git a/src/cl_local.h b/src/cl_local.h
index e4b9e20..020ad08 100644
--- a/src/cl_local.h
+++ b/src/cl_local.h
@@ -410,9 +410,9 @@ typedef struct client_static_s {
unsigned time_frames;
int frames_written; // number of frames written to demo file
int frames_dropped; // number of svc_frames that didn't fit
- int messages_dropped; // number of misc svc_* messages that didn't fit
int last_frame; // number of server frame the last svc_frame was written
// (for delta compression)
+ int others_dropped; // number of misc svc_* messages that didn't fit
int frames_read; // number of frames read from demo file
int last_snapshot; // number of demo frame the last snapshot was saved
int file_size;
diff --git a/src/cl_parse.c b/src/cl_parse.c
index 6902e31..582a35f 100644
--- a/src/cl_parse.c
+++ b/src/cl_parse.c
@@ -1293,7 +1293,7 @@ badbyte:
if (cls.demo.buffer.cursize + len < cls.demo.buffer.maxsize) {
SZ_Write(&cls.demo.buffer, msg_read.data + readcount, len);
} else {
- cls.demo.messages_dropped++;
+ cls.demo.others_dropped++;
}
}
}