void Bot::killBot() { timer->stop(); file.close(); deleteTank(); QTimer::singleShot(2000, this, SLOT(spawnBot())); }
void spawnTestBots(void) { int i; char **testBotNames = getTestBotNames(); for (i = 0; i < getSettings()->testbots; i++) { spawnBot(testBotNames[i]); free(testBotNames[i]); } free(testBotNames); }
/* * Called from game/g_main.c/G_InitGame(). * Initializes the variables and the bots for the game. */ void qv_initEnvironment(void) { int i; int roundNum; char **botNames = malloc(sizeof(char*) * getSettings()->bots); char *botName; /* Check if testmode is on, if so go to testEnvironment */ if (getSettings()->testmode) { initTestEnvironment(); return; } roundNum = readRoundNum(); switch (roundNum) { case 0: /* Com_Printf("\n\n^4 <-------> INITIALIZING QV ENVIRONMENT <------->\n"); */ /* * during initial round (0), completely random bots must be generated * and added to bot database so genetic algorithm can start properly * (bots generated here cannot yet be loaded ingame so round 0 just * serves as setup) */ for(i = 0; i < getSettings()->bots; i++) { botNames[i] = generateBotName(roundNum + 1, QV_RANDOM_BOT_STR, (i+1)); } generateRandomGenes(roundNum + 1, botNames); startNextRound(roundNum); for(i = 0; i < getSettings()->bots; i++) { free(botNames[i]); } break; case 1: /* spawn bots generated in dummy setup round */ for(i = 0; i < getSettings()->bots; i++) { botName = generateBotName(roundNum, QV_RANDOM_BOT_STR, (i+1)); spawnBot(botName); free(botName); } break; default: /* * child bots generated at end of previous round must be spawned * here since Quake does not know about any new bots.txt aliases * until start of next round */ for(i = 0; i < getSettings()->bots; i++) { botName = generateBotName(roundNum, QV_CHILD_BOT_STR, (i+1)); spawnBot(botName); free(botName); } break; } trap_SendConsoleCommand(EXEC_APPEND, "team spectator\n"); trap_SendConsoleCommand(EXEC_APPEND, "bot_nochat 1\n"); free(botNames); freeSettings(); }