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
"
2
#include <
common/mutators/base.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
8
string
GameLog_ProcessIP
(
string
s)
9
{
10
if
(!
autocvar_sv_eventlog_ipv6_delimiter
)
11
return
s;
12
return
strreplace(
":"
,
"_"
, s);
13
}
14
15
void
GameLogEcho
(
string
s)
16
{
17
if
(
autocvar_sv_eventlog_files
)
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);
27
fn =
strcat
(
autocvar_sv_eventlog_files_nameprefix
, fn,
autocvar_sv_eventlog_files_namesuffix
);
28
logfile
=
fopen
(fn,
FILE_APPEND
);
29
fputs
(
logfile
,
":logversion:3\n"
);
30
}
31
if
(
logfile
>= 0)
32
{
33
if
(
autocvar_sv_eventlog_files_timestamps
)
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
}
39
if
(
autocvar_sv_eventlog_console
)
40
{
41
dedicated_print
(
strcat
(s,
"\n"
));
42
}
43
}
44
45
void
GameLogInit
()
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
54
if
(!
autocvar_g_use_ammunition
)
55
s =
strcat
(s,
":no_use_ammunition"
);
56
57
// initialiation stuff, not good in the mutator system
58
if
(
autocvar_g_pickup_items
== 0)
59
s =
strcat
(s,
":no_pickup_items"
);
60
if
(
autocvar_g_pickup_items
> 0)
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
68
if
(
autocvar_g_norecoil
)
69
s =
strcat
(s,
":norecoil"
);
70
71
GameLogEcho
(s);
72
GameLogEcho
(
":gameinfo:end"
);
73
}
74
75
void
GameLogClose
()
76
{
77
if
(
logfile_open
&&
logfile
>= 0)
78
{
79
fclose
(
logfile
);
80
logfile
= -1;
81
}
82
}
base.qh
MUTATOR_CALLHOOK
#define MUTATOR_CALLHOOK(id,...)
Definition
base.qh:143
M_ARGV
#define M_ARGV(x, type)
Definition
events.qh:17
FILE_APPEND
const float FILE_APPEND
Definition
csprogsdefs.qc:236
strlen
#define strlen
Definition
dpextensions.qh:33
GameLogInit
void GameLogInit()
Definition
gamelog.qc:45
GameLogClose
void GameLogClose()
Definition
gamelog.qc:75
GameLog_ProcessIP
string GameLog_ProcessIP(string s)
Definition
gamelog.qc:8
GameLogEcho
void GameLogEcho(string s)
Definition
gamelog.qc:15
gamelog.qh
autocvar_sv_eventlog_files
bool autocvar_sv_eventlog_files
Definition
gamelog.qh:5
autocvar_sv_eventlog_files_namesuffix
string autocvar_sv_eventlog_files_namesuffix
Definition
gamelog.qh:8
logfile_open
bool logfile_open
Definition
gamelog.qh:12
autocvar_sv_eventlog_files_timestamps
bool autocvar_sv_eventlog_files_timestamps
Definition
gamelog.qh:9
autocvar_sv_eventlog_files_counter
int autocvar_sv_eventlog_files_counter
Definition
gamelog.qh:6
autocvar_sv_eventlog_console
bool autocvar_sv_eventlog_console
Definition
gamelog.qh:4
autocvar_sv_eventlog_ipv6_delimiter
bool autocvar_sv_eventlog_ipv6_delimiter
Definition
gamelog.qh:10
autocvar_sv_eventlog_files_nameprefix
string autocvar_sv_eventlog_files_nameprefix
Definition
gamelog.qh:7
logfile
float logfile
Definition
gamelog.qh:13
itos
#define itos(i)
Definition
int.qh:6
GetMapname
string GetMapname()
Definition
intermission.qc:33
GetGametype
string GetGametype()
Definition
intermission.qc:28
intermission.qh
cvar_set
void cvar_set(string name, string value)
fclose
void fclose(float fhandle)
fputs
void fputs(float fhandle, string s)
substring
string substring(string s, float start, float length)
fopen
float fopen(string filename, float mode)
ftos
string ftos(float f)
strcat
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
autocvar_g_pickup_items
int autocvar_g_pickup_items
Definition
items.qh:10
dedicated_print
void dedicated_print(string input)
print(), but only print if the server is not local
Definition
main.qc:233
main.qh
tracing.qh
autocvar_g_norecoil
bool autocvar_g_norecoil
Definition
tracing.qh:16
world.qh
autocvar_g_use_ammunition
bool autocvar_g_use_ammunition
Definition
world.qh:7
matchid
string matchid
Definition
world.qh:63
autocvar_g_weaponarena
#define autocvar_g_weaponarena
Definition
world.qh:12
server
gamelog.qc
Generated on
for Xonotic QuakeC by
1.14.0