Commit Graph
219 Commits
Author SHA1 Message Date
Peter NelsonandPeter Nelson b4d16d319f Codechange: Replace Alignment enum with struct
Alignment struct contains separate horizontal and vertical alignment members.
2026-06-28 20:43:36 +01:00
Peter Nelsonandrubidium42 a55bd4e041 Codechange: make TransportType a scoped enum 2026-06-22 11:59:24 +02:00
Rubidiumandrubidium42 5a6469ad6f Codechange: make EventState a scoped enum 2026-06-15 11:20:52 +02:00
Rubidiumandrubidium42 d519cad60f Codechange: remove unused path in DrawSortButton and simplify calling 2026-06-14 20:30:16 +02:00
Rubidiumandrubidium42 2ff631caa2 Codechange: make GameMode a scoped enum 2026-05-30 23:20:20 +02:00
Rubidiumandrubidium42 bcda4a72ee Codechange: make WindowClass a scoped enum 2026-05-20 21:39:04 +02:00
Rubidiumandrubidium42 99c8a637b4 Codechange: make WindowPosition a scoped enum 2026-04-25 17:15:18 +02:00
Rubidiumandrubidium42 3b5d46e0bb Codechange: make Colours a scoped enum 2026-04-19 20:53:52 +02:00
Peter NelsonandGitHub a9d7397a77 Codechange: Pass rail and roadtypes separately for tunnel and bridge commands. (#15438)
Avoids passing and casting each via an unrelated type, at the expense of an extra command parameter.
2026-04-06 14:45:22 +01:00
Rubidiumandrubidium42 6370859c7e Codechange: add missing documentation to destructors 2026-02-24 16:24:53 +01:00
Cyprian Klimaszewskiandrubidium42 21bee91fa7 Codechange: Make some variables and constants documentation comments recognised by doxygen. 2026-02-21 15:05:13 +01:00
Rubidiumandrubidium42 8e75626b49 Codechange: unify documentation and parameter names of sorters 2026-02-11 04:53:39 +01:00
Rubidiumandrubidium42 4adf494ebc Codechange: enum-class-ify Commands 2026-01-28 23:32:51 +01:00
Cyprian Klimaszewskiandrubidium42 322ce224b4 Codechange: Make Price an enum class. 2026-01-14 22:07:02 +01:00
Peter NelsonandGitHub f1e831233a Codefix: Mark destructors override. (#14925)
Remove some empty destructors.
2025-12-19 18:14:29 +00:00
Rito12andrubidium42 859b56a066 Doc: Correct file descriptions to match coding style and doxygen. 2025-12-15 17:31:00 +01:00
Rubidiumandrubidium42 5e2df6d028 Codefix: move error instead of copying it 2025-12-14 08:48:28 +01:00
Cyprian KlimaszewskiandGitHub 99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
Peter NelsonandGitHub 66b6d71e32 Codechange: Use std::initializer_list for NWidgetPart data. (#14749)
Avoids using C/C++ arrays.
2025-11-01 22:33:00 +00:00
Peter NelsonandGitHub cd61682ebf Codefix: Don't unnecessarily extract string from bridge CommandCost result. (#14507) 2025-08-10 22:01:03 +01:00
Peter NelsonandGitHub e4cf6ca0ba Fix: Mis-sized widgets due to missing widget fill. (#14370)
In most places where we calculate and set widget resize step we neglect
to set widget fill step to match. Initial widget sizing uses fill step
instead of resize step, which means the initial size may not be a
multiple of the resize step as intended. In particular this will cause
WWT_MATRIX to be misrendered.

Whether or not this matters depends on the widget type being resized and
the window layout, however for consistency always set fill step to the
same as resize step when calculating.
2025-06-17 17:40:11 +01:00
Peter NelsonandPeter Nelson 984d864c72 Codechange: Add OnClick handler for dropdown items.
This allows each dropdown item to indicate if something different should happen depending on where in the item was clicked.
2025-05-25 09:13:05 +01:00
Peter NelsonandGitHub 8b14faaa40 Codechange: Add version of DrawStringMultiLine that performs clipping test. (#14189)
Normally DrawStringMultiLine does not perform any clipping, as the return value may be needed if it the text is not drawn.

In some specific cases the height is already known, so it is possible to test for clipping, which can cut down on layouting time for text which won't be visible.
2025-05-02 22:59:55 +01:00
Peter NelsonandGitHub 6d2f17b92f Codechange: Use parameterised GetString() for various build windows. (#13676) 2025-03-01 11:08:46 +00:00
Rubidiumandrubidium42 0afae7c546 Codechange: explicitly initialise member variables of Windows 2025-02-23 14:53:42 +01:00
Peter NelsonandGitHub 2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Rubidiumandrubidium42 c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter NelsonandPeter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Rubidiumandrubidium42 b60101853c Codechange: add and use SetString over directly accessing widget_data 2025-01-03 12:14:55 +01:00
Rubidiumandrubidium42 9ac1bad480 Codechange: add and use GetString over directly accessing widget_data 2025-01-03 11:11:01 +01:00
Rubidiumandrubidium42 7c2668d10f Codechange: replace SetDataTip(0x0, with SetTooltip( 2025-01-02 23:28:43 +01:00
Rubidiumandrubidium42 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter NelsonandGitHub 55314513ce Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter NelsonandGitHub 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
Rubidiumandrubidium42 d183d8e587 Codechange: remove INVALID_STRING_ID now drop down uses spans 2024-04-28 18:47:31 +02:00
Rubidiumandrubidium42 37a03b513f Codechange: refactor string list dimension finding into a separate function 2024-04-28 18:47:31 +02:00
Rubidiumandrubidium42 ad50c4f298 Codechange: inline sorter name definitions and use proper static accessor instead of (implying) this-> 2024-04-28 18:47:31 +02:00
Peter NelsonandGitHub 5bc9854be2 Codechange: Make sort list function lists safer. (#12574)
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.

Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Peter NelsonandGitHub de4e00c93f Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Peter NelsonandGitHub d683ec0183 Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter NelsonandGitHub d4f0f0e2c5 Codechange: Use GetVisibleRangeIterators() in more places. (#12190)
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
2024-02-27 20:10:06 +00:00
Peter NelsonandPeter Nelson 7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Peter NelsonandPeter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Peter NelsonandPeter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 2023-12-05 21:12:35 +00:00
Peter NelsonandPeter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter NelsonandPeterN e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
PeterNandGitHub fd155dfb40 Change: Scale bridge GUI by interface scale. (#11152) 2023-07-22 17:10:18 +01:00