From 5b47f81b0f6d46a876a24c0384791af123ac4ab7 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 5 Apr 2008 23:36:54 +0000 Subject: (svn r12584) -Codechange: do not access the order type directly. --- src/ai/trolly/trolly.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/ai/trolly') 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); -- cgit v1.2.3-70-g09d2