From c8d83ce557fff5b6271d2fdecee04ac3942cbde2 Mon Sep 17 00:00:00 2001 From: darkvater Date: Sun, 5 Dec 2004 21:30:58 +0000 Subject: (svn r960) -Fix: forgotten conversion of orders for the AI (Tron) --- ai.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'ai.c') diff --git a/ai.c b/ai.c index 9930a5f73..0ae06f759 100644 --- a/ai.c +++ b/ai.c @@ -2417,15 +2417,20 @@ handle_nocash: for(i=0; p->ai.order_list_blocks[i] != 0xFF; i++) { AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i]; - uint flags = (AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule) << 8) + OT_GOTO_STATION; bool is_pass = (p->ai.cargo_type == CT_PASSENGERS || p->ai.cargo_type == CT_MAIL || (_opt.landscape==LT_NORMAL && p->ai.cargo_type == CT_VALUABLES)); + Order order; - if (!is_pass && i == 1) flags |= OF_UNLOAD; - if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) flags |= OF_FULL_LOAD; + order.type = OT_GOTO_STATION; + order.flags = 0; + order.station = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule); - DoCommandByTile(0, loco_id + (i << 16), flags, DC_EXEC, CMD_INSERT_ORDER); + if (!is_pass && i == 1) order.flags |= OF_UNLOAD; + if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) + order.flags |= OF_FULL_LOAD; + + DoCommandByTile(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN); @@ -3164,15 +3169,20 @@ static void AiStateBuildRoadVehicles(Player *p) for(i=0; p->ai.order_list_blocks[i] != 0xFF; i++) { AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i]; - uint flags = (AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule) << 8) + OT_GOTO_STATION; bool is_pass = (p->ai.cargo_type == CT_PASSENGERS || p->ai.cargo_type == CT_MAIL || (_opt.landscape==LT_NORMAL && p->ai.cargo_type == CT_VALUABLES)); + Order order; + + order.type = OT_GOTO_STATION; + order.flags = 0; + order.station = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule); - if (!is_pass && i == 1) flags |= OF_UNLOAD; - if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) flags |= OF_FULL_LOAD; + if (!is_pass && i == 1) order.flags |= OF_UNLOAD; + if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) + order.flags |= OF_FULL_LOAD; - DoCommandByTile(0, loco_id + (i << 16), flags, DC_EXEC, CMD_INSERT_ORDER); + DoCommandByTile(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH); @@ -3474,13 +3484,18 @@ static void AiStateBuildAircraftVehicles(Player *p) for(i=0; p->ai.order_list_blocks[i] != 0xFF; i++) { AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i]; - uint flags = (AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule) << 8) + OT_GOTO_STATION; bool is_pass = (p->ai.cargo_type == CT_PASSENGERS || p->ai.cargo_type == CT_MAIL); + Order order; + + order.type = OT_GOTO_STATION; + order.flags = 0; + order.station = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule); - if (!is_pass && i == 1) flags |= OF_UNLOAD; - if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) flags |= OF_FULL_LOAD; + if (!is_pass && i == 1) order.flags |= OF_UNLOAD; + if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) + order.flags |= OF_FULL_LOAD; - DoCommandByTile(0, loco_id + (i << 16), flags, DC_EXEC, CMD_INSERT_ORDER); + DoCommandByTile(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT); -- cgit v1.2.3-54-g00ecf