Changeset - r28806:0d3a009d827a
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 9 months ago 2024-02-23 20:02:59
j.g.rennison@gmail.com
Fix #12166: Crash when opening tram road stop build window (#12168)
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/road_gui.cpp
Show inline comments
 
@@ -1123,27 +1123,29 @@ private:
 
			if (rs_class == _roadstop_gui_settings.roadstop_class) break;
 
			pos++;
 
		}
 
		this->vscrollList->SetCount(this->roadstop_classes.size());
 
		this->vscrollList->ScrollTowards(pos);
 
	}
 

	
 
	void CheckOrientationValid()
 
	{
 
		const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
 

	
 
		/* Raise and lower to ensure the correct widget is lowered after changing displayed orientation plane. */
 
		this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
		this->GetWidget<NWidgetStacked>(WID_BROS_AVAILABLE_ORIENTATIONS)->SetDisplayedPlane((spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) ? 1 : 0);
 
		this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
		if (RoadTypeIsRoad(_cur_roadtype)) {
 
			this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
			this->GetWidget<NWidgetStacked>(WID_BROS_AVAILABLE_ORIENTATIONS)->SetDisplayedPlane((spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) ? 1 : 0);
 
			this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
		}
 

	
 
		if (_roadstop_gui_settings.orientation >= DIAGDIR_END) return;
 

	
 
		if (spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) {
 
			this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
			_roadstop_gui_settings.orientation = DIAGDIR_END;
 
			this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation);
 
			this->SetDirty();
 
			CloseWindowById(WC_SELECT_STATION, 0);
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)