Change: Invalidate build toolbars when NewGRFs are changed.
If NewGRFs are changed while a rail or road toolbar is open, the toolbar could refer to an invalid rail/road type. If so, close it.
This commit is contained in:
committed by
Peter Nelson
parent
6d2b93d3b3
commit
db1a1c5dd9
@@ -377,6 +377,13 @@ struct BuildRoadToolbarWindow : Window {
|
||||
void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
|
||||
if (!ValParamRoadType(this->roadtype)) {
|
||||
/* Close toolbar if road type is not available. */
|
||||
this->Close();
|
||||
return;
|
||||
}
|
||||
|
||||
RoadTramType rtt = GetRoadTramType(this->roadtype);
|
||||
|
||||
bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD, rtt);
|
||||
|
||||
Reference in New Issue
Block a user