QW-Group / mvdsv

MVDSV: a QuakeWorld server
GNU General Public License v2.0
58 stars 56 forks source link

Add laststats (connectionless packet command) and revert lastscores. #109

Closed vikpe closed 1 year ago

vikpe commented 1 year ago

Usage

laststats [<limit>]

<limit> = '0' for last 50 stats
<limit> = 'n' for last n stats (max 50)
<limit> = '' (empty) for last 10 stats

Response

results found

laststats <NUMBER_OF_RESULTS>
[
  <STAT_ENTRY_JSON_BLOB>,
  <STAT_ENTRY_JSON_BLOB>,
  [...]
]

no results found:

laststats 0
[]
tcsabina commented 1 year ago

Look good, @vikpe .

But it will still contain those ???? packet separation characters, right? Do we want to remove them?

Those are coming - I think - from SV_FlushRedirect() in sv_send.c: `void SV_FlushRedirect (void) { char send1[OUTPUTBUF_SIZE + 6];

if (sv_redirected == RD_PACKET)
{
    send1[0] = 0xff;
    send1[1] = 0xff;
    send1[2] = 0xff;
    send1[3] = 0xff;
    send1[4] = A2C_PRINT;
    memcpy (send1 + 5, outputbuf, strlen(outputbuf) + 1);

`

Those 0xff characters, exactly 4, should be those ???? things.

Now, as we don't know who or what uses them, maybe add an exception in SV_FlushRedirect() that if this is a 'laststats' call, we don't add those into the beginning of the packet. What do you think?

vikpe commented 1 year ago

But it will still contain those ???? packet separation characters, right? Do we want to remove them?

All connectionless packet commands use them, lets keep it that way.