]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 9f38cd9c36252dfe596b2a62e92fc849d2462682..4721d5ef4e1524e174dc4a9ac113a4969ef0b8c8 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <common/effects/all.qh>
 #include <common/vehicles/all.qh>
+#include <server/gamelog.qh>
 #include <server/teamplay.qh>
 
 #include <lib/warpzone/common.qh>
index 4e219eae7e2cc9a5c97c322a709e8aed74c20ea0..c08176cf8ddef8c5a751bc08c8a4375b308822a8 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_cts.qh"
 
 #include <server/race.qh>
+#include <server/gamelog.qh>
 #include <server/items.qh>
 
 float autocvar_g_cts_finish_kill_delay;
index 32e39e204de21bad8250b8c6eeff9bba2e9b025e..6e333c17e119e81f75291b611b4f75fc11a4be3c 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_domination.qh"
 
+#include <server/gamelog.qh>
 #include <server/teamplay.qh>
 
 bool g_domination;
index f3c140fd11472c37437644e22aa3c5fe56db721f..735b01b3072f763ae0636b8da49f1015243525dd 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_keepaway.qh"
 
 #include <common/effects/all.qh>
+#include <server/gamelog.qh>
 
 .entity ballcarried;
 
index 5d52ed7cb0379916ea8841585c46c04f71718dfa..40870a7903c559a48841f5c641362140ad2057fb 100644 (file)
@@ -1,5 +1,7 @@
 #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;
index 38b7a7f53021fa74886a29bded80cdebbb435725..079b181f034b69e1bb53ab3f5cb04dcd812af948 100644 (file)
@@ -1,5 +1,7 @@
 #include "sv_nexball.qh"
 
+#include <server/gamelog.qh>
+
 .entity ballcarried;
 
 int autocvar_g_nexball_goalleadlimit;
index bef3b19712d11b83db06fd248529f242a1543c08..baf2131c80784a8f80aefa6ff925c6da3a5cff91 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_race.qh"
 
+#include <server/gamelog.qh>
 #include <server/race.qh>
 
 #define autocvar_g_race_laps_limit cvar("g_race_laps_limit")
index af74e6a5a6c601902c1da414b0a24d8d46f356b4..2e793d10a933a3f3b592697d36d8001cb8775a15 100644 (file)
@@ -1,6 +1,8 @@
 #include "sv_minigames.qh"
 #include "minigames.qh"
 
+#include <server/gamelog.qh>
+
 void player_clear_minigame(entity player)
 {
        CS(player).active_minigame = NULL;
index 2ec8386955f032bfa6d44bd4396414aea1c27f5b..6c66dd95f015f374bd6376a66059f18054ceecd2 100644 (file)
@@ -8,6 +8,7 @@
 #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>
index cc27baf120e93fab2379e7a8643c6e16a1c3c7fe..06bb03df306d21faa905473d127f9922156ed4c0 100644 (file)
@@ -8,6 +8,7 @@
 #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>
index 9327a203416598b10e37229d7909f3e34f0eb86d..fa4af040b5e367cc436e8171076e19f61cb9d2d1 100644 (file)
@@ -3,6 +3,7 @@
 #include "antilag.qh"
 #include "autocvars.qh"
 #include "defs.qh"
+#include <server/gamelog.qh>
 #include "miscfunctions.qh"
 
 #include "command/common.qh"
index 2c687286b7e503ee6b873708d21173bbeaed97eb..5047334f0a4e9025d2b54d9da8527b06c0200626 100644 (file)
@@ -20,6 +20,7 @@
 #include "clientkill.qh"
 #include "cheats.qh"
 #include "g_world.qh"
+#include <server/gamelog.qh>
 #include "race.qh"
 #include "antilag.qh"
 #include "campaign.qh"
index 2f5f41efd0e5ead00bfcbb24fd1c8cabe56f80ff..f98242ad668166f3089c15ada94bc0b774ecfd58 100644 (file)
@@ -1,6 +1,7 @@
 #include "vote.qh"
 
 #include <server/defs.qh>
+#include <server/gamelog.qh>
 #include <server/miscfunctions.qh>
 
 #include <common/command/_mod.qh>
index 33627e24a2cc2f0cd49a748098d104240289390c..274378f17e0f9ffe804a7b3780e75af6546d0f62 100644 (file)
@@ -3,6 +3,7 @@
 #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"
index 48da1b5dc9bfa6e09092a6876bf31d5bdf744f10..7acb35d69896d9f0bb16bad60448d6bdde413d2d 100644 (file)
@@ -11,6 +11,7 @@
 #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>
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 523d32bbcc4f3bcef9f22210e42c10fa5cec38ff..fe8748f3852b494f2bf19ed73803f955bfebd00a 100644 (file)
@@ -1,6 +1,7 @@
 #include "mapvoting.qh"
 
 #include <server/defs.qh>
+#include <server/gamelog.qh>
 #include <server/miscfunctions.qh>
 #include "g_world.qh"
 #include "command/cmd.qh"
index d4d5d349449163c529ab6b5223ec7056dcb5814b..98bd7756a435844daf520e25fba77de9059bca51 100644 (file)
@@ -4,6 +4,7 @@
 #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"
@@ -84,61 +85,6 @@ void dedicated_print(string 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;
index 35fc07beac4b5c51c81fed7ca02caeee37a33928..e94ee9c6ca595927bb86e9a9cc93f48f925a9aaf 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);
 
-string GameLog_ProcessIP(string s);
-
-void GameLogEcho(string s);
-
-void GameLogInit();
-
-void GameLogClose();
-
 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
 
-float logfile_open;
-float logfile;
-
 /*
 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
index 531a1537bf14a6efa183f66fc82a60bbe84cc5a4..09446203db69cf85d1588c0cdb459625244ff80e 100644 (file)
@@ -4,6 +4,7 @@
 #include "g_hook.qh"
 #include "g_damage.qh"
 #include "g_world.qh"
+#include <server/gamelog.qh>
 
 #include "bot/api.qh"
 
index a7c7205c1fb5781bec8edf30adc0dfa5a2a3fc12..83f1d38568b969c75683d730659838f4240ceacc 100644 (file)
@@ -1,6 +1,7 @@
 #include "teamplay.qh"
 
 #include "client.qh"
+#include <server/gamelog.qh>
 #include "race.qh"
 #include "scores.qh"
 #include "scores_rules.qh"