openttd.c
changeset 2395 19b4da30806b
parent 2383 80ff60d10aed
child 2437 e3e2fe024267
--- a/openttd.c	Tue Sep 06 16:14:37 2005 +0000
+++ b/openttd.c	Wed Sep 07 15:10:11 2005 +0000
@@ -39,6 +39,7 @@
 #include "signs.h"
 #include "depot.h"
 #include "waypoint.h"
+#include "ai/ai.h"
 
 #include <stdarg.h>
 
@@ -50,7 +51,6 @@
 void GenerateWorld(int mode, uint size_x, uint size_y);
 void CallLandscapeTick(void);
 void IncreaseDate(void);
-void RunOtherPlayersLoop(void);
 void DoPaletteAnimations(void);
 void MusicLoop(void);
 void ResetMusic(void);
@@ -452,6 +452,9 @@
 	/* initialize all variables that are allocated dynamically */
 	InitializeDynamicVariables();
 
+	/* start the AI */
+	AI_Initialize();
+
 	// Sample catalogue
 	DEBUG(misc, 1) ("Loading sound effects...");
 	MxInitialize(11025);
@@ -535,6 +538,9 @@
 	/* uninitialize variables that are allocated dynamic */
 	UnInitializeDynamicVariables();
 
+	/* stop the AI */
+	AI_Uninitialize();
+
 	/* Close all and any open filehandles */
 	FioCloseAll();
 	UnInitializeGame();
@@ -870,10 +876,7 @@
 		CallVehicleTicks();
 		CallLandscapeTick();
 
-		// To bad the AI does not work in multiplayer, because states are not saved
-		//  perfectly
-		if (!_networking)
-			RunOtherPlayersLoop();
+		AI_RunGameLoop();
 
 		CallWindowTickEvent();
 		NewsLoop();