botlib.log

Erik Auerswald auerswal at unix-ag.uni-kl.de
Fri Apr 21 07:31:23 EDT 2006


Hi,

my patch to change the location of the file "botlib.log" from the current
directory to the quake home directory (~/.q3a/ on linux), which has
been commited to svn by Tim Angus (thanks :-)), might have introduced
a problem for windows users: I do not know if the "fs_homepath" cvar is
empty on windows (comments in the code suggest this might be the case). If
it is, the logfile is created on the current disk in the root directory
on windows ("\botlib.log"). Someone with windows might want to check this.

Another problem with the patch is, that all other logfiles are created
in the game base directory in the home dir (~/.q3a/baseq3/ on linux for
Quake 3 Arena) except the "botlib.log". The first patch attached to this
mail corrects these two problems. The base directory for Quake 3 Arena
is hardcoded as this is done in several other places of the code.

Obviously there should be no "botlib.log" by default, it should have to
be enabled by setting the cvar logfile to 1 (as is done with the other
logfiles). The second attached patch implements this.

I've reopened bugzilla bug #2634 and attached the patches there as well.

Erik
-------------- next part --------------
Index: code/botlib/be_interface.c
===================================================================
--- code/botlib/be_interface.c	(revision 714)
+++ code/botlib/be_interface.c	(working copy)
@@ -137,12 +137,24 @@
 {
 	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");
-------------- next part --------------
Index: code/game/ai_main.c
===================================================================
--- code/game/ai_main.c	(revision 714)
+++ code/game/ai_main.c	(working copy)
@@ -1593,6 +1593,7 @@
 	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));


More information about the quake3 mailing list