예제 #1
0
파일: ai_main.c 프로젝트: zturtleman/recoil
/*
==============
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;
}
예제 #2
0
/*
==============
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;
}
예제 #3
0
파일: main.c 프로젝트: icanhas/yantar
/*
 * 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;
}