Split the gamelog code out of miscfunctions and into its own file
authorMario <mario.mario@y7mail.com>
Sat, 11 Jul 2020 13:49:25 +0000 (23:49 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 11 Jul 2020 13:49:25 +0000 (23:49 +1000)
22 files changed:
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/anticheat.qc
qcsrc/server/client.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/gamelog.qc [new file with mode: 0644]
qcsrc/server/gamelog.qh [new file with mode: 0644]
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/sv_main.qc
qcsrc/server/teamplay.qc

index 9f38cd9..4721d5e 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <common/effects/all.qh>
 #include <common/vehicles/all.qh>
 
 #include <common/effects/all.qh>
 #include <common/vehicles/all.qh>
+#include <server/gamelog.qh>
 #include <server/teamplay.qh>
 
 #include <lib/warpzone/common.qh>
 #include <server/teamplay.qh>
 
 #include <lib/warpzone/common.qh>
index 4e219ea..c08176c 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_cts.qh"
 
 #include <server/race.qh>
 #include "sv_cts.qh"
 
 #include <server/race.qh>
+#include <server/gamelog.qh>
 #include <server/items.qh>
 
 float autocvar_g_cts_finish_kill_delay;
 #include <server/items.qh>
 
 float autocvar_g_cts_finish_kill_delay;
index 32e39e2..6e333c1 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_domination.qh"
 
 #include "sv_domination.qh"
 
+#include <server/gamelog.qh>
 #include <server/teamplay.qh>
 
 bool g_domination;
 #include <server/teamplay.qh>
 
 bool g_domination;
index f3c140f..735b01b 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_keepaway.qh"
 
 #include <common/effects/all.qh>
 #include "sv_keepaway.qh"
 
 #include <common/effects/all.qh>
+#include <server/gamelog.qh>
 
 .entity ballcarried;
 
 
 .entity ballcarried;
 
index 5d52ed7..40870a7 100644 (file)
@@ -1,5 +1,7 @@
 #include "sv_keyhunt.qh"
 
 #include "sv_keyhunt.qh"
 
+#include <server/gamelog.qh>
+
 float autocvar_g_balance_keyhunt_damageforcescale;
 float autocvar_g_balance_keyhunt_delay_collect;
 float autocvar_g_balance_keyhunt_delay_damage_return;
 float autocvar_g_balance_keyhunt_damageforcescale;
 float autocvar_g_balance_keyhunt_delay_collect;
 float autocvar_g_balance_keyhunt_delay_damage_return;
index 38b7a7f..079b181 100644 (file)
@@ -1,5 +1,7 @@
 #include "sv_nexball.qh"
 
 #include "sv_nexball.qh"
 
+#include <server/gamelog.qh>
+
 .entity ballcarried;
 
 int autocvar_g_nexball_goalleadlimit;
 .entity ballcarried;
 
 int autocvar_g_nexball_goalleadlimit;
index bef3b19..baf2131 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_race.qh"
 
 #include "sv_race.qh"
 
+#include <server/gamelog.qh>
 #include <server/race.qh>
 
 #define autocvar_g_race_laps_limit cvar("g_race_laps_limit")
 #include <server/race.qh>
 
 #define autocvar_g_race_laps_limit cvar("g_race_laps_limit")
index af74e6a..2e793d1 100644 (file)
@@ -1,6 +1,8 @@
 #include "sv_minigames.qh"
 #include "minigames.qh"
 
 #include "sv_minigames.qh"
 #include "minigames.qh"
 
+#include <server/gamelog.qh>
+
 void player_clear_minigame(entity player)
 {
        CS(player).active_minigame = NULL;
 void player_clear_minigame(entity player)
 {
        CS(player).active_minigame = NULL;
index 2ec8386..6c66dd9 100644 (file)
@@ -8,6 +8,7 @@
 #include <server/g_damage.qc>
 #include <server/g_hook.qc>
 #include <server/g_world.qc>
 #include <server/g_damage.qc>
 #include <server/g_hook.qc>
 #include <server/g_world.qc>
+#include <server/gamelog.qc>
 #include <server/handicap.qc>
 #include <server/impulse.qc>
 #include <server/ipban.qc>
 #include <server/handicap.qc>
 #include <server/impulse.qc>
 #include <server/ipban.qc>
index cc27baf..06bb03d 100644 (file)
@@ -8,6 +8,7 @@
 #include <server/g_damage.qh>
 #include <server/g_hook.qh>
 #include <server/g_world.qh>
 #include <server/g_damage.qh>
 #include <server/g_hook.qh>
 #include <server/g_world.qh>
+#include <server/gamelog.qh>
 #include <server/handicap.qh>
 #include <server/impulse.qh>
 #include <server/ipban.qh>
 #include <server/handicap.qh>
 #include <server/impulse.qh>
 #include <server/ipban.qh>
index 9327a20..fa4af04 100644 (file)
@@ -3,6 +3,7 @@
 #include "antilag.qh"
 #include "autocvars.qh"
 #include "defs.qh"
 #include "antilag.qh"
 #include "autocvars.qh"
 #include "defs.qh"
+#include <server/gamelog.qh>
 #include "miscfunctions.qh"
 
 #include "command/common.qh"
 #include "miscfunctions.qh"
 
 #include "command/common.qh"
index 2c68728..5047334 100644 (file)
@@ -20,6 +20,7 @@
 #include "clientkill.qh"
 #include "cheats.qh"
 #include "g_world.qh"
 #include "clientkill.qh"
 #include "cheats.qh"
 #include "g_world.qh"
+#include <server/gamelog.qh>
 #include "race.qh"
 #include "antilag.qh"
 #include "campaign.qh"
 #include "race.qh"
 #include "antilag.qh"
 #include "campaign.qh"
index 2f5f41e..f98242a 100644 (file)
@@ -1,6 +1,7 @@
 #include "vote.qh"
 
 #include <server/defs.qh>
 #include "vote.qh"
 
 #include <server/defs.qh>
+#include <server/gamelog.qh>
 #include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
 #include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
index 33627e2..274378f 100644 (file)
@@ -3,6 +3,7 @@
 #include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "g_hook.qh"
 #include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "g_hook.qh"
+#include <server/gamelog.qh>
 #include <server/mutators/_mod.qh>
 #include "teamplay.qh"
 #include "scores.qh"
 #include <server/mutators/_mod.qh>
 #include "teamplay.qh"
 #include "scores.qh"
index 48da1b5..7acb35d 100644 (file)
@@ -11,6 +11,7 @@
 #include "command/sv_cmd.qh"
 #include "command/vote.qh"
 #include "g_hook.qh"
 #include "command/sv_cmd.qh"
 #include "command/vote.qh"
 #include "g_hook.qh"
+#include <server/gamelog.qh>
 #include "ipban.qh"
 #include "mapvoting.qh"
 #include <server/mutators/_mod.qh>
 #include "ipban.qh"
 #include "mapvoting.qh"
 #include <server/mutators/_mod.qh>
diff --git a/qcsrc/server/gamelog.qc b/qcsrc/server/gamelog.qc
new file mode 100644 (file)
index 0000000..2c61419
--- /dev/null
@@ -0,0 +1,56 @@
+#include "gamelog.qh"
+
+#include <server/autocvars.qh>
+#include <server/miscfunctions.qh>
+
+string GameLog_ProcessIP(string s)
+{
+       if(!autocvar_sv_eventlog_ipv6_delimiter)
+               return s;
+       return strreplace(":", "_", s);
+}
+
+void GameLogEcho(string s)
+{
+       if (autocvar_sv_eventlog_files)
+       {
+               if (!logfile_open)
+               {
+                       logfile_open = true;
+                       int matches = autocvar_sv_eventlog_files_counter + 1;
+                       cvar_set("sv_eventlog_files_counter", itos(matches));
+                       string fn = ftos(matches);
+                       if (strlen(fn) < 8)
+                               fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
+                       fn = strcat(autocvar_sv_eventlog_files_nameprefix, fn, autocvar_sv_eventlog_files_namesuffix);
+                       logfile = fopen(fn, FILE_APPEND);
+                       fputs(logfile, ":logversion:3\n");
+               }
+               if (logfile >= 0)
+               {
+                       if (autocvar_sv_eventlog_files_timestamps)
+                               fputs(logfile, strcat(":time:", strftime(true, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
+                       else
+                               fputs(logfile, strcat(s, "\n"));
+               }
+       }
+       if (autocvar_sv_eventlog_console)
+       {
+               dedicated_print(strcat(s, "\n"));
+       }
+}
+
+void GameLogInit()
+{
+       logfile_open = false;
+       // will be opened later
+}
+
+void GameLogClose()
+{
+       if (logfile_open && logfile >= 0)
+       {
+               fclose(logfile);
+               logfile = -1;
+       }
+}
diff --git a/qcsrc/server/gamelog.qh b/qcsrc/server/gamelog.qh
new file mode 100644 (file)
index 0000000..2fac52e
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+bool logfile_open;
+float logfile;
+
+string GameLog_ProcessIP(string s);
+
+void GameLogEcho(string s);
+
+void GameLogInit();
+
+void GameLogClose();
index 523d32b..fe8748f 100644 (file)
@@ -1,6 +1,7 @@
 #include "mapvoting.qh"
 
 #include <server/defs.qh>
 #include "mapvoting.qh"
 
 #include <server/defs.qh>
+#include <server/gamelog.qh>
 #include <server/miscfunctions.qh>
 #include "g_world.qh"
 #include "command/cmd.qh"
 #include <server/miscfunctions.qh>
 #include "g_world.qh"
 #include "command/cmd.qh"
index d4d5d34..98bd775 100644 (file)
@@ -4,6 +4,7 @@
 #include "command/common.qh"
 #include "constants.qh"
 #include "g_hook.qh"
 #include "command/common.qh"
 #include "constants.qh"
 #include "g_hook.qh"
+#include <server/gamelog.qh>
 #include "ipban.qh"
 #include <server/mutators/_mod.qh>
 #include "../common/t_items.qh"
 #include "ipban.qh"
 #include <server/mutators/_mod.qh>
 #include "../common/t_items.qh"
@@ -84,61 +85,6 @@ void dedicated_print(string input)
        if (server_is_dedicated) print(input);
 }
 
        if (server_is_dedicated) print(input);
 }
 
-string GameLog_ProcessIP(string s)
-{
-       if(!autocvar_sv_eventlog_ipv6_delimiter)
-               return s;
-       return strreplace(":", "_", s);
-}
-
-void GameLogEcho(string s)
-{
-    string fn;
-    int matches;
-
-    if (autocvar_sv_eventlog_files)
-    {
-        if (!logfile_open)
-        {
-            logfile_open = true;
-            matches = autocvar_sv_eventlog_files_counter + 1;
-            cvar_set("sv_eventlog_files_counter", itos(matches));
-            fn = ftos(matches);
-            if (strlen(fn) < 8)
-                fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
-            fn = strcat(autocvar_sv_eventlog_files_nameprefix, fn, autocvar_sv_eventlog_files_namesuffix);
-            logfile = fopen(fn, FILE_APPEND);
-            fputs(logfile, ":logversion:3\n");
-        }
-        if (logfile >= 0)
-        {
-            if (autocvar_sv_eventlog_files_timestamps)
-                fputs(logfile, strcat(":time:", strftime(true, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
-            else
-                fputs(logfile, strcat(s, "\n"));
-        }
-    }
-    if (autocvar_sv_eventlog_console)
-    {
-        dedicated_print(strcat(s, "\n"));
-    }
-}
-
-void GameLogInit()
-{
-    logfile_open = 0;
-    // will be opened later
-}
-
-void GameLogClose()
-{
-    if (logfile_open && logfile >= 0)
-    {
-        fclose(logfile);
-        logfile = -1;
-    }
-}
-
 entity findnearest(vector point, bool checkitems, vector axismod)
 {
     vector dist;
 entity findnearest(vector point, bool checkitems, vector axismod)
 {
     vector dist;
index 35fc07b..e94ee9c 100644 (file)
@@ -56,14 +56,6 @@ string formatmessage(entity this, string msg);
 /** print(), but only print if the server is not local */
 void dedicated_print(string input);
 
 /** print(), but only print if the server is not local */
 void dedicated_print(string input);
 
-string GameLog_ProcessIP(string s);
-
-void GameLogEcho(string s);
-
-void GameLogInit();
-
-void GameLogClose();
-
 void GetCvars(entity this, entity store, int f);
 
 string GetMapname();
 void GetCvars(entity this, entity store, int f);
 
 string GetMapname();
@@ -115,9 +107,6 @@ void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomo
 // copies a string to a tempstring (so one can strunzone it)
 string strcat1(string s) = #115; // FRIK_FILE
 
 // copies a string to a tempstring (so one can strunzone it)
 string strcat1(string s) = #115; // FRIK_FILE
 
-float logfile_open;
-float logfile;
-
 /*
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
 /*
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
index 531a153..0944620 100644 (file)
@@ -4,6 +4,7 @@
 #include "g_hook.qh"
 #include "g_damage.qh"
 #include "g_world.qh"
 #include "g_hook.qh"
 #include "g_damage.qh"
 #include "g_world.qh"
+#include <server/gamelog.qh>
 
 #include "bot/api.qh"
 
 
 #include "bot/api.qh"
 
index a7c7205..83f1d38 100644 (file)
@@ -1,6 +1,7 @@
 #include "teamplay.qh"
 
 #include "client.qh"
 #include "teamplay.qh"
 
 #include "client.qh"
+#include <server/gamelog.qh>
 #include "race.qh"
 #include "scores.qh"
 #include "scores_rules.qh"
 #include "race.qh"
 #include "scores.qh"
 #include "scores_rules.qh"