/* * G_LoadBots */ static void G_LoadBots(void) { Vmcvar botsFile; int numdirs; char filename[128]; char dirlist[1024]; char* dirptr; int i; int dirlen; if(!trap_cvargeti("bot_enable")) return; g_numBots = 0; trap_cvarregister(&botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM); if(*botsFile.string) G_LoadBotsFromFile(botsFile.string); else G_LoadBotsFromFile("scripts/bots.txt"); /* get all bots from .bot files */ numdirs = trap_fsgetfilelist("scripts", ".bot", dirlist, 1024); dirptr = dirlist; for(i = 0; i < numdirs; i++, dirptr += dirlen+1){ dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); G_LoadBotsFromFile(filename); } trap_Print(va("%i bots parsed\n", g_numBots)); }
/* =============== G_LoadBots =============== */ static void G_LoadBots( void ) { vmCvar_t botsFile; int numdirs; char filename[128]; char dirlist[1024]; char* dirptr; int i; int dirlen; if ( !trap_Cvar_VariableIntegerValue( "bot_enable" ) ) { return; } g_numBots = 0; trap_Cvar_Register( &botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM ); if( *botsFile.string ) { G_LoadBotsFromFile(botsFile.string); } else { G_LoadBotsFromFile("scripts/bots.txt"); } // get all bots from .bot files numdirs = trap_FS_GetFileList("scripts", ".bot", dirlist, 1024 ); dirptr = dirlist; for (i = 0; i < numdirs; i++, dirptr += dirlen+1) { dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); G_LoadBotsFromFile(filename); } trap_Printf( va( "%i bots parsed\n", g_numBots ) ); }
/* =============== G_LoadBots =============== */ static void G_LoadBots( void ) { vmCvar_t botsFile; if ( !cvarSystem->VariableIntegerValue( "bot_enable" ) ) { return; } g_numBots = 0; cvarSystem->Register( &botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM ); if( *botsFile.string ) { G_LoadBotsFromFile(botsFile.string); } else { G_LoadBotsFromFile("scripts/bots.txt"); } // get all bots from .bot files if( og::FileList * files = og::FS->GetFileList( "scripts", ".bot" ) ) { for( int i = 0; i < files->Num(); i++ ) { G_LoadBotsFromFile( files->GetName( i ) ); } og::FS->FreeFileList( files ); } trap->Print( va( "%i bots parsed\n", g_numBots ) ); }