Changeset - r20581:b7930d3d7519
[Not reviewed]
master
0 2 0
rubidium - 11 years ago 2013-07-17 18:37:13
rubidium@openttd.org
(svn r25617) -Fix [FS#5655] (r25377): crash when Ctrl+clicking the start date button in timetable window without any orders
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/timetable_cmd.cpp
Show inline comments
 
@@ -163,13 +163,13 @@ CommandCost CmdChangeTimetable(TileIndex
 
 */
 
CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	VehicleID veh = GB(p1, 0, 20);
 

	
 
	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);
 
	if (ret.Failed()) return ret;
 

	
 
	if (flags & DC_EXEC) {
 
		v->lateness_counter = 0;
 
@@ -232,13 +232,13 @@ static int CDECL VehicleTimetableSorter(
 
 * @return The error or cost of the operation.
 
 */
 
CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	bool timetable_all = HasBit(p1, 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);
 
	if (ret.Failed()) return ret;
 

	
 
	/* Don't let a timetable start more than 15 years into the future or 1 year in the past. */
 
	Date start_date = (Date)p2;
 
@@ -299,13 +299,13 @@ CommandCost CmdSetTimetableStart(TileInd
 
 */
 
CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	VehicleID veh = GB(p1, 0, 20);
 

	
 
	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);
 
	if (ret.Failed()) return ret;
 

	
 
	if (flags & DC_EXEC) {
 
		if (HasBit(p2, 0)) {
src/timetable_gui.cpp
Show inline comments
 
@@ -325,15 +325,15 @@ struct TimetableWindow : Window {
 
			this->SetWidgetDisabledState(WID_VT_CHANGE_TIME, disable);
 
			this->SetWidgetDisabledState(WID_VT_CLEAR_TIME, disable);
 
			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());
 

	
 
			this->EnableWidget(WID_VT_START_DATE);
 
			this->EnableWidget(WID_VT_RESET_LATENESS);
 
			this->EnableWidget(WID_VT_AUTOFILL);
 
			this->SetWidgetDisabledState(WID_VT_START_DATE, v->orders.list == NULL);
 
			this->SetWidgetDisabledState(WID_VT_RESET_LATENESS, v->orders.list == NULL);
 
			this->SetWidgetDisabledState(WID_VT_AUTOFILL, v->orders.list == NULL);
 
		} else {
 
			this->DisableWidget(WID_VT_START_DATE);
 
			this->DisableWidget(WID_VT_CHANGE_TIME);
 
			this->DisableWidget(WID_VT_CLEAR_TIME);
 
			this->DisableWidget(WID_VT_CHANGE_SPEED);
 
			this->DisableWidget(WID_VT_CLEAR_SPEED);
0 comments (0 inline, 0 general)