diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index da74010eb0..83d9f1fa6c 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -636,7 +636,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->vscroll2 = this->GetScrollbar(WID_NS_SCROLL2BAR); this->GetWidget(WID_NS_SHOW_REMOVE)->SetDisplayedPlane(this->editable ? 0 : 1); - this->GetWidget(WID_NS_SHOW_APPLY)->SetDisplayedPlane(this->editable ? 0 : this->show_params ? 1 : SZSP_HORIZONTAL); + this->GetWidget(WID_NS_SHOW_EDIT)->SetDisplayedPlane(this->editable ? 0 : (this->show_params ? 1 : SZSP_HORIZONTAL)); + this->GetWidget(WID_NS_SHOW_APPLY)->SetDisplayedPlane(this->editable && this->execute ? 0 : SZSP_VERTICAL); this->FinishInitNested(WN_GAME_OPTIONS_NEWGRF_STATE); this->querystrings[WID_NS_FILTER] = &this->filter_editbox; @@ -1080,19 +1081,14 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WID_NS_APPLY_CHANGES: // Apply changes made to GRF list if (!this->editable) break; - if (this->execute) { - ShowQuery( - GetEncodedString(STR_NEWGRF_POPUP_CAUTION_CAPTION), - GetEncodedString(STR_NEWGRF_CONFIRMATION_TEXT), - this, - NewGRFConfirmationCallback - ); - } else { - CopyGRFConfigList(this->orig_list, this->actives, true); - ResetGRFConfig(false); - ReloadNewGRFData(); - this->InvalidateData(GOID_NEWGRF_CHANGES_APPLIED); - } + + ShowQuery( + GetEncodedString(STR_NEWGRF_POPUP_CAUTION_CAPTION), + GetEncodedString(STR_NEWGRF_CONFIRMATION_TEXT), + this, + NewGRFConfirmationCallback + ); + this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window break; @@ -1233,11 +1229,6 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->modified = true; break; - - case GOID_NEWGRF_CHANGES_APPLIED: - /* No changes have been made to the list of active NewGRFs since the last time the changes got applied */ - this->modified = false; - break; } this->BuildAvailables(); @@ -1861,7 +1852,7 @@ static constexpr NWidgetPart _nested_newgrf_infopanel_widgets[] = { EndContainer(), /* Right side, config buttons. */ - NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NS_SHOW_APPLY), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NS_SHOW_EDIT), NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0), NWidget(NWID_VERTICAL), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_NS_SET_PARAMETERS), SetFill(1, 0), SetResize(1, 0), @@ -1869,8 +1860,10 @@ static constexpr NWidgetPart _nested_newgrf_infopanel_widgets[] = { NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_NS_TOGGLE_PALETTE), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_NEWGRF_SETTINGS_TOGGLE_PALETTE, STR_NEWGRF_SETTINGS_TOGGLE_PALETTE_TOOLTIP), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_NS_APPLY_CHANGES), SetFill(1, 0), SetResize(1, 0), - SetStringTip(STR_NEWGRF_SETTINGS_APPLY_CHANGES), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NS_SHOW_APPLY), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_NS_APPLY_CHANGES), SetFill(1, 0), SetResize(1, 0), + SetStringTip(STR_NEWGRF_SETTINGS_APPLY_CHANGES), + EndContainer(), EndContainer(), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_NS_VIEW_PARAMETERS), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_NEWGRF_SETTINGS_SHOW_PARAMETERS), diff --git a/src/widgets/newgrf_widget.h b/src/widgets/newgrf_widget.h index 9c8a6aa1cd..d58624ab1d 100644 --- a/src/widgets/newgrf_widget.h +++ b/src/widgets/newgrf_widget.h @@ -58,7 +58,8 @@ enum NewGRFStateWidgets : WidgetID { WID_NS_CONTENT_DOWNLOAD, ///< Open content download (available NewGRFs). WID_NS_CONTENT_DOWNLOAD2, ///< Open content download (active NewGRFs). WID_NS_SHOW_REMOVE, ///< Select active list buttons (0 = normal, 1 = simple layout). - WID_NS_SHOW_APPLY, ///< Select display of the buttons below the 'details'. + WID_NS_SHOW_EDIT, ///< Select display of the buttons below the 'details'. + WID_NS_SHOW_APPLY, ///< Select display of the apply button. }; /** Widgets of the #SavePresetWindow class. */ diff --git a/src/window_type.h b/src/window_type.h index 62de2281cf..28f72486b7 100644 --- a/src/window_type.h +++ b/src/window_type.h @@ -733,7 +733,6 @@ enum GameOptionsInvalidationData : uint8_t { GOID_NEWGRF_CURRENT_LOADED, ///< The current list of active NewGRF has been loaded. GOID_NEWGRF_LIST_EDITED, ///< List of active NewGRFs is being edited. GOID_NEWGRF_CHANGES_MADE, ///< Changes have been made to a given NewGRF either through the palette or its parameters. - GOID_NEWGRF_CHANGES_APPLIED, ///< The active NewGRF list changes have been applied. }; struct Window;