Source/ThunderBeast/QuakeToon/qcommon/files.c
void FS_SetGamedir (char *dir)
{
	searchpath_t	*next;

	if (strstr(dir, "..") || strstr(dir, "/")
		|| strstr(dir, "\\") || strstr(dir, ":") )
	{
		Com_Printf ("Gamedir should be a single filename, not a path\n");
		return;
	}

	//
	// free up any current game dir info
	//
	while (fs_searchpaths != fs_base_searchpaths)
	{
		if (fs_searchpaths->pack)
		{
			fclose (fs_searchpaths->pack->handle);
			Z_Free (fs_searchpaths->pack->files);
			Z_Free (fs_searchpaths->pack);
		}
		next = fs_searchpaths->next;
		Z_Free (fs_searchpaths);
		fs_searchpaths = next;
	}

	//
	// flush all data, so it will be forced to reload
	//
	if (dedicated && !dedicated->value)
		Cbuf_AddText ("vid_restart\nsnd_restart\n");

	Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);

	if (!strcmp(dir,BASEDIRNAME) || (*dir == 0))
	{
		Cvar_FullSet ("gamedir", "", CVAR_SERVERINFO|CVAR_NOSET);
		Cvar_FullSet ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
	}
	else
	{
		Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
		if (fs_cddir->string[0])
			FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
		FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
	}
}
/*
================
FS_SetGamedir

Sets the gamedir and path to a different directory.
================
*/
FS_SetGamedir
Sets the gamedir and path to a different directory.
FS_SetGamedir Sets the gamedir and path to a different directory .
void FS_SetGamedir (char *dir)
{
	searchpath_t	*next;
	if (strstr(dir, "..") || strstr(dir, "/")
		|| strstr(dir, "\\") || strstr(dir, ":") )
	{
		Com_Printf ("Gamedir should be a single filename, not a path\n");
		return;
	}
	 free up any current game dir info
	while (fs_searchpaths != fs_base_searchpaths)
	{
		if (fs_searchpaths->pack)
		{
			fclose (fs_searchpaths->pack->handle);
			Z_Free (fs_searchpaths->pack->files);
			Z_Free (fs_searchpaths->pack);
		}
		next = fs_searchpaths->next;
		Z_Free (fs_searchpaths);
		fs_searchpaths = next;
	}
	 flush all data, so it will be forced to reload
	if (dedicated && !dedicated->value)
		Cbuf_AddText ("vid_restart\nsnd_restart\n");
	Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
	if (!strcmp(dir,BASEDIRNAME) || (*dir == 0))
	{
		Cvar_FullSet ("gamedir", "", CVAR_SERVERINFO|CVAR_NOSET);
		Cvar_FullSet ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
	}
	else
	{
		Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
		if (fs_cddir->string[0])
			FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
		FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
	}
}
void FS_SetGamedir ( char * dir ) { searchpath_t * next ; if ( strstr ( dir , " " ) || strstr ( dir , " " ) || strstr ( dir , " \\ " ) || strstr ( dir , " " ) ) { Com_Printf ( " \n " ) ; return ; } while ( fs_searchpaths != fs_base_searchpaths ) { if ( fs_searchpaths -> pack ) { fclose ( fs_searchpaths -> pack -> handle ) ; Z_Free ( fs_searchpaths -> pack -> files ) ; Z_Free ( fs_searchpaths -> pack ) ; } next = fs_searchpaths -> next ; Z_Free ( fs_searchpaths ) ; fs_searchpaths = next ; } if ( dedicated && ! dedicated -> value ) Cbuf_AddText ( " \n \n " ) ; Com_sprintf ( fs_gamedir , sizeof ( fs_gamedir ) , " " , fs_basedir -> string , dir ) ; if ( ! strcmp ( dir , BASEDIRNAME ) || ( * dir == 0 ) ) { Cvar_FullSet ( " " , " " , CVAR_SERVERINFO | CVAR_NOSET ) ; Cvar_FullSet ( " " , " " , CVAR_LATCH | CVAR_SERVERINFO ) ; } else { Cvar_FullSet ( " " , dir , CVAR_SERVERINFO | CVAR_NOSET ) ; if ( fs_cddir -> string [ 0 ] ) FS_AddGameDirectory ( va ( " " , fs_cddir -> string , dir ) ) ; FS_AddGameDirectory ( va ( " " , fs_basedir -> string , dir ) ) ; } }
FS_SetGamedir
Sets the gamedir and path to a different directory.
FS_SetGamedir Sets the gamedir and path to a different directory .
// // free up any current game dir info // // // flush all data, so it will be forced to reload //