summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-24 05:51:23 +0000
committertron <tron@openttd.org>2005-10-24 05:51:23 +0000
commite0dd7efc82fbe232c59e4c5a84d714159b3e7d5f (patch)
tree6dc263fd70c0d1f299ae51bc048964cf0729e0e6 /ai
parentf5ea31b9daa2fa9c290df3903cd37acd02e2345d (diff)
downloadopenttd-e0dd7efc82fbe232c59e4c5a84d714159b3e7d5f.tar.xz
(svn r3080) byte -> PlayerID, int -> EngineID, -1 -> INVALID_ENGINE
Diffstat (limited to 'ai')
-rw-r--r--ai/ai.c8
-rw-r--r--ai/ai.h4
-rw-r--r--ai/default/default.c5
3 files changed, 9 insertions, 8 deletions
diff --git a/ai/ai.c b/ai/ai.c
index 5b09d43d9..6be0c14e4 100644
--- a/ai/ai.c
+++ b/ai/ai.c
@@ -77,7 +77,7 @@ void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, uint pro
*/
int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
{
- byte old_lp;
+ PlayerID old_lp;
int32 res = 0;
/* If you enable DC_EXEC with DC_QUERY_COST you are a really strange
@@ -118,7 +118,7 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
/**
* Run 1 tick of the AI. Don't overdo it, keep it realistic.
*/
-static void AI_RunTick(byte player)
+static void AI_RunTick(PlayerID player)
{
extern void AiNewDoGameLoop(Player *p);
@@ -181,7 +181,7 @@ void AI_RunGameLoop(void)
/**
* A new AI sees the day of light. You can do here what ever you think is needed.
*/
-void AI_StartNewAI(byte player)
+void AI_StartNewAI(PlayerID player)
{
/* Called if a new AI is booted */
_ai_player[player].active = true;
@@ -190,7 +190,7 @@ void AI_StartNewAI(byte player)
/**
* This AI player died. Give it some chance to make a final puf.
*/
-void AI_PlayerDied(byte player)
+void AI_PlayerDied(PlayerID player)
{
/* Called if this AI died */
_ai_player[player].active = false;
diff --git a/ai/ai.h b/ai/ai.h
index 0eff62dac..7723a0f4b 100644
--- a/ai/ai.h
+++ b/ai/ai.h
@@ -37,8 +37,8 @@ VARDEF AIStruct _ai;
VARDEF AIPlayer _ai_player[MAX_PLAYERS];
// ai.c
-void AI_StartNewAI(byte player);
-void AI_PlayerDied(byte player);
+void AI_StartNewAI(PlayerID player);
+void AI_PlayerDied(PlayerID player);
void AI_RunGameLoop(void);
void AI_Initialize(void);
void AI_Uninitialize(void);
diff --git a/ai/default/default.c b/ai/default/default.c
index f154aec8a..3c8264604 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -3183,14 +3183,15 @@ static void AiStateBuildRoadVehicles(Player *p)
const AiDefaultBlockData *ptr;
TileIndex tile;
uint loco_id;
- int veh, i;
+ EngineID veh;
+ int i;
ptr = _road_default_block_data[p->ai.src.cur_building_rule]->data;
for(;ptr->mode != 0;ptr++) {}
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
veh = AiChooseRoadVehToBuild(p->ai.cargo_type, p->player_money, tile);
- if (veh == -1) {
+ if (veh == INVALID_ENGINE) {
p->ai.state = AIS_0;
return;
}