[ioquake3] 31/39: Fix removing/creating PID file for base game when switching to/from mods
Simon McVittie
smcv at debian.org
Sat Nov 5 20:26:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit 10f33b892bc95ce27ccb1e31849a7650b959da9b
Author: Zack Middleton <zturtleman at gmail.com>
Date: Thu Oct 27 22:54:33 2016 -0500
Fix removing/creating PID file for base game when switching to/from mods
---
code/qcommon/files.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/code/qcommon/files.c b/code/qcommon/files.c
index 345907d..92a9e40 100644
--- a/code/qcommon/files.c
+++ b/code/qcommon/files.c
@@ -303,6 +303,8 @@ static char *fs_serverReferencedPakNames[MAX_SEARCH_PATHS]; // pk3 names
// last valid game folder used
char lastValidBase[MAX_OSPATH];
+char lastValidComBaseGame[MAX_OSPATH];
+char lastValidFsBaseGame[MAX_OSPATH];
char lastValidGame[MAX_OSPATH];
#ifdef FS_MISSING
@@ -3963,6 +3965,8 @@ void FS_InitFilesystem( void ) {
}
Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
+ Q_strncpyz(lastValidComBaseGame, com_basegame->string, sizeof(lastValidComBaseGame));
+ Q_strncpyz(lastValidFsBaseGame, fs_basegame->string, sizeof(lastValidFsBaseGame));
Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));
}
@@ -3973,6 +3977,7 @@ FS_Restart
================
*/
void FS_Restart( int checksumFeed ) {
+ const char *lastGameDir;
// free anything we currently have loaded
FS_Shutdown(qfalse);
@@ -3999,8 +4004,12 @@ void FS_Restart( int checksumFeed ) {
if (lastValidBase[0]) {
FS_PureServerSetLoadedPaks("", "");
Cvar_Set("fs_basepath", lastValidBase);
+ Cvar_Set("com_basegame", lastValidComBaseGame);
+ Cvar_Set("fs_basegame", lastValidFsBaseGame);
Cvar_Set("fs_game", lastValidGame);
lastValidBase[0] = '\0';
+ lastValidComBaseGame[0] = '\0';
+ lastValidFsBaseGame[0] = '\0';
lastValidGame[0] = '\0';
FS_Restart(checksumFeed);
Com_Error( ERR_DROP, "Invalid game folder" );
@@ -4009,9 +4018,11 @@ void FS_Restart( int checksumFeed ) {
Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
}
- if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) {
- Sys_RemovePIDFile( lastValidGame );
- Sys_InitPIDFile( fs_gamedirvar->string );
+ lastGameDir = ( lastValidGame[0] ) ? lastValidGame : lastValidComBaseGame;
+
+ if ( Q_stricmp( FS_GetCurrentGameDir(), lastGameDir ) ) {
+ Sys_RemovePIDFile( lastGameDir );
+ Sys_InitPIDFile( FS_GetCurrentGameDir() );
// skip the q3config.cfg if "safe" is on the command line
if ( !Com_SafeMode() ) {
@@ -4020,6 +4031,8 @@ void FS_Restart( int checksumFeed ) {
}
Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
+ Q_strncpyz(lastValidComBaseGame, com_basegame->string, sizeof(lastValidComBaseGame));
+ Q_strncpyz(lastValidFsBaseGame, fs_basegame->string, sizeof(lastValidFsBaseGame));
Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list