mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-17 09:34:27 +00:00
- botlib logfile now gets stored in the fs_game directory in fs_homepath. (patch from Erik Auerswald)
- Added proper error handling when fopening qconsole.log - Fixed bug where r_chat.c gets loaded in botlib even when bot_nochat is 1.
This commit is contained in:
parent
57cc0f901e
commit
e7daf33d8e
3 changed files with 31 additions and 7 deletions
|
@ -137,12 +137,24 @@ int Export_BotLibSetup(void)
|
||||||
{
|
{
|
||||||
int errnum;
|
int errnum;
|
||||||
char logfilename[MAX_QPATH];
|
char logfilename[MAX_QPATH];
|
||||||
|
char *homedir, *gamedir;
|
||||||
|
|
||||||
bot_developer = LibVarGetValue("bot_developer");
|
bot_developer = LibVarGetValue("bot_developer");
|
||||||
memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init
|
memset( &botlibglobals, 0, sizeof(botlibglobals) ); // bk001207 - init
|
||||||
//initialize byte swapping (litte endian etc.)
|
//initialize byte swapping (litte endian etc.)
|
||||||
// Swap_Init();
|
// 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);
|
Log_Open(logfilename);
|
||||||
//
|
//
|
||||||
botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");
|
botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");
|
||||||
|
|
|
@ -1593,10 +1593,11 @@ int BotInitLibrary(void) {
|
||||||
trap_BotLibVarSet("g_gametype", buf);
|
trap_BotLibVarSet("g_gametype", buf);
|
||||||
//bot developer mode and log file
|
//bot developer mode and log file
|
||||||
trap_BotLibVarSet("bot_developer", bot_developer.string);
|
trap_BotLibVarSet("bot_developer", bot_developer.string);
|
||||||
|
trap_Cvar_VariableStringBuffer("logfile", buf, sizeof(buf));
|
||||||
trap_BotLibVarSet("log", buf);
|
trap_BotLibVarSet("log", buf);
|
||||||
//no chatting
|
//no chatting
|
||||||
trap_Cvar_VariableStringBuffer("bot_nochat", buf, sizeof(buf));
|
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
|
//visualize jump pads
|
||||||
trap_Cvar_VariableStringBuffer("bot_visualizejumppads", buf, sizeof(buf));
|
trap_Cvar_VariableStringBuffer("bot_visualizejumppads", buf, sizeof(buf));
|
||||||
if (strlen(buf)) trap_BotLibVarSet("bot_visualizejumppads", buf);
|
if (strlen(buf)) trap_BotLibVarSet("bot_visualizejumppads", buf);
|
||||||
|
|
|
@ -181,12 +181,23 @@ void QDECL Com_Printf( const char *fmt, ... ) {
|
||||||
newtime = localtime( &aclock );
|
newtime = localtime( &aclock );
|
||||||
|
|
||||||
logfile = FS_FOpenFileWrite( "qconsole.log" );
|
logfile = FS_FOpenFileWrite( "qconsole.log" );
|
||||||
|
|
||||||
|
if(logfile)
|
||||||
|
{
|
||||||
Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
|
Com_Printf( "logfile opened on %s\n", asctime( newtime ) );
|
||||||
if ( com_logfile->integer > 1 ) {
|
|
||||||
|
if ( com_logfile->integer > 1 )
|
||||||
|
{
|
||||||
// force it to not buffer so we get valid
|
// force it to not buffer so we get valid
|
||||||
// data even if we are crashing
|
// data even if we are crashing
|
||||||
FS_ForceFlush(logfile);
|
FS_ForceFlush(logfile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Com_Printf("Opening qconsole.log failed!\n");
|
||||||
|
Cvar_SetValue("logfile", 0);
|
||||||
|
}
|
||||||
|
|
||||||
opening_qconsole = qfalse;
|
opening_qconsole = qfalse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue