|
OpenTTD Source 20251104-master-g3befbdd52f
|
GUI to change NewGRF settings. More...
#include "stdafx.h"#include "error.h"#include "settings_gui.h"#include "newgrf.h"#include "strings_func.h"#include "window_func.h"#include "gamelog.h"#include "settings_type.h"#include "settings_func.h"#include "dropdown_type.h"#include "dropdown_func.h"#include "network/network.h"#include "network/network_content.h"#include "sortlist_type.h"#include "stringfilter_type.h"#include "querystring_gui.h"#include "core/geometry_func.hpp"#include "newgrf_text.h"#include "textfile_gui.h"#include "tilehighlight_func.h"#include "fios.h"#include "timer/timer.h"#include "timer/timer_window.h"#include "zoom_func.h"#include "core/string_consumer.hpp"#include "widgets/newgrf_widget.h"#include "widgets/misc_widget.h"#include "table/sprites.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | NewGRFParametersWindow |
| Window for setting the parameters of a NewGRF. More... | |
| struct | NewGRFTextfileWindow |
| Window for displaying the textfile of a NewGRF. More... | |
| struct | NewGRFWindow |
| Window for showing NewGRF files. More... | |
| class | NWidgetNewGRFDisplay |
| Custom nested widget container for the NewGRF gui. More... | |
| struct | SavePresetWindow |
| Class for the save preset window. More... | |
| struct | ScanProgressWindow |
| Window for showing the progress of NewGRF scanning. More... | |
Typedefs | |
| typedef std::map< uint32_t, const GRFConfig * > | GrfIdMap |
| Map of grfid to the grf config. | |
Functions | |
| void | ShowNewGRFError () |
| Show the first NewGRF error we can find. | |
| static StringID | GetGRFPaletteString (uint8_t palette) |
| static void | ShowNewGRFInfo (const GRFConfig &c, const Rect &r, bool show_params) |
| void | OpenGRFParameterWindow (bool is_baseset, GRFConfig &c, bool editable) |
| void | ShowNewGRFTextfileWindow (Window *parent, TextfileType file_type, const GRFConfig *c) |
| static void | FillGrfidMap (const GRFConfigList &lst, GrfIdMap &grfid_map) |
| Add all grf configs from c into the map. | |
| static void | NewGRFConfirmationCallback (Window *w, bool confirmed) |
| Callback function for the newgrf 'apply changes' confirmation window. | |
| static void | ShowSavePresetWindow (std::string_view initial_text) |
| Open the window for saving a preset. | |
| void | ShowMissingContentWindow (const GRFConfigList &list) |
| Show the content list window with all missing grfs from the given list. | |
| std::unique_ptr< NWidgetBase > | NewGRFDisplay () |
| Construct nested container widget for managing the lists and the info panel of the NewGRF GUI. | |
| void | ShowNewGRFSettings (bool editable, bool show_params, bool exec_changes, GRFConfigList &config) |
| Setup the NewGRF gui. | |
| void | UpdateNewGRFScanStatus (uint num, std::string &&name) |
| Update the NewGRF scan status. | |
Variables | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_parameter_widgets |
| static WindowDesc | _newgrf_parameters_desc (WDP_CENTER, "settings_newgrf_config", 500, 208, WC_GRF_PARAMETERS, WC_NONE, {}, _nested_newgrf_parameter_widgets) |
| Window definition for the change grf parameters window. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_actives_widgets |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_availables_widgets |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_infopanel_widgets |
| static constexpr std::initializer_list< NWidgetPart > | _nested_newgrf_widgets |
| static WindowDesc | _newgrf_desc (WDP_CENTER, "settings_newgrf", 300, 263, WC_GAME_OPTIONS, WC_NONE, {}, _nested_newgrf_widgets) |
| static constexpr std::initializer_list< NWidgetPart > | _nested_save_preset_widgets |
| Widget parts of the save preset window. | |
| static WindowDesc | _save_preset_desc (WDP_CENTER, "save_preset", 140, 110, WC_SAVE_PRESET, WC_GAME_OPTIONS, WindowDefaultFlag::Modal, _nested_save_preset_widgets) |
| Window description of the preset save window. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_scan_progress_widgets |
| Widgets for the progress window. | |
| static WindowDesc | _scan_progress_desc (WDP_CENTER, {}, 0, 0, WC_MODAL_PROGRESS, WC_NONE, {}, _nested_scan_progress_widgets) |
| Description of the widgets and other settings of the window. | |
GUI to change NewGRF settings.
Definition in file newgrf_gui.cpp.
Map of grfid to the grf config.
Definition at line 576 of file newgrf_gui.cpp.
|
static |
Add all grf configs from c into the map.
| lst | Grf list to add. |
| grfid_map | Map to add them to. |
Definition at line 583 of file newgrf_gui.cpp.
References GRFIdentifier::grfid, and GRFConfig::ident.
Referenced by NewGRFWindow::CanUpgradeCurrent(), and NewGRFWindow::UpgradeCurrent().
|
static |
Definition at line 76 of file newgrf_gui.cpp.
|
static |
Callback function for the newgrf 'apply changes' confirmation window.
| w | Window which is calling this callback |
| confirmed | boolean value, true when yes was clicked, false otherwise |
Definition at line 1918 of file newgrf_gui.cpp.
References _gamelog, _grfconfig, NewGRFWindow::active_sel, NewGRFWindow::actives, NewGRFWindow::avails, Window::CloseChildWindows(), CloseWindowByClass(), CopyGRFConfigList(), GUIList< T, P, F >::ForceRebuild(), GLAT_GRF, Gamelog::GRFUpdate(), Window::InvalidateData(), NewGRFWindow::modified, NewGRFWindow::orig_list, ReInitAllWindows(), ReloadNewGRFData(), Gamelog::StartAction(), Gamelog::StopAction(), WC_BUILD_OBJECT, WC_GRF_PARAMETERS, and WC_TEXTFILE.
Referenced by NewGRFWindow::OnClick().
| std::unique_ptr< NWidgetBase > NewGRFDisplay | ( | ) |
Construct nested container widget for managing the lists and the info panel of the NewGRF GUI.
Definition at line 1879 of file newgrf_gui.cpp.
References MakeNWidgets().
| void OpenGRFParameterWindow | ( | bool | is_baseset, |
| GRFConfig & | c, | ||
| bool | editable | ||
| ) |
Definition at line 542 of file newgrf_gui.cpp.
| void ShowMissingContentWindow | ( | const GRFConfigList & | list | ) |
Show the content list window with all missing grfs from the given list.
| list | The list of grfs to check for missing / not exactly matching ones. |
Definition at line 1503 of file newgrf_gui.cpp.
References Compatible, CONTENT_TYPE_NEWGRF, ContentInfo::DoesNotExist, GRFConfig::flags, GCS_NOT_FOUND, GRFConfig::GetName(), GRFIdentifier::grfid, GRFConfig::ident, GRFIdentifier::md5sum, GRFConfig::original_md5sum, ShowNetworkContentListWindow(), GRFConfig::status, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by SaveLoadWindow::OnClick(), NetworkGameWindow::OnClick(), and NewGRFWindow::OnClick().
| void ShowNewGRFError | ( | ) |
Show the first NewGRF error we can find.
Definition at line 47 of file newgrf_gui.cpp.
References _grfconfig, GRFError::custom_message, GRFError::data, GetEncodedStringWithArgs(), GRFError::message, GRFError::param_value, GRFError::severity, ShowErrorMessage(), WL_CRITICAL, and WL_ERROR.
Referenced by _GenerateWorld(), and InitializeWindowsAndCaches().
Definition at line 84 of file newgrf_gui.cpp.
| void ShowNewGRFSettings | ( | bool | editable, |
| bool | show_params, | ||
| bool | exec_changes, | ||
| GRFConfigList & | config | ||
| ) |
Setup the NewGRF gui.
| editable | allow the user to make changes to the grfconfig in the window |
| show_params | show information about what parameters are set for the grf files |
| exec_changes | if changes are made to the list (editable is true), apply these changes immediately or only update the list |
| config | The GRFConfigList that will be shown. |
Definition at line 1966 of file newgrf_gui.cpp.
References CloseWindowByClass(), and WC_GAME_OPTIONS.
Referenced by MenuClickSettings(), SaveLoadWindow::OnClick(), GenerateLandscapeWindow::OnClick(), and NetworkGameWindow::OnClick().
| void ShowNewGRFTextfileWindow | ( | Window * | parent, |
| TextfileType | file_type, | ||
| const GRFConfig * | c | ||
| ) |
Definition at line 570 of file newgrf_gui.cpp.
|
static |
Open the window for saving a preset.
| initial_text | Initial text to display in the edit box, or nullptr. |
Definition at line 2119 of file newgrf_gui.cpp.
References CloseWindowByClass(), and WC_SAVE_PRESET.
Referenced by NewGRFWindow::OnClick().
| void UpdateNewGRFScanStatus | ( | uint | num, |
| std::string && | name | ||
| ) |
Update the NewGRF scan status.
| num | The number of NewGRFs scanned so far. |
| name | The name of the last scanned NewGRF. |
Definition at line 2218 of file newgrf_gui.cpp.
References FindWindowByClass(), ScanProgressWindow::UpdateNewGRFScanStatus(), and WC_MODAL_PROGRESS.
Referenced by GRFFileScanner::AddFile().
|
staticconstexpr |
Definition at line 1746 of file newgrf_gui.cpp.
|
staticconstexpr |
Definition at line 1801 of file newgrf_gui.cpp.
|
staticconstexpr |
Definition at line 1834 of file newgrf_gui.cpp.
|
staticconstexpr |
Definition at line 503 of file newgrf_gui.cpp.
|
staticconstexpr |
Definition at line 1889 of file newgrf_gui.cpp.
|
staticconstexpr |
Widget parts of the save preset window.
Definition at line 1973 of file newgrf_gui.cpp.
|
staticconstexpr |
Widgets for the progress window.
Definition at line 2126 of file newgrf_gui.cpp.