Changeset - r25034:a41a896ed3c5
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-03-10 12:57:52
truebrain@openttd.org
Codechange: rework codeflow introduced in 098d5b22 (#8837)

It didn't sit well to me, how I wrote the commit initially. First
casting a variable into another, only to write it back into the
originally feels wrong.

This flow makes a bit more sense to me.
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -1873,9 +1873,11 @@ void UpdateGUIZoom()
 
	if (_gui_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
 
		_gui_zoom = static_cast<ZoomLevel>(Clamp(VideoDriver::GetInstance()->GetSuggestedUIZoom(), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
 
	} else {
 
		_gui_zoom = static_cast<ZoomLevel>(Clamp(_gui_zoom_cfg, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
 
		/* Write the value back in case it was not between min/max. */
 
		_gui_zoom_cfg = _gui_zoom;
 
		/* Ensure the gui_zoom is clamped between min/max. Change the
 
		 * _gui_zoom_cfg if it isn't, as this is used to visually show the
 
		 * selection in the Game Options. */
 
		_gui_zoom_cfg = Clamp(_gui_zoom_cfg, _settings_client.gui.zoom_min, _settings_client.gui.zoom_max);
 
		_gui_zoom = static_cast<ZoomLevel>(_gui_zoom_cfg);
 
	}
 

	
 
	/* Determine real font zoom to use. */
0 comments (0 inline, 0 general)