aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--code/botlib/be_interface.c14
-rw-r--r--code/game/ai_main.c3
-rw-r--r--code/qcommon/common.c21
3 files changed, 31 insertions, 7 deletions
diff --git a/code/botlib/be_interface.c b/code/botlib/be_interface.c
index b6862af..067b257 100644
--- a/code/botlib/be_interface.c
+++ b/code/botlib/be_interface.c
@@ -137,12 +137,24 @@ int Export_BotLibSetup(void)
{
int errnum;
char logfilename[MAX_QPATH];
+ char *homedir, *gamedir;
bot_developer = LibVarGetValue("bot_developer");
memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init
//initialize byte swapping (litte endian etc.)
// Swap_Init();
- Com_sprintf(logfilename, sizeof(logfilename), "%s%cbotlib.log", LibVarGetString("homedir"), PATH_SEP);
+ homedir = LibVarGetString("homedir");
+ gamedir = LibVarGetString("gamedir");
+ if (homedir[0]) {
+ if (gamedir[0]) {
+ Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, gamedir, PATH_SEP);
+ }
+ else {
+ Com_sprintf(logfilename, sizeof(logfilename), "%s%cbaseq3%cbotlib.log", homedir, PATH_SEP, PATH_SEP);
+ }
+ } else {
+ Com_sprintf(logfilename, sizeof(logfilename), "botlib.log");
+ }
Log_Open(logfilename);
//
botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");
diff --git a/code/game/ai_main.c b/code/game/ai_main.c
index f67af0e..b0cfd70 100644
--- a/code/game/ai_main.c
+++ b/code/game/ai_main.c
@@ -1593,10 +1593,11 @@ int BotInitLibrary(void) {
trap_BotLibVarSet("g_gametype", buf);
//bot developer mode and log file
trap_BotLibVarSet("bot_developer", bot_developer.string);
+ trap_Cvar_VariableStringBuffer("logfile", buf, sizeof(buf));
trap_BotLibVarSet("log", buf);
//no chatting
trap_Cvar_VariableStringBuffer("bot_nochat", buf, sizeof(buf));
- if (strlen(buf)) trap_BotLibVarSet("nochat", "0");
+ if (strlen(buf)) trap_BotLibVarSet("nochat", buf);
//visualize jump pads
trap_Cvar_VariableStringBuffer("bot_visualizejumppads", buf, sizeof(buf));
if (strlen(buf)) trap_BotLibVarSet("bot_visualizejumppads", buf);
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 1c37c5e..5708146 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -181,11 +181,22 @@ void QDECL Com_Printf( const char *fmt, ... ) {
newtime = localtime( &aclock );
logfile = FS_FOpenFileWrite( "qconsole.log" );
- Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
- if ( com_logfile->integer > 1 ) {
- // force it to not buffer so we get valid
- // data even if we are crashing
- FS_ForceFlush(logfile);
+
+ if(logfile)
+ {
+ Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
+
+ if ( com_logfile->integer > 1 )
+ {
+ // force it to not buffer so we get valid
+ // data even if we are crashing
+ FS_ForceFlush(logfile);
+ }
+ }
+ else
+ {
+ Com_Printf("Opening qconsole.log failed!\n");
+ Cvar_SetValue("logfile", 0);
}
opening_qconsole = qfalse;