Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
gamelog.qc
Go to the documentation of this file.
1#include "gamelog.qh"
3#include <server/intermission.qh> // GetGametype(), GetMapname()
4#include <server/weapons/tracing.qh> // autocvar_g_norecoil
5#include <server/world.qh> // matchid
6#include <server/main.qh>
7
8string GameLog_ProcessIP(string s)
9{
11 return s;
12 return strreplace(":", "_", s);
13}
14
15void GameLogEcho(string s)
16{
18 {
19 if (!logfile_open)
20 {
21 logfile_open = true;
22 int matches = autocvar_sv_eventlog_files_counter + 1;
23 cvar_set("sv_eventlog_files_counter", itos(matches));
24 string fn = ftos(matches);
25 if (strlen(fn) < 8)
26 fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
29 fputs(logfile, ":logversion:3\n");
30 }
31 if (logfile >= 0)
32 {
34 fputs(logfile, strcat(":time:", strftime(true, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
35 else
36 fputs(logfile, strcat(s, "\n"));
37 }
38 }
40 {
41 dedicated_print(strcat(s, "\n"));
42 }
43}
44
46{
47 GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", matchid));
48 string s = ":gameinfo:mutators:LIST";
49
50 MUTATOR_CALLHOOK(BuildMutatorsString, s);
51 s = M_ARGV(0, string);
52
53 // initialiation stuff, not good in the mutator system
55 s = strcat(s, ":no_use_ammunition");
56
57 // initialiation stuff, not good in the mutator system
59 s = strcat(s, ":no_pickup_items");
61 s = strcat(s, ":pickup_items");
62
63 // initialiation stuff, not good in the mutator system
64 if(autocvar_g_weaponarena != "0")
65 s = strcat(s, ":", autocvar_g_weaponarena, " arena");
66
67 // TODO to mutator system
69 s = strcat(s, ":norecoil");
70
71 GameLogEcho(s);
72 GameLogEcho(":gameinfo:end");
73}
74
76{
77 if (logfile_open && logfile >= 0)
78 {
80 logfile = -1;
81 }
82}
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
#define M_ARGV(x, type)
Definition events.qh:17
const float FILE_APPEND
#define strlen
void GameLogInit()
Definition gamelog.qc:45
void GameLogClose()
Definition gamelog.qc:75
string GameLog_ProcessIP(string s)
Definition gamelog.qc:8
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog_files
Definition gamelog.qh:5
string autocvar_sv_eventlog_files_namesuffix
Definition gamelog.qh:8
bool logfile_open
Definition gamelog.qh:12
bool autocvar_sv_eventlog_files_timestamps
Definition gamelog.qh:9
int autocvar_sv_eventlog_files_counter
Definition gamelog.qh:6
bool autocvar_sv_eventlog_console
Definition gamelog.qh:4
bool autocvar_sv_eventlog_ipv6_delimiter
Definition gamelog.qh:10
string autocvar_sv_eventlog_files_nameprefix
Definition gamelog.qh:7
float logfile
Definition gamelog.qh:13
#define itos(i)
Definition int.qh:6
string GetMapname()
string GetGametype()
void cvar_set(string name, string value)
void fclose(float fhandle)
void fputs(float fhandle, string s)
string substring(string s, float start, float length)
float fopen(string filename, float mode)
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
int autocvar_g_pickup_items
Definition items.qh:10
void dedicated_print(string input)
print(), but only print if the server is not local
Definition main.qc:233
bool autocvar_g_norecoil
Definition tracing.qh:16
bool autocvar_g_use_ammunition
Definition world.qh:7
string matchid
Definition world.qh:63
#define autocvar_g_weaponarena
Definition world.qh:12