Esempio n. 1
0
int BotLibShutdown() {
	if ( !IsBotLibSetup( "BotLibShutdown" ) ) {
		return BLERR_LIBRARYNOTSETUP;
	}

	// shutdown all AI subsystems
	BotShutdownChatAI();		//be_ai_chat.c
	BotShutdownMoveAI();		//be_ai_move.c
	BotShutdownGoalAI();		//be_ai_goal.c
	BotShutdownWeaponAI();		//be_ai_weap.c
	BotShutdownWeights();		//be_ai_weight.c
	BotShutdownCharacters();	//be_ai_char.c
	// shut down aas
	AAS_Shutdown();
	// shut down bot elemantary actions
	EA_Shutdown();
	// free all libvars
	LibVarDeAllocAll();
	// remove all global defines from the pre compiler
	PC_RemoveAllGlobalDefines();

	// shut down library log file
	Log_Shutdown();

	botlibsetup = false;
	botlibglobals.botlibsetup = false;
	// print any files still open
	PC_CheckOpenSourceHandles();
	return BLERR_NOERROR;
}
Esempio n. 2
0
int BotLibSetup( bool singleplayer ) {
	bot_developer = LibVarGetValue( "bot_developer" );
	Com_Memset( &botlibglobals, 0, sizeof ( botlibglobals ) );
	Log_Open( "botlib.log" );

	BotImport_Print( PRT_MESSAGE, "------- BotLib Initialization -------\n" );

	botlibglobals.maxclients = ( int )LibVarValue( "maxclients", "128" );
	botlibglobals.maxentities = ( int )LibVarValue( "maxentities", GGameType & GAME_WolfSP ? "2048" : "1024" );

	int errnum = AAS_Setup();			//be_aas_main.c
	if ( errnum != BLERR_NOERROR ) {
		return errnum;
	}
	errnum = EA_Setup();			//be_ea.c
	if ( errnum != BLERR_NOERROR ) {
		return errnum;
	}
	if ( !( GGameType & ( GAME_WolfSP | GAME_WolfMP ) ) ) {
		errnum = BotSetupWeaponAI();	//be_ai_weap.c
		if ( errnum != BLERR_NOERROR ) {
			return errnum;
		}
		errnum = BotSetupGoalAI( singleplayer );		//be_ai_goal.c
		if ( errnum != BLERR_NOERROR ) {
			return errnum;
		}
		errnum = BotSetupChatAI();		//be_ai_chat.c
		if ( errnum != BLERR_NOERROR ) {
			return errnum;
		}
	}
	if ( !( GGameType & GAME_WolfMP ) ) {
		errnum = BotSetupMoveAI();		//be_ai_move.c
		if ( errnum != BLERR_NOERROR ) {
			return errnum;
		}
	}

	if ( GGameType & GAME_ET ) {
		PC_RemoveAllGlobalDefines();
	}

	botlibsetup = true;
	botlibglobals.botlibsetup = true;

	return BLERR_NOERROR;
}
Esempio n. 3
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int Export_BotLibShutdown( void ) {
	static int recursive = 0;

	if ( !BotLibSetup( "BotLibShutdown" ) ) {
		return BLERR_LIBRARYNOTSETUP;
	}
	//
	if ( recursive ) {
		return BLERR_NOERROR;
	}
	recursive = 1;
	// shutdown all AI subsystems
	BotShutdownChatAI();        //be_ai_chat.c
	BotShutdownMoveAI();        //be_ai_move.c
	BotShutdownGoalAI();        //be_ai_goal.c
	BotShutdownWeaponAI();      //be_ai_weap.c
	BotShutdownWeights();       //be_ai_weight.c
	BotShutdownCharacters();    //be_ai_char.c
	// shutdown AAS
	AAS_Shutdown();
	// shutdown bot elemantary actions
	EA_Shutdown();
	// free all libvars
	LibVarDeAllocAll();
	// remove all global defines from the pre compiler
	PC_RemoveAllGlobalDefines();
	// shut down library log file
	Log_Shutdown();
	//
	botlibsetup = qfalse;
	botlibglobals.botlibsetup = qfalse;
	recursive = 0;
	// print any files still open
	PC_CheckOpenSourceHandles();
	//
#ifdef _DEBUG
	Log_AlwaysOpen( "memory.log" );
	PrintMemoryLabels();
	Log_Shutdown();
#endif
	return BLERR_NOERROR;
} //end of the function Export_BotLibShutdown
Esempio n. 4
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int Export_BotLibShutdown(void)
{
	if (!BotLibSetup("BotLibShutdown")) return BLERR_LIBRARYNOTSETUP;
#ifndef DEMO
	//DumpFileCRCs();
#endif //DEMO
	//
	BotShutdownChatAI();		//be_ai_chat.c
	BotShutdownMoveAI();		//be_ai_move.c
	BotShutdownGoalAI();		//be_ai_goal.c
	BotShutdownWeaponAI();		//be_ai_weap.c
	BotShutdownWeights();		//be_ai_weight.c
	BotShutdownCharacters();	//be_ai_char.c
	//shud down aas
	AAS_Shutdown();
	//shut down bot elemantary actions
	EA_Shutdown();
	//free all libvars
	LibVarDeAllocAll();
	//remove all global defines from the pre compiler
	PC_RemoveAllGlobalDefines();

	//dump all allocated memory
//	DumpMemory();
#ifdef DEBUG
	PrintMemoryLabels();
#endif
	//shut down library log file
	Log_Shutdown();
	//
	botlibsetup = qfalse;
	botlibglobals.botlibsetup = qfalse;
	// print any files still open
	PC_CheckOpenSourceHandles();
	//
	return BLERR_NOERROR;
} //end of the function Export_BotLibShutdown