Changeset - r28443:415c3266cbc3
[Not reviewed]
master
0 1 0
Peter Nelson - 11 months ago 2024-01-14 10:49:27
peter1138@openttd.org
Codechange: Don't assume game options widget is a dropdown list.
1 file changed with 16 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -447,13 +447,20 @@ struct GameOptionsWindow : Window {
 
				d.width += padding.width;
 
				d.height += padding.height;
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 

	
 
			default: {
 
			case WID_GO_CURRENCY_DROPDOWN:
 
			case WID_GO_AUTOSAVE_DROPDOWN:
 
			case WID_GO_LANG_DROPDOWN:
 
			case WID_GO_RESOLUTION_DROPDOWN:
 
			case WID_GO_REFRESH_RATE_DROPDOWN:
 
			case WID_GO_BASE_GRF_DROPDOWN:
 
			case WID_GO_BASE_SFX_DROPDOWN:
 
			case WID_GO_BASE_MUSIC_DROPDOWN: {
 
				int selected;
 
				size->width = std::max(size->width, GetDropDownListDimension(this->BuildDropDownList(widget, &selected)).width + padding.width);
 
				break;
 
			}
 
		}
 
	}
 
@@ -620,13 +627,20 @@ struct GameOptionsWindow : Window {
 

	
 
			case WID_GO_BASE_MUSIC_OPEN_URL:
 
				if (BaseMusic::GetUsedSet() == nullptr || BaseMusic::GetUsedSet()->url.empty()) return;
 
				OpenBrowser(BaseMusic::GetUsedSet()->url);
 
				break;
 

	
 
			default: {
 
			case WID_GO_CURRENCY_DROPDOWN:
 
			case WID_GO_AUTOSAVE_DROPDOWN:
 
			case WID_GO_LANG_DROPDOWN:
 
			case WID_GO_RESOLUTION_DROPDOWN:
 
			case WID_GO_REFRESH_RATE_DROPDOWN:
 
			case WID_GO_BASE_GRF_DROPDOWN:
 
			case WID_GO_BASE_SFX_DROPDOWN:
 
			case WID_GO_BASE_MUSIC_DROPDOWN: {
 
				int selected;
 
				DropDownList list = this->BuildDropDownList(widget, &selected);
 
				if (!list.empty()) {
 
					ShowDropDownList(this, std::move(list), selected, widget);
 
				} else {
 
					if (widget == WID_GO_RESOLUTION_DROPDOWN) ShowErrorMessage(STR_ERROR_RESOLUTION_LIST_FAILED, INVALID_STRING_ID, WL_ERROR);
0 comments (0 inline, 0 general)