Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions source/qcommon/mlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "qcommon.h"
#include "../qalgo/q_trie.h"
#include "mod_mem.h"


#define MLIST_CACHE "cache/mapcache.txt"
#define MLIST_NULL ""
Expand All @@ -30,8 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#define MLIST_UNKNOWN_MAPNAME "@#$"

#define MLIST_CACHE_EXISTS ( FS_FOpenFile( MLIST_CACHE, NULL, FS_READ|FS_CACHE ) > 0 )

typedef struct mapinfo_s
{
char *filename, *fullname;
Expand Down Expand Up @@ -161,7 +161,7 @@ static void ML_InitFromCache( void )
return;

// load maps from directory reading into a list
maps = temp = ( char* )Mem_TempMalloc( size + sizeof( mapdir_t ) * total );
maps = temp = Q_Malloc( size + sizeof( mapdir_t ) * total );
temp += size;
FS_GetFileList( "maps", ".bsp", maps, size, 0, 0 );
len = 0;
Expand Down Expand Up @@ -192,7 +192,7 @@ static void ML_InitFromCache( void )
FS_LoadCacheFile( MLIST_CACHE, (void **)&buffer, NULL, 0 );
if( !buffer )
{
Mem_TempFree( maps );
Q_Free( maps );
return;
}

Expand Down Expand Up @@ -251,7 +251,7 @@ static void ML_InitFromCache( void )
for( curmap = dir; curmap; curmap = curmap->next )
ML_AddMap( curmap->filename, NULL );

Mem_TempFree( maps );
Q_Free( maps );
FS_FreeFile( buffer );
}

Expand Down Expand Up @@ -398,7 +398,7 @@ void ML_Init( void )

Cmd_AddCommand( "maplist", ML_MapListCmd );

if( MLIST_CACHE_EXISTS )
if(FS_FOpenFile( MLIST_CACHE, NULL, FS_READ|FS_CACHE ) > 0 )
ML_InitFromCache();
else
ML_InitFromMaps();
Expand Down