summaryrefslogtreecommitdiff
path: root/ai.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-12-05 21:30:58 +0000
committerdarkvater <darkvater@openttd.org>2004-12-05 21:30:58 +0000
commitc8d83ce557fff5b6271d2fdecee04ac3942cbde2 (patch)
treef2d440d547e1c5d281b00e545695dcddb2298876 /ai.c
parent860a39af2ad2b891a0e191317d6e93be0087ab46 (diff)
downloadopenttd-c8d83ce557fff5b6271d2fdecee04ac3942cbde2.tar.xz
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
Diffstat (limited to 'ai.c')
-rw-r--r--ai.c39
1 files changed, 27 insertions, 12 deletions
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);