summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-03-07 12:11:48 +0000
committerrubidium <rubidium@openttd.org>2007-03-07 12:11:48 +0000
commit24c4d5b06d231785db01500360c26815d8fe4d15 (patch)
tree757477dbdc02025cc29690a4e66e40f872cab02b /src/ai
parent36bb92ae241403d61dc7a3e5a1696b615be61395 (diff)
downloadopenttd-24c4d5b06d231785db01500360c26815d8fe4d15.tar.xz
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai.h14
-rw-r--r--src/ai/default/default.cpp20
-rw-r--r--src/ai/trolly/pathfinder.cpp4
3 files changed, 19 insertions, 19 deletions
diff --git a/src/ai/ai.h b/src/ai/ai.h
index 424bfc2ef..c1d0726c3 100644
--- a/src/ai/ai.h
+++ b/src/ai/ai.h
@@ -7,7 +7,7 @@
#include "../command.h"
/* How DoCommands look like for an AI */
-typedef struct AICommand {
+struct AICommand {
uint32 tile;
uint32 p1;
uint32 p2;
@@ -17,22 +17,22 @@ typedef struct AICommand {
char *text;
uint uid;
- struct AICommand *next;
-} AICommand;
+ AICommand *next;
+};
/* The struct for an AIScript Player */
-typedef struct AIPlayer {
+struct AIPlayer {
bool active; ///< Is this AI active?
AICommand *queue; ///< The commands that he has in his queue
AICommand *queue_tail; ///< The tail of this queue
-} AIPlayer;
+};
/* The struct to keep some data about the AI in general */
-typedef struct AIStruct {
+struct AIStruct {
/* General */
bool enabled; ///< Is AI enabled?
uint tick; ///< The current tick (something like _frame_counter, only for AIs)
-} AIStruct;
+};
VARDEF AIStruct _ai;
VARDEF AIPlayer _ai_player[MAX_PLAYERS];
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index d311ba71f..8784b6f36 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -446,12 +446,12 @@ static void AiStateDoReplaceVehicle(Player *p)
_veh_do_replace_proc[v->type - VEH_Train](p);
}
-typedef struct FoundRoute {
+struct FoundRoute {
int distance;
CargoID cargo;
void *from;
void *to;
-} FoundRoute;
+};
static Town *AiFindRandomTown()
{
@@ -1824,12 +1824,12 @@ static TileIndex AiGetEdgeOfDefaultRailBlock(byte rule, TileIndex tile, byte cmd
return tile + ToTileIndexDiff(p->tileoffs) - TileOffsByDiagDir(*dir = p->attr);
}
-typedef struct AiRailPathFindData {
+struct AiRailPathFindData {
TileIndex tile;
TileIndex tile2;
int count;
bool flag;
-} AiRailPathFindData;
+};
static bool AiEnumFollowTrack(TileIndex tile, AiRailPathFindData *a, int track, uint length, byte *state)
{
@@ -1858,7 +1858,7 @@ static bool AiDoFollowTrack(const Player* p)
return arpfd.count > 8;
}
-typedef struct AiRailFinder {
+struct AiRailFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@@ -1873,7 +1873,7 @@ typedef struct AiRailFinder {
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
-} AiRailFinder;
+};
static const byte _ai_table_15[4][8] = {
{0, 0, 4, 3, 3, 1, 128 + 0, 64},
@@ -2713,7 +2713,7 @@ static void AiStateBuildDefaultRoadBlocks(Player *p)
p->ai.state_mode = 255;
}
-typedef struct {
+struct AiRoadFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@@ -2728,14 +2728,14 @@ typedef struct {
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
-} AiRoadFinder;
+};
-typedef struct AiRoadEnum {
+struct AiRoadEnum {
TileIndex dest;
TileIndex best_tile;
int best_track;
uint best_dist;
-} AiRoadEnum;
+};
static const byte _dir_by_track[] = {
0, 1, 0, 1, 2, 1,
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index 297d12a00..0091939b1 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -372,9 +372,9 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
extern uint GetRailFoundation(Slope tileh, TrackBits bits); // XXX function declaration in .c
extern uint GetRoadFoundation(Slope tileh, RoadBits bits); // XXX function declaration in .c
extern uint GetBridgeFoundation(Slope tileh, Axis); // XXX function declaration in .c
-typedef enum BridgeFoundations{
+enum BridgeFoundation {
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
-} BridgeFoundation;
+};
// The most important function: it calculates the g-value
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)