1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 11:44:17 +01:00

(svn r16248) [0.7] -Backport from trunk:

- Fix: Improve corner case order handling: mark order as done only when actually done, obey non-stop orders, do only stop/refit at the depot in the order (r16240,r16228,r16199,r16198,r16187)
- Fix: Use the stop/non-stop intermediate orderflags AIs can give for goto-depot orders (r16239)
This commit is contained in:
rubidium
2009-05-06 23:21:43 +00:00
parent 1e9fd18e6a
commit 2db7e3a0a8
6 changed files with 36 additions and 28 deletions

View File

@@ -51,14 +51,12 @@ void Order::MakeGoToStation(StationID destination)
this->dest = destination;
}
void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderDepotActionFlags action, CargoID cargo, byte subtype)
void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type, OrderDepotActionFlags action, CargoID cargo, byte subtype)
{
this->type = OT_GOTO_DEPOT;
this->SetDepotOrderType(order);
this->SetDepotActionType(action);
if (!(order & ODTFB_PART_OF_ORDERS)) {
this->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
}
this->SetNonStopType(non_stop_type);
this->dest = destination;
this->SetRefit(cargo, subtype);
}
@@ -1621,7 +1619,7 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
if (v->FindClosestDepot(&location, &destination, &reverse)) {
v->dest_tile = location;
v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), (OrderDepotActionFlags)(v->current_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype());
v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), v->current_order.GetNonStopType(), (OrderDepotActionFlags)(v->current_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype());
/* If there is no depot in front, reverse automatically (trains only) */
if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);