summaryrefslogtreecommitdiff
path: root/src/ai/trolly
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-05 23:36:54 +0000
committerrubidium <rubidium@openttd.org>2008-04-05 23:36:54 +0000
commit5b47f81b0f6d46a876a24c0384791af123ac4ab7 (patch)
tree0ddf9ce628e1f7f3677425777bfeb4f04b23d7a0 /src/ai/trolly
parent56e63a60447beeae0cc541191ea77f06e237b40a (diff)
downloadopenttd-5b47f81b0f6d46a876a24c0384791af123ac4ab7.tar.xz
(svn r12584) -Codechange: do not access the order type directly.
Diffstat (limited to 'src/ai/trolly')
-rw-r--r--src/ai/trolly/trolly.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 0860c43b0..30714aed0 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -553,7 +553,7 @@ static bool AiNew_CheckVehicleStation(Player *p, Station *st)
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && GetStation(order->dest) == st) {
+ if (order->IsType(OT_GOTO_STATION) && GetStation(order->dest) == st) {
// This vehicle has this city in its list
count++;
}
@@ -1184,24 +1184,18 @@ static void AiNew_State_GiveOrders(Player *p)
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
if (_patches.gotodepot) {
idx = 0;
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_UNLOAD;
- order.dest = GetDepotByTile(_players_ainew[p->index].depot_tile)->index;
+ order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, true);
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
}
idx = 0;
- order.type = OT_GOTO_STATION;
- order.flags = 0;
- order.dest = GetStationIndex(_players_ainew[p->index].to_tile);
+ order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].to_tile));
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver)
order.flags |= OFB_FULL_LOAD;
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
idx = 0;
- order.type = OT_GOTO_STATION;
- order.flags = 0;
- order.dest = GetStationIndex(_players_ainew[p->index].from_tile);
+ order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].from_tile));
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver)
order.flags |= OFB_FULL_LOAD;
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);