Fix engine changes not updating build template train windows

This commit is contained in:
Jonathan G Rennison
2022-11-27 20:22:28 +00:00
parent 5d171e0023
commit 2eecf19edb
5 changed files with 11 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
{ {
InvalidateWindowData(WC_REPLACE_VEHICLE, type, 0); // Update the autoreplace window InvalidateWindowData(WC_REPLACE_VEHICLE, type, 0); // Update the autoreplace window
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well InvalidateWindowClassesData(WC_BUILD_VEHICLE); // The build windows needs updating as well
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN);
} }
static const StringID _start_replace_dropdown[] = { static const StringID _start_replace_dropdown[] = {

View File

@@ -878,6 +878,7 @@ void RecomputePrices()
} }
SetWindowClassesDirty(WC_BUILD_VEHICLE); SetWindowClassesDirty(WC_BUILD_VEHICLE);
SetWindowClassesDirty(WC_BUILD_VIRTUAL_TRAIN);
SetWindowClassesDirty(WC_REPLACE_VEHICLE); SetWindowClassesDirty(WC_REPLACE_VEHICLE);
SetWindowClassesDirty(WC_VEHICLE_DETAILS); SetWindowClassesDirty(WC_VEHICLE_DETAILS);
SetWindowClassesDirty(WC_COMPANY_INFRASTRUCTURE); SetWindowClassesDirty(WC_COMPANY_INFRASTRUCTURE);

View File

@@ -627,7 +627,10 @@ static void CalcEngineReliability(Engine *e)
/* Kick this engine out of the lists */ /* Kick this engine out of the lists */
RetireEngineIfPossible(e, e->duration_phase_1 + e->duration_phase_2 + e->duration_phase_3); RetireEngineIfPossible(e, e->duration_phase_1 + e->duration_phase_2 + e->duration_phase_3);
} }
SetWindowClassesDirty(WC_BUILD_VEHICLE); // Update to show the new reliability SetWindowClassesDirty(WC_BUILD_VEHICLE); // Update to show the new reliability
SetWindowClassesDirty(WC_BUILD_VIRTUAL_TRAIN);
SetWindowClassesDirty(WC_REPLACE_VEHICLE); SetWindowClassesDirty(WC_REPLACE_VEHICLE);
} }
@@ -739,6 +742,7 @@ void StartupEngines()
/* Invalidate any open purchase lists */ /* Invalidate any open purchase lists */
InvalidateWindowClassesData(WC_BUILD_VEHICLE); InvalidateWindowClassesData(WC_BUILD_VEHICLE);
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN);
} }
/** /**
@@ -1105,6 +1109,7 @@ void EnginesMonthlyLoop()
} }
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // rebuild the purchase list (esp. when sorted by reliability) InvalidateWindowClassesData(WC_BUILD_VEHICLE); // rebuild the purchase list (esp. when sorted by reliability)
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN);
} }
} }

View File

@@ -960,6 +960,7 @@ static void UpdateConsists(int32 new_value)
AfterLoadTemplateVehiclesUpdateProperties(); AfterLoadTemplateVehiclesUpdateProperties();
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0); InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN, 0);
SetWindowClassesDirty(WC_TEMPLATEGUI_MAIN); SetWindowClassesDirty(WC_TEMPLATEGUI_MAIN);
SetWindowClassesDirty(WC_CREATE_TEMPLATE); SetWindowClassesDirty(WC_CREATE_TEMPLATE);
} }
@@ -1045,6 +1046,7 @@ static void TrainAccelerationModelChanged(int32 new_value)
/* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */ /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
SetWindowClassesDirty(WC_ENGINE_PREVIEW); SetWindowClassesDirty(WC_ENGINE_PREVIEW);
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0); InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN, 0);
SetWindowClassesDirty(WC_VEHICLE_DETAILS); SetWindowClassesDirty(WC_VEHICLE_DETAILS);
SetWindowClassesDirty(WC_TEMPLATEGUI_MAIN); SetWindowClassesDirty(WC_TEMPLATEGUI_MAIN);
SetWindowClassesDirty(WC_CREATE_TEMPLATE); SetWindowClassesDirty(WC_CREATE_TEMPLATE);
@@ -1183,6 +1185,7 @@ static void RoadVehAccelerationModelChanged(int32 new_value)
/* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */ /* These windows show acceleration values only when realistic acceleration is on. They must be redrawn after a setting change. */
SetWindowClassesDirty(WC_ENGINE_PREVIEW); SetWindowClassesDirty(WC_ENGINE_PREVIEW);
InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0); InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0);
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN, 0);
SetWindowClassesDirty(WC_VEHICLE_DETAILS); SetWindowClassesDirty(WC_VEHICLE_DETAILS);
} }

View File

@@ -2239,6 +2239,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
BuildIndustriesLegend(); BuildIndustriesLegend();
BuildContentTypeStringList(); BuildContentTypeStringList();
InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window. InvalidateWindowClassesData(WC_BUILD_VEHICLE); // Build vehicle window.
InvalidateWindowClassesData(WC_BUILD_VIRTUAL_TRAIN);// Build template trains window.
InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window. InvalidateWindowClassesData(WC_TRAINS_LIST); // Train group window.
InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS);// Trace restrict slots window. InvalidateWindowClassesData(WC_TRACE_RESTRICT_SLOTS);// Trace restrict slots window.
InvalidateWindowClassesData(WC_ROADVEH_LIST); // Road vehicle group window. InvalidateWindowClassesData(WC_ROADVEH_LIST); // Road vehicle group window.