コード例 #1
0
ファイル: ai_cast.c プロジェクト: natelo/rtcwPub
/*
==============
AICast_ShutdownClient
==============
*/
int AICast_ShutdownClient(int client)
{
	cast_state_t	*cs;
	bot_state_t *bs;

	if (!(bs = botstates[client])) {
		return BLERR_NOERROR;
	}
	if (!bs->inuse) {
		BotAI_Print(PRT_ERROR, "client %d already shutdown\n", client);
		return BLERR_AICLIENTALREADYSHUTDOWN;
	}

	cs = AICast_GetCastState( client );
	//
	memset( cs, 0, sizeof(cast_state_t) );
	numcast--;

	// now do the other bot stuff

#ifdef DEBUG
//	botai_import.DebugLineDelete(bs->debugline);
#endif //DEBUG

	trap_BotFreeMoveState(bs->ms);
	//free the goal state
	trap_BotFreeGoalState(bs->gs);
	//
	//clear the bot state
	memset(bs, 0, sizeof(bot_state_t));
	//set the inuse flag to qfalse
	bs->inuse = qfalse;
	//everything went ok
	return BLERR_NOERROR;
}
コード例 #2
0
/*
==============
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;
	}

#ifndef __MMO__
	trap_BotFreeMoveState(bs->ms);
	//free the goal state`			
	trap_BotFreeGoalState(bs->gs);
	//free the weapon weights
	trap_BotFreeWeaponState(bs->ws);
#endif //__MMO__

	//
	//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
ファイル: ai_main.c プロジェクト: MAN-AT-ARMS/iortcw-archive
/*
==============
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;
}
コード例 #4
0
ファイル: ai_main.c プロジェクト: zturtleman/reaction
/*
==============
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)) {
        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;
}