From: bones_was_here Date: Wed, 11 May 2022 21:25:33 +0000 (+1000) Subject: Put GameLogInit() code in there instead of in spawnfunc(worldspawn) X-Git-Tag: xonotic-v0.8.5~24^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1f1fa1320e2dc0234f853ae4dc29cc4d6c0d40f0;p=xonotic%2Fxonotic-data.pk3dir.git Put GameLogInit() code in there instead of in spawnfunc(worldspawn) --- diff --git a/qcsrc/server/gamelog.qc b/qcsrc/server/gamelog.qc index f89cf18a0..1b308d094 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 f96679b81..99ac37c3c 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 35d3caab5..6c2e4a3f7 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,42 +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: : ; ' " \ $ // 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) - { - 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"); - } + if(autocvar_sv_eventlog) + GameLogInit(); // requires matchid to be set cvar_set("nextmap", "");