/* =============== UI_Mods_LoadModsFromFile =============== */ static void UI_Mods_LoadModsFromFile( char *filename ) { int len; fileHandle_t f; char buf[1024]; len = UI_trap_FS_FOpenFile( filename, &f, FS_READ ); if ( !f ) { UI_trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) ); return; } if ( len >= sizeof(buf) ) { UI_trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, sizeof(buf) ) ); UI_trap_FS_FCloseFile( f ); return; } UI_trap_FS_Read( buf, len, f ); buf[len] = 0; UI_trap_FS_FCloseFile( f ); len = strlen( filename ); if( !Q_stricmp(filename + len - 4,".mod") ) { filename[len-4] = '\0'; } UI_Mods_ParseInfos( filename, buf ); }
/* =============== UI_LoadArenasFromFile =============== */ static void UI_LoadArenasFromFile( char *filename ) { int len; fileHandle_t f; char buf[MAX_ARENAS_TEXT]; len = UI_trap_FS_FOpenFile( filename, &f, FS_READ ); if ( !f ) { UI_trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) ); return; } if ( len >= MAX_ARENAS_TEXT ) { UI_trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) ); UI_trap_FS_FCloseFile( f ); return; } UI_trap_FS_Read( buf, len, f ); buf[len] = 0; UI_trap_FS_FCloseFile( f ); ui_numArenas += UI_ParseInfos( buf, MAX_ARENAS - ui_numArenas, &ui_arenaInfos[ui_numArenas] ); }
/* =============== UI_LoadBotsFromFile =============== */ static void UI_LoadBotsFromFile( char *filename ) { int len; fileHandle_t f; char buf[MAX_BOTS_TEXT]; len = UI_trap_FS_FOpenFile( filename, &f, FS_READ ); if ( !f ) { UI_trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) ); return; } if ( len >= MAX_BOTS_TEXT ) { UI_trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) ); UI_trap_FS_FCloseFile( f ); return; } UI_trap_FS_Read( buf, len, f ); buf[len] = 0; UI_trap_FS_FCloseFile( f ); ui_numBots += UI_ParseInfos( buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots] ); if (outOfMemory) UI_trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all bots\n"); }