|
|
|
@ -591,7 +591,7 @@ private:
|
|
|
|
|
}
|
|
|
|
|
if (order->GetLoadType() == load_type) return; // If we still match, do nothing
|
|
|
|
|
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (load_type << 4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -606,7 +606,7 @@ private:
|
|
|
|
|
if (order == nullptr) return;
|
|
|
|
|
i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE;
|
|
|
|
|
}
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_DEPOT_ACTION | (i << 4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -621,7 +621,7 @@ private:
|
|
|
|
|
_settings_client.gui.new_nonstop && this->vehicle->IsGroundVehicle() ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
|
|
|
|
order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
|
|
|
|
|
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
|
|
|
|
|
DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -641,11 +641,11 @@ private:
|
|
|
|
|
}
|
|
|
|
|
if (order->GetUnloadType() == unload_type) return; // If we still match, do nothing
|
|
|
|
|
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4));
|
|
|
|
|
|
|
|
|
|
/* Transfer and unload orders with leave empty as default */
|
|
|
|
|
if (unload_type == OUFB_TRANSFER || unload_type == OUFB_UNLOAD) {
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (OLFB_NO_LOAD << 4), CMD_MODIFY_ORDER);
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER, this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (OLFB_NO_LOAD << 4));
|
|
|
|
|
this->SetWidgetDirty(WID_O_FULL_LOAD);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -669,7 +669,7 @@ private:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->SetWidgetDirty(WID_O_NON_STOP);
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_NON_STOP | non_stop << 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -682,8 +682,8 @@ private:
|
|
|
|
|
if (_ctrl_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return;
|
|
|
|
|
if (this->vehicle->GetNumOrders() <= 1) return;
|
|
|
|
|
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()),
|
|
|
|
|
CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER));
|
|
|
|
|
DoCommandP(CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER),
|
|
|
|
|
this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -694,7 +694,7 @@ private:
|
|
|
|
|
/* When networking, move one order lower */
|
|
|
|
|
int selected = this->selected_order + (int)_networking;
|
|
|
|
|
|
|
|
|
|
if (DoCommandP(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER))) {
|
|
|
|
|
if (DoCommandP(CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER), this->vehicle->tile, this->vehicle->index, this->OrderGetSel())) {
|
|
|
|
|
this->selected_order = selected >= this->vehicle->GetNumOrders() ? -1 : selected;
|
|
|
|
|
this->UpdateButtonState();
|
|
|
|
|
}
|
|
|
|
@ -719,7 +719,7 @@ private:
|
|
|
|
|
/* Get another vehicle that share orders with this vehicle. */
|
|
|
|
|
Vehicle *other_shared = (this->vehicle->FirstShared() == this->vehicle) ? this->vehicle->NextShared() : this->vehicle->PreviousShared();
|
|
|
|
|
/* Copy the order list of the other vehicle. */
|
|
|
|
|
if (DoCommandP(this->vehicle->tile, this->vehicle->index | CO_COPY << 30, other_shared->index, CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST))) {
|
|
|
|
|
if (DoCommandP(CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST), this->vehicle->tile, this->vehicle->index | CO_COPY << 30, other_shared->index)) {
|
|
|
|
|
this->UpdateButtonState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -734,10 +734,10 @@ private:
|
|
|
|
|
{
|
|
|
|
|
if (_ctrl_pressed) {
|
|
|
|
|
/* Cancel refitting */
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
|
|
|
|
|
DoCommandP(CMD_ORDER_REFIT, this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT);
|
|
|
|
|
} else {
|
|
|
|
|
if (i == 1) { // Auto-refit to available cargo type.
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | CT_AUTO_REFIT, CMD_ORDER_REFIT);
|
|
|
|
|
DoCommandP(CMD_ORDER_REFIT, this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | CT_AUTO_REFIT);
|
|
|
|
|
} else {
|
|
|
|
|
ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this, auto_refit);
|
|
|
|
|
}
|
|
|
|
@ -1159,7 +1159,7 @@ public:
|
|
|
|
|
order.index = 0;
|
|
|
|
|
order.MakeConditional(order_id);
|
|
|
|
|
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
|
|
|
|
|
DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack());
|
|
|
|
|
}
|
|
|
|
|
ResetObjectToPlace();
|
|
|
|
|
break;
|
|
|
|
@ -1182,9 +1182,9 @@ public:
|
|
|
|
|
this->selected_order = -1;
|
|
|
|
|
} else if (sel == this->selected_order) {
|
|
|
|
|
if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) {
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 20),
|
|
|
|
|
MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
|
|
|
|
|
CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER),
|
|
|
|
|
this->vehicle->tile, this->vehicle->index + (sel << 20),
|
|
|
|
|
MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* Select clicked order */
|
|
|
|
@ -1331,7 +1331,7 @@ public:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1369,11 +1369,11 @@ public:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_O_COND_VARIABLE:
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_O_COND_COMPARATOR:
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_COMPARATOR | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
|
|
|
|
DoCommandP(CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_COMPARATOR | index << 4);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1386,7 +1386,7 @@ public:
|
|
|
|
|
VehicleOrderID to_order = this->GetOrderFromPt(pt.y);
|
|
|
|
|
|
|
|
|
|
if (!(from_order == to_order || from_order == INVALID_VEH_ORDER_ID || from_order > this->vehicle->GetNumOrders() || to_order == INVALID_VEH_ORDER_ID || to_order > this->vehicle->GetNumOrders()) &&
|
|
|
|
|
DoCommandP(this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16), CMD_MOVE_ORDER | CMD_MSG(STR_ERROR_CAN_T_MOVE_THIS_ORDER))) {
|
|
|
|
|
DoCommandP(CMD_MOVE_ORDER | CMD_MSG(STR_ERROR_CAN_T_MOVE_THIS_ORDER), this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16))) {
|
|
|
|
|
this->selected_order = -1;
|
|
|
|
|
this->UpdateButtonState();
|
|
|
|
|
}
|
|
|
|
@ -1438,7 +1438,7 @@ public:
|
|
|
|
|
const Order cmd = GetOrderCmdFromTile(this->vehicle, tile);
|
|
|
|
|
if (cmd.IsType(OT_NOTHING)) return;
|
|
|
|
|
|
|
|
|
|
if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), cmd.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER))) {
|
|
|
|
|
if (DoCommandP(CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER), this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), cmd.Pack())) {
|
|
|
|
|
/* With quick goto the Go To button stays active */
|
|
|
|
|
if (!_settings_client.gui.quick_goto) ResetObjectToPlace();
|
|
|
|
|
}
|
|
|
|
@ -1455,8 +1455,8 @@ public:
|
|
|
|
|
bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
|
|
|
|
|
if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
|
|
|
|
|
|
|
|
|
|
if (DoCommandP(this->vehicle->tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->index,
|
|
|
|
|
share_order ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
|
|
|
|
|
if (DoCommandP(share_order ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST),
|
|
|
|
|
this->vehicle->tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->index)) {
|
|
|
|
|
this->selected_order = -1;
|
|
|
|
|
ResetObjectToPlace();
|
|
|
|
|
}
|
|
|
|
|