]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Always use a monotonic matchid to prevent random rejections by xonstat
authorbones_was_here <bones_was_here@xa.org.au>
Wed, 11 May 2022 21:17:15 +0000 (07:17 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Wed, 11 May 2022 21:17:15 +0000 (07:17 +1000)
qcsrc/server/world.qc

index fca7c1741497e7a092245ad376744a1b3e4b630a..35d3caab557c83fe45376717da49a878c6b95aa9 100644 (file)
@@ -849,14 +849,12 @@ spawnfunc(worldspawn)
        // changing the logic generating it is okay. But:
        // it HAS to stay <= 64 chars
        // character set: ASCII 33-126 without the following characters: : ; ' " \ $
+       // strftime(false, "%s") isn't reliable, see strftime_s description
+       matchid = strzone(sprintf("%d.%s.%06d", autocvar_sv_eventlog_files_counter, strftime_s(), random() * 1000000));
        if(autocvar_sv_eventlog)
        {
-               string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description
-               string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), num, floor(random() * 1000000));
-               matchid = strzone(s);
-
-               GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
-               s = ":gameinfo:mutators:LIST";
+               GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", matchid));
+               string s = ":gameinfo:mutators:LIST";
 
                MUTATOR_CALLHOOK(BuildMutatorsString, s);
                s = M_ARGV(0, string);
@@ -882,8 +880,6 @@ spawnfunc(worldspawn)
                GameLogEcho(s);
                GameLogEcho(":gameinfo:end");
        }
-       else
-               matchid = strzone(ftos(random()));
 
        cvar_set("nextmap", "");