Added an option to restart the filesystem (to add pak files etc).

This will be used by the various download functions.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1492 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-10-16 12:49:15 +00:00
parent 293cacfca4
commit aeff202074

View file

@ -2008,6 +2008,68 @@ char *FS_GenerateClientPacksList(char *buffer, int maxlen, int basechecksum)
return buffer;
}
/*
================
FS_ReloadPackFiles
================
Called when the client has downloaded a new pak/pk3 file
*/
void FS_ReloadPackFiles(void)
{
searchpath_t *oldpaths;
searchpath_t *oldbase;
searchpath_t *next;
//a lame way to fix pure paks
#ifndef SERVERONLY
if (cls.state)
{
CL_Disconnect_f();
CL_Reconnect_f();
}
#endif
FS_FlushFSHash();
oldpaths = com_searchpaths;
com_searchpaths = NULL;
com_purepaths = NULL;
oldbase = com_base_searchpaths;
com_base_searchpaths = NULL;
//invert the order
next = NULL;
while(oldpaths)
{
oldpaths->nextpure = next;
next = oldpaths;
oldpaths = oldpaths->next;
}
oldpaths = next;
com_base_searchpaths = NULL;
while(oldpaths)
{
next = oldpaths->nextpure;
if (oldbase == oldpaths)
com_base_searchpaths = com_searchpaths;
if (oldpaths->funcs == &osfilefuncs)
COM_AddGameDirectory(oldpaths->handle);
oldpaths->funcs->ClosePath(oldpaths->handle);
Z_Free(oldpaths);
oldpaths = next;
}
if (!com_base_searchpaths)
com_base_searchpaths = com_searchpaths;
}
/*
================
COM_InitFilesystem
@ -2023,6 +2085,8 @@ void COM_InitFilesystem (void)
int gamenum=-1;
Cmd_AddCommand("fs_restart", FS_ReloadPackFiles);
//
// -basedir <path>
// Overrides the system supplied base directory (under id1)