Fix manual setting of conditional order jump taken travel times

pull/362/head
Jonathan G Rennison 2 years ago
parent 1ac6326306
commit 91ed26415e

@ -477,7 +477,7 @@ public:
/** Set if the wait time is fixed */
inline void SetWaitFixed(bool fixed)
{
if (!this->IsType(OT_CONDITIONAL) && fixed != this->IsWaitFixed()) SB(this->GetXFlagsRef(), 1, 1, fixed ? 1 : 0);
if (fixed != this->IsWaitFixed()) SB(this->GetXFlagsRef(), 1, 1, fixed ? 1 : 0);
}
/** Does this order have a fixed travel time? */

@ -1029,7 +1029,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
}
}
if (timetable && order->GetWaitTime() > 0) {
if (timetable && (order->IsWaitTimetabled() || order->GetWaitTime() > 0)) {
SetDParam(7, order->IsWaitTimetabled() ? STR_TIMETABLE_AND_TRAVEL_FOR : STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED);
SetTimetableParams(8, order->GetWaitTime());
} else {
@ -1064,7 +1064,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
edge = DrawString(rtl ? left : edge + 3, rtl ? edge - 3 : right, y, str, colour);
}
if (timetable && timetable_wait_time_valid && order->IsWaitFixed() && edge != 0) {
if (timetable && (timetable_wait_time_valid || order->IsType(OT_CONDITIONAL)) && order->IsWaitFixed() && edge != 0) {
Dimension lock_d = GetSpriteSize(SPR_LOCK);
DrawPixelInfo tmp_dpi;
if (FillDrawPixelInfo(&tmp_dpi, rtl ? left : middle, y, rtl ? middle - left : right - middle, lock_d.height)) {

@ -264,8 +264,8 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u
}
if (travel_time != order->GetTravelTime() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
if (travel_fixed != order->IsTravelFixed() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
if (max_speed != order->GetMaxSpeed() && (order->IsType(OT_CONDITIONAL) || v->type == VEH_AIRCRAFT)) return CMD_ERROR;
if (wait_fixed != order->IsWaitFixed() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
if (leave_type != order->GetLeaveType() && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
if (flags & DC_EXEC) {

@ -477,6 +477,7 @@ struct TimetableWindow : GeneralVehicleWindow {
if (v->owner == _local_company) {
bool disable = true;
bool disable_time = true;
bool wait_lockable = false;
bool wait_locked = false;
bool clearable_when_wait_locked = false;
@ -485,6 +486,7 @@ struct TimetableWindow : GeneralVehicleWindow {
if (selected % 2 == 1) {
/* Travel time */
disable = order != nullptr && (order->IsType(OT_CONDITIONAL) || order->IsType(OT_IMPLICIT));
disable_time = disable;
wait_lockable = !disable;
wait_locked = wait_lockable && order->IsTravelFixed();
} else {
@ -492,24 +494,29 @@ struct TimetableWindow : GeneralVehicleWindow {
if (order != nullptr) {
if (order->IsType(OT_GOTO_WAYPOINT)) {
disable = false;
disable_time = false;
clearable_when_wait_locked = true;
} else if (order->IsType(OT_CONDITIONAL)) {
disable = true;
disable_time = false;
clearable_when_wait_locked = true;
} else {
disable = (!(order->IsType(OT_GOTO_STATION) || (order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() & ODATFB_HALT))) ||
(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION));
disable_time = disable;
}
} else {
disable = true;
disable_time = true;
}
wait_lockable = !disable;
wait_lockable = !disable_time;
wait_locked = wait_lockable && order->IsWaitFixed();
}
}
bool disable_speed = disable || selected % 2 != 1 || v->type == VEH_AIRCRAFT;
this->SetWidgetDisabledState(WID_VT_CHANGE_TIME, disable || (HasBit(v->vehicle_flags, VF_AUTOMATE_TIMETABLE) && !wait_locked));
this->SetWidgetDisabledState(WID_VT_CLEAR_TIME, disable || (HasBit(v->vehicle_flags, VF_AUTOMATE_TIMETABLE) && !(wait_locked && clearable_when_wait_locked)));
this->SetWidgetDisabledState(WID_VT_CHANGE_TIME, disable_time || (HasBit(v->vehicle_flags, VF_AUTOMATE_TIMETABLE) && !wait_locked));
this->SetWidgetDisabledState(WID_VT_CLEAR_TIME, disable_time || (HasBit(v->vehicle_flags, VF_AUTOMATE_TIMETABLE) && !(wait_locked && clearable_when_wait_locked)));
this->SetWidgetDisabledState(WID_VT_CHANGE_SPEED, disable_speed);
this->SetWidgetDisabledState(WID_VT_CLEAR_SPEED, disable_speed);
this->SetWidgetDisabledState(WID_VT_SHARED_ORDER_LIST, !(v->IsOrderListShared() || _settings_client.gui.enable_single_veh_shared_order_gui));

Loading…
Cancel
Save