Commit Graph

703 Commits

Author SHA1 Message Date
Peter Nelson
382d30dbb2
Codechange: Use parameterised GetString() for settings window. (#13695) 2025-03-02 07:29:00 +00:00
Peter Nelson
e2c1b9f03e
Codechange: Use only raw strings in drop down lists. (#13667)
Strings with parameters are now pre-formatted, avoiding global parameters.

Helper functions still allow StringID.
2025-02-27 21:11:16 +00:00
Rubidium
b376e2655a Codechange: explicitly initialise member variables of Windows 2025-02-27 20:06:06 +01:00
Peter Nelson
f10ece41f8
Codechange: Split SettingEntry-related code to own file. (#13663) 2025-02-26 19:50:02 +00:00
Peter Nelson
4ac81656ee
Codechange: Simplify some calls to DrawStringMultiLine(). (#13643)
Sometimes the bottom is passed as UINT16_MAX for no reason. In this case just pass the rect.

Other times it's to extend the window height; in that case just extend the rect itself.
2025-02-22 20:41:40 +00:00
Rubidium
5cee804f98 Codechange: remove ZeroedMemoryAllocator from NWidgetBase 2025-02-22 14:38:33 +01:00
Peter Nelson
2b80812922
Codechange: Use parameterised GetString() in network-related windows. (#13635) 2025-02-22 13:16:47 +00:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Jonathan G Rennison
4d0682d034
Fix 1d04d402: Inverted visibility state in SettingsPage::UpdateFilterState (#13543) 2025-02-12 21:34:59 +00:00
Peter Nelson
1d04d4027a
Codechange: Use EnumBitSet for SettingEntryFlags. (#13534) 2025-02-11 22:18:06 +00:00
Peter Nelson
984da2455b
Codechange: Use EncodedString for Query window. (#13528)
This removes the need to separately capture and store global parameters.
2025-02-11 17:30:16 +00:00
Tyler Trahan
b2f5a4901b
Add: Setting to allow placing houses manually in-game (#13266) 2025-02-09 18:34:31 +00:00
Peter Nelson
d9bb002cac
Codechange: Use local parameters for formatting settings values. (#13487) 2025-02-07 20:18:03 +00:00
Peter Nelson
99a32207b8
Codechange: Use preformatted strings for slider marks. (#13484) 2025-02-07 18:14:53 +00:00
Peter Nelson
c3643e3ee0
Codechange: Pass raw string to editable query window. (#13481)
This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
2025-02-07 17:03:53 +00:00
Peter Nelson
28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Peter Nelson
c4c5028862
Codechange: Use EnumBitSet for SettingFlags. (#13429) 2025-02-01 15:46:51 +00:00
Peter Nelson
56b1e9df1f Codechange: Use EnumBitSet for FrameFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson
d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson
efb05396a7 Codechange: Use EnumBitSet for WindowFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. (#13383) 2025-01-28 22:17:34 +00:00
Rubidium
45444f9666 Codechange: rename DECLARE_POSTFIX_INCREMENT to DECLARE_INCREMENT_DECREMENT_OPERATORS 2025-01-28 18:56:58 +01:00
Peter Nelson
9b947a37b8
Codechange: Pass GRFConfig by reference where feasible. (#13388)
In places where a GRFConfig is passed by pointer and not checked for nullptr, use a reference instead.
2025-01-26 22:41:08 +00:00
Rubidium
4b2051a1c1 Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf 2025-01-19 23:01:35 +01:00
glx22
7493b2d0c1 Codechange: Add callback to IntSettingDesc to support dynamic min/max 2025-01-05 23:31:50 +01:00
Peter Nelson
b653f875b0
Codechange: Space between template and < (#13278)
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Rubidium
ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Loïc Guilloux
b3660bf24a
Fix: IntSettingDesc may have a callback for default value (#13240) 2025-01-03 15:05:56 +01:00
Rubidium
7c1ddd74d5 Codefix: use SetToolTip(..) instead of SetStringTip(STR_NULL, ..) 2025-01-03 14:18:59 +01:00
Rubidium
7c2668d10f Codechange: replace SetDataTip(0x0, with SetTooltip( 2025-01-02 23:28:43 +01:00
Rubidium
e3a5f9b040 Codechange: replace SetDataTip(AWV_ with SetArrowWidgetTypeTip(AWV_ 2025-01-02 23:28:43 +01:00
Rubidium
d8d03212b8 Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_ 2025-01-02 23:28:43 +01:00
Rubidium
4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter Nelson
448d6ede4a
Codechange: Use STR_NULL (or {}) instead of literal 0. (#13222) 2025-01-01 20:17:20 +00:00
Peter Nelson
98e980c478
Codechange: WWT_TEXT, WWT_LABEL and WWT_EMPTY don't use colour. (#13218)
Set colour for these widget types to INVALID_COLOUR to avoid giving the impression that the colour has a purpose.

A runtime exception is added to catch this the existing widget unit test.
2025-01-01 15:38:19 +00:00
Rubidium
3956ed086a Codechange: use Date/Year constructor explicitly 2025-01-01 16:25:32 +01:00
Peter Nelson
0e1002bca6 Codechange: Use _TOOLTIP instead of _TT suffix for tooltip StringIDs. 2025-01-01 02:28:08 +00:00
Peter Nelson
3a310f1802
Codechange: Store GRFConfig parameters in a vector. (#13137)
All GRFConfigs have space allocated for parameters, but only configured GRFConfigs need them.

Using a vector instead means that space is only used when parameters are used.
2024-12-01 15:15:21 +00:00
Peter Nelson
3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Peter Nelson
6e940af08d Fix #12952: Incorrect string parameters passed for social plugin titles.
When no option is selected (i.e. during SetupSmallestSize), a different string parameter layout was used that did not match the visible layout.
2024-09-19 18:44:23 +01:00
Rubidium
14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
merni-ns
0409577277
Add: Setting to disable warning for old vehicles (#12714) 2024-06-15 17:14:29 -04:00
Peter Nelson
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter Nelson
4cf6d1dd79
Codechange: Pass WindowDesc by reference instead of pointer. (#12771)
WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
2024-06-11 08:58:03 +01:00
Peter Nelson
0f230244fe
Codechange: [UI] Remove redundant SetMinimalSize for WWT_EDITBOX widgets. (#12733) 2024-05-30 08:34:26 +01:00
merni-ns
55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
Peter Nelson
4740eeaa43
Add: 'Get Content' buttons next to base set dropdowns in Game Options. (#12627)
This allows base set content to be downloaded more easily, filtered by type and next to where it is set up.
2024-05-05 16:15:35 +01:00
Peter Nelson
9a7c30a109 Codechange: Let ClickSliderWidget handle rounding to nearest mark. 2024-05-03 11:48:36 +01:00
Peter Nelson
9d2efd4c96 Codechange: Use callback function to set labels of slider widget marks.
Slider widgets can only use a predefined list of values and strings to draw labels. This makes it difficult to vary the display by context.

Instead of providing a predefined list as a std::map, use a callback function instead. This function can decide what text to display, and can call SetDParam to dynamically set up strings.
2024-05-03 11:48:36 +01:00
André Cheng
ceb0053dd9 Codechange: Correct return type of GetDefaultValueCallback 2024-04-25 20:07:54 +02:00