[quake3-commits] r1841 - in trunk/code: qcommon server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Feb 4 07:34:11 EST 2011


Author: thilo
Date: 2011-02-04 07:34:11 -0500 (Fri, 04 Feb 2011)
New Revision: 1841

Modified:
   trunk/code/qcommon/files.c
   trunk/code/qcommon/qcommon.h
   trunk/code/server/sv_ccmds.c
Log:
Fix banfile writing to wrong game directory


Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2011-02-04 12:04:56 UTC (rev 1840)
+++ trunk/code/qcommon/files.c	2011-02-04 12:34:11 UTC (rev 1841)
@@ -3025,10 +3025,7 @@
 		}
 	}
 
-	if(com_basegame->string[0]				&&
-	   Q_stricmp(com_basegame->string, BASEGAME)		&&
-	   !foundPak && !foundTA
-	  )
+	if(!foundPak && !foundTA && Q_stricmp(com_basegame->string, BASEGAME))
 	{
 		Cvar_Set("com_standalone", "1");
 	}
@@ -3660,3 +3657,11 @@
 	}
 	FS_FreeFileList( filenames );
 }
+
+const char *FS_GetCurrentGameDir(void)
+{
+	if(fs_gamedirvar->string[0])
+	        return fs_gamedirvar->string;
+
+        return com_basegame->string;
+}

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2011-02-04 12:04:56 UTC (rev 1840)
+++ trunk/code/qcommon/qcommon.h	2011-02-04 12:34:11 UTC (rev 1841)
@@ -714,6 +714,8 @@
 void	FS_FilenameCompletion( const char *dir, const char *ext,
 		qboolean stripExt, void(*callback)(const char *s) );
 
+const char *FS_GetCurrentGameDir(void);
+
 /*
 ==============================================================
 

Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c	2011-02-04 12:04:56 UTC (rev 1840)
+++ trunk/code/server/sv_ccmds.c	2011-02-04 12:34:11 UTC (rev 1841)
@@ -549,10 +549,7 @@
 	if(!sv_banFile->string || !*sv_banFile->string)
 		return;
 
-	if(!(curpos = Cvar_VariableString("fs_game")) || !*curpos)
-		curpos = BASEGAME;
-	
-	Com_sprintf(filepath, sizeof(filepath), "%s/%s", curpos, sv_banFile->string);
+	Com_sprintf(filepath, sizeof(filepath), "%s/%s", FS_GetCurrentGameDir(), sv_banFile->string);
 
 	if((filelen = FS_SV_FOpenFileRead(filepath, &readfrom)) >= 0)
 	{
@@ -626,15 +623,12 @@
 {
 	int index;
 	fileHandle_t writeto;
-	char *curpos, filepath[MAX_QPATH];
+	char filepath[MAX_QPATH];
 	
 	if(!sv_banFile->string || !*sv_banFile->string)
 		return;
 	
-	if(!(curpos = Cvar_VariableString("fs_game")) || !*curpos)
-		curpos = BASEGAME;
-	
-	Com_sprintf(filepath, sizeof(filepath), "%s/%s", curpos, sv_banFile->string);
+	Com_sprintf(filepath, sizeof(filepath), "%s/%s", FS_GetCurrentGameDir(), sv_banFile->string);
 
 	if((writeto = FS_SV_FOpenFileWrite(filepath)))
 	{



More information about the quake3-commits mailing list