mirror of https://github.com/OpenTTD/OpenTTD
(svn r3585) Similar changes to the order handlers of the other vehicle types like r3584
parent
784801f930
commit
f5b564bc44
|
@ -1043,19 +1043,17 @@ static void ProcessAircraftOrder(Vehicle *v)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
// OT_GOTO_DEPOT, OT_LOADING
|
switch (v->current_order.type) {
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT ||
|
case OT_GOTO_DEPOT:
|
||||||
v->current_order.type == OT_LOADING) {
|
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT ||
|
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
|
||||||
!(v->current_order.flags & OF_UNLOAD))
|
!VehicleNeedsService(v)) {
|
||||||
return;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
case OT_LOADING: return;
|
||||||
(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
|
}
|
||||||
!VehicleNeedsService(v)) {
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
||||||
|
|
||||||
|
@ -1067,8 +1065,7 @@ static void ProcessAircraftOrder(Vehicle *v)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order->type == OT_DUMMY && !CheckForValidOrders(v))
|
if (order->type == OT_DUMMY && !CheckForValidOrders(v)) CrashAirplane(v);
|
||||||
CrashAirplane(v);
|
|
||||||
|
|
||||||
if (order->type == v->current_order.type &&
|
if (order->type == v->current_order.type &&
|
||||||
order->flags == v->current_order.flags &&
|
order->flags == v->current_order.flags &&
|
||||||
|
|
25
ship_cmd.c
25
ship_cmd.c
|
@ -203,22 +203,21 @@ static void ProcessShipOrder(Vehicle *v)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
if (v->current_order.type >= OT_GOTO_DEPOT &&
|
switch (v->current_order.type) {
|
||||||
v->current_order.type <= OT_LEAVESTATION) {
|
case OT_GOTO_DEPOT:
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT ||
|
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
|
||||||
!(v->current_order.flags & OF_UNLOAD))
|
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
|
||||||
|
!VehicleNeedsService(v)) {
|
||||||
|
v->cur_order_index++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_LOADING:
|
||||||
|
case OT_LEAVESTATION:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
||||||
(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
|
|
||||||
!VehicleNeedsService(v)) {
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (v->cur_order_index >= v->num_orders)
|
|
||||||
v->cur_order_index = 0;
|
|
||||||
|
|
||||||
order = GetVehicleOrder(v, v->cur_order_index);
|
order = GetVehicleOrder(v, v->cur_order_index);
|
||||||
|
|
||||||
|
|
23
train_cmd.c
23
train_cmd.c
|
@ -2274,19 +2274,18 @@ static bool ProcessTrainOrder(Vehicle *v)
|
||||||
const Order *order;
|
const Order *order;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
// These are un-interruptible
|
switch (v->current_order.type) {
|
||||||
if (v->current_order.type >= OT_GOTO_DEPOT &&
|
case OT_GOTO_DEPOT:
|
||||||
v->current_order.type <= OT_LEAVESTATION) {
|
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false;
|
||||||
// Let a depot order in the orderlist interrupt.
|
if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) &&
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT ||
|
!VehicleNeedsService(v)) {
|
||||||
!(v->current_order.flags & OF_UNLOAD))
|
v->cur_order_index++;
|
||||||
return false;
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
case OT_LOADING:
|
||||||
(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
|
case OT_LEAVESTATION:
|
||||||
!VehicleNeedsService(v)) {
|
return false;
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we've reached the waypoint?
|
// check if we've reached the waypoint?
|
||||||
|
|
Loading…
Reference in New Issue