Speeds up some Hud events when there is no change in value

Especially the three drop-downs related to graphics caused a little bit of lag when they were set, even if their newly set value was the same as the currently set one. This commit adds a check that breaks asap when there is no change necessary.
This commit is contained in:
Ysbrand van Eijck 2020-08-09 22:50:37 +02:00
parent 01ad81322d
commit 3d0e4f13fe
No known key found for this signature in database
GPG Key ID: 73EEE5542E80F6C7

View File

@ -920,6 +920,11 @@ impl PlayState for SessionState {
global_state.settings.save_to_file_warn();
},
HudEvent::ChangeAaMode(new_aa_mode) => {
// No need to change when new == current.
if new_aa_mode == global_state.settings.graphics.aa_mode {
break
}
// Do this first so if it crashes the setting isn't saved :)
global_state
.window
@ -930,6 +935,11 @@ impl PlayState for SessionState {
global_state.settings.save_to_file_warn();
},
HudEvent::ChangeCloudMode(new_cloud_mode) => {
// No need to change when new == current.
if new_cloud_mode == global_state.settings.graphics.cloud_mode {
break
}
// Do this first so if it crashes the setting isn't saved :)
global_state
.window
@ -940,6 +950,11 @@ impl PlayState for SessionState {
global_state.settings.save_to_file_warn();
},
HudEvent::ChangeFluidMode(new_fluid_mode) => {
// No need to change when new == current.
if new_fluid_mode == global_state.settings.graphics.fluid_mode {
break
}
// Do this first so if it crashes the setting isn't saved :)
global_state
.window