mirror of https://github.com/OpenTTD/OpenTTD
(svn r25617) -Fix [FS#5655] (r25377): crash when Ctrl+clicking the start date button in timetable window without any orders
parent
b6a624bb92
commit
fb1d479a51
|
@ -166,7 +166,7 @@ CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
Vehicle *v = Vehicle::GetIfValid(veh);
|
Vehicle *v = Vehicle::GetIfValid(veh);
|
||||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
@ -235,7 +235,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
{
|
{
|
||||||
bool timetable_all = HasBit(p1, 20);
|
bool timetable_all = HasBit(p1, 20);
|
||||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
@ -302,7 +302,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
Vehicle *v = Vehicle::GetIfValid(veh);
|
Vehicle *v = Vehicle::GetIfValid(veh);
|
||||||
if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == NULL || !v->IsPrimaryVehicle() || v->orders.list == NULL) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
|
@ -328,9 +328,9 @@ struct TimetableWindow : Window {
|
||||||
this->SetWidgetDisabledState(WID_VT_CLEAR_SPEED, disable_speed);
|
this->SetWidgetDisabledState(WID_VT_CLEAR_SPEED, disable_speed);
|
||||||
this->SetWidgetDisabledState(WID_VT_SHARED_ORDER_LIST, !v->IsOrderListShared());
|
this->SetWidgetDisabledState(WID_VT_SHARED_ORDER_LIST, !v->IsOrderListShared());
|
||||||
|
|
||||||
this->EnableWidget(WID_VT_START_DATE);
|
this->SetWidgetDisabledState(WID_VT_START_DATE, v->orders.list == NULL);
|
||||||
this->EnableWidget(WID_VT_RESET_LATENESS);
|
this->SetWidgetDisabledState(WID_VT_RESET_LATENESS, v->orders.list == NULL);
|
||||||
this->EnableWidget(WID_VT_AUTOFILL);
|
this->SetWidgetDisabledState(WID_VT_AUTOFILL, v->orders.list == NULL);
|
||||||
} else {
|
} else {
|
||||||
this->DisableWidget(WID_VT_START_DATE);
|
this->DisableWidget(WID_VT_START_DATE);
|
||||||
this->DisableWidget(WID_VT_CHANGE_TIME);
|
this->DisableWidget(WID_VT_CHANGE_TIME);
|
||||||
|
|
Loading…
Reference in New Issue