From d05f504c01fb88eb8b88d28b5fd5da664e31cd95 Mon Sep 17 00:00:00 2001 From: truelight Date: Fri, 2 Sep 2005 19:10:45 +0000 Subject: [PATCH] (svn r2907) -Codechange: splitted the AIs to their own directory. AINew becomes 'trolly', AIOld becomes 'default', both in their own dir in the 'ai' dir. More AIs to come. --- Makefile | 13 ++--- ai_old.c => ai/default/default.c | 38 +++++++-------- ai_build.c => ai/trolly/build.c | 22 ++++----- ai_pathfinder.c => ai/trolly/pathfinder.c | 20 ++++---- ai_shared.c => ai/trolly/shared.c | 12 ++--- ai_new.c => ai/trolly/trolly.c | 59 +++++++++++------------ ai_new.h => ai/trolly/trolly.h | 12 ++--- players.c | 3 +- 8 files changed, 90 insertions(+), 89 deletions(-) rename ai_old.c => ai/default/default.c (99%) rename ai_build.c => ai/trolly/build.c (96%) rename ai_pathfinder.c => ai/trolly/pathfinder.c (98%) rename ai_shared.c => ai/trolly/shared.c (94%) rename ai_new.c => ai/trolly/trolly.c (97%) rename ai_new.h => ai/trolly/trolly.h (98%) diff --git a/Makefile b/Makefile index 1111964ea3..bb1bb0a609 100644 --- a/Makefile +++ b/Makefile @@ -573,11 +573,6 @@ endif ### Sources -C_SOURCES += ai_old.c -C_SOURCES += ai_build.c -C_SOURCES += ai_new.c -C_SOURCES += ai_pathfinder.c -C_SOURCES += ai_shared.c C_SOURCES += aircraft_cmd.c C_SOURCES += aircraft_gui.c C_SOURCES += airport.c @@ -686,6 +681,12 @@ C_SOURCES += sound/null_s.c C_SOURCES += video/dedicated_v.c C_SOURCES += video/null_v.c +C_SOURCES += ai/default/default.c +C_SOURCES += ai/trolly/trolly.c +C_SOURCES += ai/trolly/build.c +C_SOURCES += ai/trolly/pathfinder.c +C_SOURCES += ai/trolly/shared.c + CXX_SOURCES = OBJC_SOURCES = @@ -988,7 +989,7 @@ upgradeconf: $(MAKE_CONFIG) ### Internal build rules # This makes sure the .deps dir is always around. -DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx) +DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx .deps/ai/default .deps/ai/trolly) # Introduce the dependencies ifneq ($(MAKECMDGOALS), clean) diff --git a/ai_old.c b/ai/default/default.c similarity index 99% rename from ai_old.c rename to ai/default/default.c index 40396159fc..b8160d2bdc 100644 --- a/ai_old.c +++ b/ai/default/default.c @@ -1,22 +1,22 @@ -/* $Id$ */ +/* $Id: ai_old.c 2701 2005-07-24 14:12:37Z tron $ */ -#include "stdafx.h" -#include "openttd.h" -#include "functions.h" -#include "map.h" -#include "tile.h" -#include "player.h" -#include "vehicle.h" -#include "engine.h" -#include "command.h" -#include "town.h" -#include "industry.h" -#include "station.h" -#include "pathfind.h" -#include "economy.h" -#include "airport.h" -#include "depot.h" -#include "variables.h" +#include "../../stdafx.h" +#include "../../openttd.h" +#include "../../functions.h" +#include "../../map.h" +#include "../../tile.h" +#include "../../player.h" +#include "../../vehicle.h" +#include "../../engine.h" +#include "../../command.h" +#include "../../town.h" +#include "../../industry.h" +#include "../../station.h" +#include "../../pathfind.h" +#include "../../economy.h" +#include "../../airport.h" +#include "../../depot.h" +#include "../../variables.h" // remove some day perhaps? static Player *_cur_ai_player; @@ -52,7 +52,7 @@ enum { }; -#include "table/ai_rail.h" +#include "../../table/ai_rail.h" static byte GetRailTrackStatus(TileIndex tile) { uint32 r = GetTileTrackStatus(tile, TRANSPORT_RAIL); diff --git a/ai_build.c b/ai/trolly/build.c similarity index 96% rename from ai_build.c rename to ai/trolly/build.c index 79ce510ffb..80f0fdf1b5 100644 --- a/ai_build.c +++ b/ai/trolly/build.c @@ -1,16 +1,16 @@ /* $Id$ */ -#include "stdafx.h" -#include "openttd.h" -#include "debug.h" -#include "functions.h" -#include "map.h" -#include "tile.h" -#include "command.h" -#include "ai_new.h" -#include "engine.h" -#include "station.h" -#include "variables.h" +#include "../../stdafx.h" +#include "../../openttd.h" +#include "../../debug.h" +#include "../../functions.h" +#include "../../map.h" +#include "../../tile.h" +#include "../../command.h" +#include "trolly.h" +#include "../../engine.h" +#include "../../station.h" +#include "../../variables.h" // Build HQ // Params: diff --git a/ai_pathfinder.c b/ai/trolly/pathfinder.c similarity index 98% rename from ai_pathfinder.c rename to ai/trolly/pathfinder.c index d58cf96489..aa44014f9d 100644 --- a/ai_pathfinder.c +++ b/ai/trolly/pathfinder.c @@ -1,15 +1,15 @@ /* $Id$ */ -#include "stdafx.h" -#include "openttd.h" -#include "debug.h" -#include "functions.h" -#include "map.h" -#include "tile.h" -#include "command.h" -#include "ai_new.h" -#include "depot.h" -#include "variables.h" +#include "../../stdafx.h" +#include "../../openttd.h" +#include "../../debug.h" +#include "../../functions.h" +#include "../../map.h" +#include "../../tile.h" +#include "../../command.h" +#include "trolly.h" +#include "../../depot.h" +#include "../../variables.h" #define TEST_STATION_NO_DIR 0xFF diff --git a/ai_shared.c b/ai/trolly/shared.c similarity index 94% rename from ai_shared.c rename to ai/trolly/shared.c index 8ce9df284e..4b33a13a5f 100644 --- a/ai_shared.c +++ b/ai/trolly/shared.c @@ -1,11 +1,11 @@ /* $Id$ */ -#include "stdafx.h" -#include "openttd.h" -#include "debug.h" -#include "map.h" -#include "ai_new.h" -#include "vehicle.h" +#include "../../stdafx.h" +#include "../../openttd.h" +#include "../../debug.h" +#include "../../map.h" +#include "trolly.h" +#include "../../vehicle.h" int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c) { diff --git a/ai_new.c b/ai/trolly/trolly.c similarity index 97% rename from ai_new.c rename to ai/trolly/trolly.c index 9619c21940..5e16c51a9c 100644 --- a/ai_new.c +++ b/ai/trolly/trolly.c @@ -1,37 +1,36 @@ -/* $Id$ */ +/* $Id: ai_new.c 2891 2005-08-26 20:26:34Z tron $ */ /* - * Next part is in Dutch, and only here for me, TrueLight, the maker of this new AI + * This AI was created as a direct reaction to the big demand for some good AIs in OTTD. + * Too bad it never left alpha-stage, and it is considered dead in his current form. + * By the time of writing this, we, the creator of this AI and a good friend of mine, + * are designing a whole new AI-system that allows us to create AIs easier and without + * all the fuzz we encountered while I was working on this AI. By the time that system + * is finished, you can expect that this AI will dissapear, because it is pretty + * obselete and bad programmed. + * + * In the meanwhile I wish you all much fun with this AI; if you are interested as + * AI-developer in this AI, I advise you not stare too long to some code, some things in + * here really are... strange ;) But in either way: enjoy :) + * + * -- TrueLight :: 2005-09-01 */ -// TODO: als iemand een vehicle stil zet op een weg waar de AI wil bouwen -// doet de AI helemaal niets meer -// TODO: depot rondjes rijden stom iets dingus -// TODO: jezelf afvragen of competitor_intelligence op niveau 2 wel meer geld moet opleverne... -// TODO: als er iets in path komt, bouwt AI gewoon verder :( -// TODO: mail routes - -// FIXME: This code is horrible. Indisputably from the style POV, at least. --pasky - -/* - * End of Dutch part - */ - -#include "stdafx.h" -#include "openttd.h" -#include "debug.h" -#include "functions.h" -#include "table/strings.h" -#include "map.h" -#include "tile.h" -#include "command.h" -#include "ai_new.h" -#include "town.h" -#include "industry.h" -#include "station.h" -#include "engine.h" -#include "gui.h" -#include "depot.h" +#include "../../stdafx.h" +#include "../../openttd.h" +#include "../../debug.h" +#include "../../functions.h" +#include "../../table/strings.h" +#include "../../map.h" +#include "../../tile.h" +#include "../../command.h" +#include "trolly.h" +#include "../../town.h" +#include "../../industry.h" +#include "../../station.h" +#include "../../engine.h" +#include "../../gui.h" +#include "../../depot.h" // This function is called after StartUp. It is the init of an AI static void AiNew_State_FirstTime(Player *p) diff --git a/ai_new.h b/ai/trolly/trolly.h similarity index 98% rename from ai_new.h rename to ai/trolly/trolly.h index ce929a6553..901448dde8 100644 --- a/ai_new.h +++ b/ai/trolly/trolly.h @@ -1,10 +1,10 @@ -/* $Id$ */ +/* $Id: ai_new.h 2892 2005-08-26 20:56:48Z tron $ */ -#ifndef AI_NEW_H -#define AI_NEW_H +#ifndef AI_TROLLY_H +#define AI_TROLLY_H -#include "aystar.h" -#include "player.h" +#include "../../aystar.h" +#include "../../player.h" /* * These defines can be altered to change the behavoir of the AI @@ -258,4 +258,4 @@ int AiNew_PickVehicle(Player *p); int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag); int AiNew_Build_Depot(Player *p, TileIndex tile, byte direction, byte flag); -#endif /* AI_NEW_H */ +#endif /* AI_TROLLY_H */ diff --git a/players.c b/players.c index 3502019bf2..4b6800766b 100644 --- a/players.c +++ b/players.c @@ -20,7 +20,6 @@ #include "news.h" #include "saveload.h" #include "command.h" -#include "ai_new.h" #include "sound.h" #include "network.h" #include "variables.h" @@ -566,6 +565,8 @@ void OnTick_Players(void) } } +extern void AiNewDoGameLoop(Player *p); + void RunOtherPlayersLoop(void) { Player *p;