/* ============== BotAIShutdownClient ============== */ int BotAIShutdownClient(int client, qboolean restart) { bot_state_t *bs; bs = botstates[client]; if (!bs || !bs->inuse) { //BotAI_Print(PRT_ERROR, "BotAIShutdownClient: client %d already shutdown\n", client); return qfalse; } if (restart) { BotWriteSessionData(bs); } if (BotChat_ExitGame(bs)) { botlib_export->ai.BotEnterChat(bs->cs, bs->client, CHAT_ALL); } botlib_export->ai.BotFreeMoveState(bs->ms); //free the goal state` botlib_export->ai.BotFreeGoalState(bs->gs); //free the chat file botlib_export->ai.BotFreeChatState(bs->cs); //free the weapon weights botlib_export->ai.BotFreeWeaponState(bs->ws); //free the bot character botlib_export->ai.BotFreeCharacter(bs->character); // BotFreeWaypoints(bs->checkpoints); BotFreeWaypoints(bs->patrolpoints); //clear activate goal stack BotClearActivateGoalStack(bs); //clear the bot state memset(bs, 0, sizeof(bot_state_t)); //set the inuse flag to qfalse bs->inuse = qfalse; //there's one bot less numbots--; //everything went ok return qtrue; }
/* ============== BotAIShutdownPlayer ============== */ int BotAIShutdownPlayer(int playernum, qboolean restart) { bot_state_t *bs; bs = botstates[playernum]; if (!bs || !bs->inuse) { //BotAI_Print(PRT_ERROR, "BotAIShutdownPlayer: player %d already shutdown\n", playernum); return qfalse; } if (restart) { BotWriteSessionData(bs); } if (BotChat_ExitGame(bs)) { BotEnterChat(bs->cs, bs->playernum, CHAT_ALL); } trap_SetConfigstring(CS_BOTINFO + bs->playernum, ""); BotFreeMoveState(bs->ms); //free the goal state BotFreeGoalState(bs->gs); //free the chat file BotFreeChatState(bs->cs); //free the weapon weights BotFreeWeaponState(bs->ws); //free the bot character BotFreeCharacter(bs->character); // BotFreeWaypoints(bs->checkpoints); BotFreeWaypoints(bs->patrolpoints); //clear activate goal stack BotClearActivateGoalStack(bs); //clear the bot state memset(bs, 0, sizeof(bot_state_t)); //set the inuse flag to qfalse bs->inuse = qfalse; //there's one bot less numbots--; //everything went ok return qtrue; }
/* ============== BotAIShutdownClient ============== */ int BotAIShutdownClient( int client ) { bot_state_t *bs; // Wolfenstein if ( g_entities[client].r.svFlags & SVF_CASTAI ) { AICast_ShutdownClient( client ); return BLERR_NOERROR; } // done. bs = botstates[client]; if ( !bs || !bs->inuse ) { // BotAI_Print(PRT_ERROR, "client %d already shutdown\n", client); return BLERR_AICLIENTALREADYSHUTDOWN; } if ( BotChat_ExitGame( bs ) ) { trap_BotEnterChat( bs->cs, bs->client, CHAT_ALL ); } trap_BotFreeMoveState( bs->ms ); //free the goal state trap_BotFreeGoalState( bs->gs ); //free the chat file trap_BotFreeChatState( bs->cs ); //free the weapon weights trap_BotFreeWeaponState( bs->ws ); //free the bot character trap_BotFreeCharacter( bs->character ); // BotFreeWaypoints( bs->checkpoints ); BotFreeWaypoints( bs->patrolpoints ); //clear the bot state memset( bs, 0, sizeof( bot_state_t ) ); //set the inuse flag to qfalse bs->inuse = qfalse; //there's one bot less numbots--; //everything went ok return BLERR_NOERROR; }
/* * BotAIShutdownClient */ int BotAIShutdownClient(int client, qbool restart) { bot_state_t *bs; bs = botstates[client]; if(!bs || !bs->inuse) /* BotAI_Print(PRT_ERROR, "BotAIShutdownClient: client %d already shutdown\n", client); */ return qfalse; if(restart) BotWriteSessionData(bs); if(BotChat_ExitGame(bs)) trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL); trap_BotFreeMoveState(bs->ms); /* free the goal state` */ trap_BotFreeGoalState(bs->gs); /* free the chat file */ trap_BotFreeChatState(bs->cs); /* free the weapon weights */ trap_BotFreeWeaponState(bs->ws); /* free the bot character */ trap_BotFreeCharacter(bs->character); BotFreeWaypoints(bs->checkpoints); BotFreeWaypoints(bs->patrolpoints); /* clear activate goal stack */ BotClearActivateGoalStack(bs); /* clear the bot state */ memset(bs, 0, sizeof(bot_state_t)); /* set the inuse flag to qfalse */ bs->inuse = qfalse; /* there's one bot less */ numbots--; /* everything went ok */ return qtrue; }