]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Put GameLogInit() code in there instead of in spawnfunc(worldspawn)
authorbones_was_here <bones_was_here@xa.org.au>
Wed, 11 May 2022 21:25:33 +0000 (07:25 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Wed, 11 May 2022 21:56:22 +0000 (07:56 +1000)
qcsrc/server/gamelog.qc
qcsrc/server/gamelog.qh
qcsrc/server/world.qc

index f89cf18a0335c284f531de6a385e0bc5ca346a59..1b308d0940de2bcbcfb0ab9a79bcd4c76d06f5e6 100644 (file)
@@ -1,5 +1,7 @@
 #include "gamelog.qh"
-
+#include <server/intermission.qh>    // GetGametype(), GetMapname()
+#include <server/weapons/tracing.qh> // autocvar_g_norecoil
+#include <server/world.qh>           // matchid
 #include <server/main.qh>
 
 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()
index f96679b819d62eb36629bbaf9e4f9916320205cc..99ac37c3c762e8803b32634363f321db5da7af69 100644 (file)
@@ -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);
index 35d3caab557c83fe45376717da49a878c6b95aa9..6c2e4a3f71b906f18242bf69ac8220aab0b6d2ab 100644 (file)
@@ -35,7 +35,6 @@
 #include <server/damage.qh>
 #include <server/gamelog.qh>
 #include <server/hook.qh>
-#include <server/intermission.qh>
 #include <server/ipban.qh>
 #include <server/items/items.qh>
 #include <server/main.qh>
@@ -46,7 +45,6 @@
 #include <server/scores_rules.qh>
 #include <server/spawnpoints.qh>
 #include <server/teamplay.qh>
-#include <server/weapons/common.qh>
 #include <server/weapons/weaponstats.qh>
 
 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", "");