src/ai/ai.cpp
changeset 6247 7d81e3a5d803
parent 5609 dc6a58930ba4
child 6943 1914f26aee04
equal deleted inserted replaced
6246:75451000349d 6247:7d81e3a5d803
   164 
   164 
   165 /**
   165 /**
   166  * The gameloop for AIs.
   166  * The gameloop for AIs.
   167  *  Handles one tick for all the AIs.
   167  *  Handles one tick for all the AIs.
   168  */
   168  */
   169 void AI_RunGameLoop(void)
   169 void AI_RunGameLoop()
   170 {
   170 {
   171 	/* Don't do anything if ai is disabled */
   171 	/* Don't do anything if ai is disabled */
   172 	if (!_ai.enabled) return;
   172 	if (!_ai.enabled) return;
   173 
   173 
   174 	/* Don't do anything if we are a network-client, or the AI has been disabled */
   174 	/* Don't do anything if we are a network-client, or the AI has been disabled */
   222 }
   222 }
   223 
   223 
   224 /**
   224 /**
   225  * Initialize some AI-related stuff.
   225  * Initialize some AI-related stuff.
   226  */
   226  */
   227 void AI_Initialize(void)
   227 void AI_Initialize()
   228 {
   228 {
   229 	/* First, make sure all AIs are DEAD! */
   229 	/* First, make sure all AIs are DEAD! */
   230 	AI_Uninitialize();
   230 	AI_Uninitialize();
   231 
   231 
   232 	memset(&_ai, 0, sizeof(_ai));
   232 	memset(&_ai, 0, sizeof(_ai));
   236 }
   236 }
   237 
   237 
   238 /**
   238 /**
   239  * Deinitializer for AI-related stuff.
   239  * Deinitializer for AI-related stuff.
   240  */
   240  */
   241 void AI_Uninitialize(void)
   241 void AI_Uninitialize()
   242 {
   242 {
   243 	const Player* p;
   243 	const Player* p;
   244 
   244 
   245 	FOR_ALL_PLAYERS(p) {
   245 	FOR_ALL_PLAYERS(p) {
   246 		if (p->is_active && p->is_ai) AI_PlayerDied(p->index);
   246 		if (p->is_active && p->is_ai) AI_PlayerDied(p->index);