Skip to content

Commit

Permalink
game: added time reference in log files, refs #1247
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarquis committed Apr 12, 2019
1 parent c6d650e commit b0b9fa6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/game/g_main.c
Expand Up @@ -2233,8 +2233,10 @@ void G_GetMapXP(void)
*/ */
void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, int serverVersion) void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, int serverVersion)
{ {
int i; int i;
char cs[MAX_INFO_STRING]; char cs[MAX_INFO_STRING];
time_t aclock;
char *logDate;


G_Printf("------- Game Initialization -------\ngamename: %s\ngamedate: %s\n", GAMEVERSION, __DATE__); G_Printf("------- Game Initialization -------\ngamename: %s\ngamedate: %s\n", GAMEVERSION, __DATE__);


Expand Down Expand Up @@ -2382,6 +2384,10 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
// array acces check is done in G_RegisterCvars - we won't execute this with invalid gametype // array acces check is done in G_RegisterCvars - we won't execute this with invalid gametype
G_Printf("gametype: %s\n", gameNames[g_gametype.integer]); G_Printf("gametype: %s\n", gameNames[g_gametype.integer]);


// time
time(&aclock);
G_Printf("gametime: %s\n", asctime(localtime(&aclock)));

G_ParseCampaigns(); G_ParseCampaigns();
if (g_gametype.integer == GT_WOLF_CAMPAIGN) if (g_gametype.integer == GT_WOLF_CAMPAIGN)
{ {
Expand Down Expand Up @@ -2418,10 +2424,6 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
{ {
if (trap_FS_FOpenFile(g_log.string, &level.logFile, FS_WRITE) >= 0) if (trap_FS_FOpenFile(g_log.string, &level.logFile, FS_WRITE) >= 0)
{ {
time_t aclock;
char *logDate;

time(&aclock);
logDate = va("logfile opened on %s\n", asctime(localtime(&aclock))); logDate = va("logfile opened on %s\n", asctime(localtime(&aclock)));


trap_FS_Write(logDate, strlen(logDate), level.logFile); trap_FS_Write(logDate, strlen(logDate), level.logFile);
Expand Down Expand Up @@ -2654,6 +2656,8 @@ void G_InitGame(int levelTime, int randomSeed, int restart, int legacyServer, in
*/ */
void G_ShutdownGame(int restart) void G_ShutdownGame(int restart)
{ {
time_t aclock;

#ifdef FEATURE_LUA #ifdef FEATURE_LUA
G_LuaHook_ShutdownGame(restart); G_LuaHook_ShutdownGame(restart);
G_LuaShutdown(); G_LuaShutdown();
Expand All @@ -2677,6 +2681,10 @@ void G_ShutdownGame(int restart)


G_Printf("==== ShutdownGame (%i - %s) ====\n", restart, level.rawmapname); G_Printf("==== ShutdownGame (%i - %s) ====\n", restart, level.rawmapname);


// time
time(&aclock);
G_Printf("gametime: %s\n", asctime(localtime(&aclock)));

#ifdef FEATURE_OMNIBOT #ifdef FEATURE_OMNIBOT
if (!Bot_Interface_Shutdown()) if (!Bot_Interface_Shutdown())
{ {
Expand Down

0 comments on commit b0b9fa6

Please sign in to comment.