mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
client map download fixes
never start a DL when starting a listen server to see if a map exists on the local FS, check in baseq3/maps too
This commit is contained in:
parent
76afc77856
commit
2a2fb8a946
3 changed files with 22 additions and 5 deletions
|
@ -1156,6 +1156,13 @@ void CL_NextDownload(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// qtrue if found in either "$(fs_gamedir)" or in "baseq3"
|
||||||
|
static qbool MapDL_FileExists( const char* path )
|
||||||
|
{
|
||||||
|
return FS_FileExistsEx( path, qtrue ) || FS_FileExistsEx( path, qfalse );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// returns qtrue if a download started
|
// returns qtrue if a download started
|
||||||
static qbool CL_StartDownloads()
|
static qbool CL_StartDownloads()
|
||||||
{
|
{
|
||||||
|
@ -1164,6 +1171,10 @@ static qbool CL_StartDownloads()
|
||||||
mode = 1;
|
mode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// never launch a download when starting a listen server...
|
||||||
|
if (com_sv_running->integer)
|
||||||
|
return qfalse;
|
||||||
|
|
||||||
// downloads disabled
|
// downloads disabled
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
// autodownload is disabled on the client
|
// autodownload is disabled on the client
|
||||||
|
@ -1202,7 +1213,7 @@ static qbool CL_StartDownloads()
|
||||||
const char* const serverInfo = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
|
const char* const serverInfo = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
|
||||||
const char* const mapName = Info_ValueForKey(serverInfo, "mapname");
|
const char* const mapName = Info_ValueForKey(serverInfo, "mapname");
|
||||||
const char* const mapPath = va("maps/%s.bsp", mapName);
|
const char* const mapPath = va("maps/%s.bsp", mapName);
|
||||||
if ((!exactMatch && FS_FileExists(mapPath)) || FS_FileIsInPAK(mapPath, NULL, NULL))
|
if ((!exactMatch && MapDL_FileExists(mapPath)) || FS_FileIsInPAK(mapPath, NULL, NULL))
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
|
||||||
// generate a checksum list of all the pure paks we're missing
|
// generate a checksum list of all the pure paks we're missing
|
||||||
|
@ -1967,7 +1978,7 @@ static void CL_DownloadMap( qbool forceDL )
|
||||||
const char* const mapName = Cmd_Argv(1);
|
const char* const mapName = Cmd_Argv(1);
|
||||||
if ( !forceDL ) {
|
if ( !forceDL ) {
|
||||||
const char* const mapPath = va( "maps/%s.bsp", mapName );
|
const char* const mapPath = va( "maps/%s.bsp", mapName );
|
||||||
if ( FS_FileExists(mapPath) || FS_FileIsInPAK(mapPath, NULL, NULL) ) {
|
if ( MapDL_FileExists(mapPath) || FS_FileIsInPAK(mapPath, NULL, NULL) ) {
|
||||||
Com_Printf( "Map already exists! To force the download, use /%sf\n", Cmd_Argv(0) );
|
Com_Printf( "Map already exists! To force the download, use /%sf\n", Cmd_Argv(0) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,12 @@ NOTE TTimo: this goes with FS_FOpenFileWrite for opening the file afterwards
|
||||||
*/
|
*/
|
||||||
qbool FS_FileExists( const char* file )
|
qbool FS_FileExists( const char* file )
|
||||||
{
|
{
|
||||||
const char* testpath = FS_BuildOSPath( fs_homepath->string, fs_gamedir, file );
|
return FS_FileExistsEx( file, qtrue );
|
||||||
|
}
|
||||||
|
|
||||||
|
qbool FS_FileExistsEx( const char* file, qbool curGameDir )
|
||||||
|
{
|
||||||
|
const char* testpath = FS_BuildOSPath( fs_homepath->string, curGameDir ? fs_gamedir : "baseq3", file );
|
||||||
FILE* f = fopen( testpath, "rb" );
|
FILE* f = fopen( testpath, "rb" );
|
||||||
if (f) {
|
if (f) {
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
@ -490,7 +495,7 @@ FS_SV_FileExists
|
||||||
Tests if the file exists
|
Tests if the file exists
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
qbool FS_SV_FileExists( const char *file )
|
static qbool FS_SV_FileExists( const char *file )
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *testpath;
|
char *testpath;
|
||||||
|
|
|
@ -637,7 +637,8 @@ char **FS_ListFiles( const char *directory, const char *extension, int *numfiles
|
||||||
|
|
||||||
void FS_FreeFileList( char **list );
|
void FS_FreeFileList( char **list );
|
||||||
|
|
||||||
qbool FS_FileExists( const char *file );
|
qbool FS_FileExists( const char *file ); // checks in current game dir
|
||||||
|
qbool FS_FileExistsEx( const char *file, qbool curGameDir ); // if curGameDir is qfalse, checks in "baseq3"
|
||||||
|
|
||||||
char* FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
char* FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue