diff options
Diffstat (limited to 'ai')
-rw-r--r-- | ai/ai.c | 4 | ||||
-rw-r--r-- | ai/ai.h | 2 | ||||
-rw-r--r-- | ai/trolly/build.c | 3 |
3 files changed, 5 insertions, 4 deletions
@@ -45,7 +45,7 @@ static void AI_DequeueCommands(PlayerID player) * Needed for SP; we need to delay DoCommand with 1 tick, because else events * will make infinite loops (AIScript). */ -static void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, uint procc) +static void AI_PutCommandInQueue(PlayerID player, TileIndex tile, uint32 p1, uint32 p2, uint procc) { AICommand *com; @@ -80,7 +80,7 @@ static void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, u /** * Executes a raw DoCommand for the AI. */ -int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc) +int32 AI_DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc) { PlayerID old_lp; int32 res = 0; @@ -45,7 +45,7 @@ void AI_PlayerDied(PlayerID player); void AI_RunGameLoop(void); void AI_Initialize(void); void AI_Uninitialize(void); -int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc); +int32 AI_DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc); /** Is it allowed to start a new AI. * This function checks some boundries to see if we should launch a new AI. diff --git a/ai/trolly/build.c b/ai/trolly/build.c index 66728c29a..2b6342604 100644 --- a/ai/trolly/build.c +++ b/ai/trolly/build.c @@ -233,11 +233,12 @@ EngineID AiNew_PickVehicle(Player *p) // Let's check it backwards.. we simply want to best engine available.. for (i = end - 1; i >= start; i--) { + const Engine* e = GetEngine(i); int32 ret; // Is it availiable? // Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY - if (!HASBIT(GetEngine(i)->player_avail, _current_player) || GetEngine(i)->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue; + if (!HASBIT(e->player_avail, _current_player) || e->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue; // Can we build it? ret = AI_DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_ROAD_VEH); if (!CmdFailed(ret)) return i; |