From: terencehill Date: Tue, 31 May 2022 11:24:43 +0000 (+0000) Subject: Merge branch 'bones_was_here/matchid_eventlog' into 'master' X-Git-Tag: xonotic-v0.8.5~24 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=7694d3a08ee8c23663b5e2be32a43e40a43cd2e0;hp=4062b39f5ba3a6c754cc7bbb9d9adc3a55776b99 Merge branch 'bones_was_here/matchid_eventlog' into 'master' Always use a monotonic matchid to prevent random rejections by xonstat See merge request xonotic/xonotic-data.pk3dir!1019 --- diff --git a/qcsrc/server/gamelog.qc b/qcsrc/server/gamelog.qc index f89cf18a03..1b308d0940 100644 --- a/qcsrc/server/gamelog.qc +++ b/qcsrc/server/gamelog.qc @@ -1,5 +1,7 @@ #include "gamelog.qh" - +#include // GetGametype(), GetMapname() +#include // autocvar_g_norecoil +#include // matchid #include string GameLog_ProcessIP(string s) @@ -41,8 +43,32 @@ void GameLogEcho(string s) void GameLogInit() { - logfile_open = false; - // will be opened later + GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", matchid)); + string s = ":gameinfo:mutators:LIST"; + + MUTATOR_CALLHOOK(BuildMutatorsString, s); + s = M_ARGV(0, string); + + // initialiation stuff, not good in the mutator system + if(!autocvar_g_use_ammunition) + s = strcat(s, ":no_use_ammunition"); + + // initialiation stuff, not good in the mutator system + if(autocvar_g_pickup_items == 0) + s = strcat(s, ":no_pickup_items"); + if(autocvar_g_pickup_items > 0) + s = strcat(s, ":pickup_items"); + + // initialiation stuff, not good in the mutator system + if(autocvar_g_weaponarena != "0") + s = strcat(s, ":", autocvar_g_weaponarena, " arena"); + + // TODO to mutator system + if(autocvar_g_norecoil) + s = strcat(s, ":norecoil"); + + GameLogEcho(s); + GameLogEcho(":gameinfo:end"); } void GameLogClose() diff --git a/qcsrc/server/gamelog.qh b/qcsrc/server/gamelog.qh index f96679b819..99ac37c3c7 100644 --- a/qcsrc/server/gamelog.qh +++ b/qcsrc/server/gamelog.qh @@ -9,7 +9,7 @@ string autocvar_sv_eventlog_files_namesuffix; bool autocvar_sv_eventlog_files_timestamps; bool autocvar_sv_eventlog_ipv6_delimiter = false; -bool logfile_open; +bool logfile_open = false; float logfile; string GameLog_ProcessIP(string s); diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index fca7c17414..6c2e4a3f71 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,6 @@ #include #include #include -#include #include const float LATENCY_THINKRATE = 10; @@ -844,46 +842,15 @@ spawnfunc(worldspawn) WaypointSprite_Init(); - GameLogInit(); // prepare everything // NOTE for matchid: // changing the logic generating it is okay. But: // it HAS to stay <= 64 chars // character set: ASCII 33-126 without the following characters: : ; ' " \ $ - 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"; - - MUTATOR_CALLHOOK(BuildMutatorsString, s); - s = M_ARGV(0, string); - - // initialiation stuff, not good in the mutator system - if(!autocvar_g_use_ammunition) - s = strcat(s, ":no_use_ammunition"); - - // initialiation stuff, not good in the mutator system - if(autocvar_g_pickup_items == 0) - s = strcat(s, ":no_pickup_items"); - if(autocvar_g_pickup_items > 0) - s = strcat(s, ":pickup_items"); + // 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)); - // initialiation stuff, not good in the mutator system - if(autocvar_g_weaponarena != "0") - s = strcat(s, ":", autocvar_g_weaponarena, " arena"); - - // TODO to mutator system - if(autocvar_g_norecoil) - s = strcat(s, ":norecoil"); - - GameLogEcho(s); - GameLogEcho(":gameinfo:end"); - } - else - matchid = strzone(ftos(random())); + if(autocvar_sv_eventlog) + GameLogInit(); // requires matchid to be set cvar_set("nextmap", "");