summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-09-07 15:10:11 +0000
committertruelight <truelight@openttd.org>2005-09-07 15:10:11 +0000
commit991d5c623467ee13c0f3df90eaa2d5127a4d5be9 (patch)
tree692137bc97cba13a50b293ec5598e1abe6982f5e /openttd.c
parente39bf0dc3411347759e7d55080f051d4935353c7 (diff)
downloadopenttd-991d5c623467ee13c0f3df90eaa2d5127a4d5be9.tar.xz
(svn r2921) -Codechange: moved all AI-code to 1 central place (ai/ai.c)
-Fix: removed the ability for the oldAI to cheat (this will criple him somewhat) -Add: base-code for many improvements to come in the AI-system -Add: added base-code for multiplayer AIs (DOES NOT WORK YET!)
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openttd.c b/openttd.c
index fec149d36..b2a6a667e 100644
--- a/openttd.c
+++ b/openttd.c
@@ -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 @@ int ttd_main(int argc, char* argv[])
/* 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 @@ int ttd_main(int argc, char* argv[])
/* uninitialize variables that are allocated dynamic */
UnInitializeDynamicVariables();
+ /* stop the AI */
+ AI_Uninitialize();
+
/* Close all and any open filehandles */
FioCloseAll();
UnInitializeGame();
@@ -870,10 +876,7 @@ void StateGameLoop(void)
CallVehicleTicks();
CallLandscapeTick();
- // To bad the AI does not work in multiplayer, because states are not saved
- // perfectly
- if (!_networking)
- RunOtherPlayersLoop();
+ AI_RunGameLoop();
CallWindowTickEvent();
NewsLoop();