Rubidium and rubidium42
70c9f3963c
Codechange: strongly type VehicleID
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
1003967267
Codechange: strongly type TownID
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
d3408a4542
Codechange: strongly type IndustryID
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
7e04651220
Codechange: strongly type EngineID
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
380e7b48ce
Codechange: use std::variant instead of a custom version for news references
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
9015c3651f
Codechange: make EngineID an enum
2025-02-16 14:50:15 +01:00
Rubidium and rubidium42
c3d5e6d2a0
Codechange: Use EnumBitSet for DoCommandFlags
2025-02-14 00:28:57 +01:00
Jonathan G Rennison and rubidium42
d06b371254
Cleanup: Fix various spelling errors
2025-02-12 22:44:51 +01:00
Peter Nelson and Peter Nelson
9a6fc4eb76
Codechange: Use enum class for NewsReferenceType.
2025-02-07 19:36:52 +00:00
Peter Nelson and Peter Nelson
ca75a8ce19
Codechange: Use enum class for NewsType.
2025-02-07 19:36:52 +00:00
Peter Nelson and Peter Nelson
4fd1929bf7
Codechange: Use EnumBitSet for NewsFlags.
2025-02-07 19:36:52 +00:00
Peter Nelson and GitHub
eaa765d615
Codechange: Disentangle news window style from news flags. ( #13482 )
...
This avoids NewsFlags being used as both bitmask and bitstuffed data.
2025-02-07 13:10:39 +00:00
Peter Nelson and Peter Nelson
693a5f42b9
Codechange: Use EnumBitSet for NWidgetDisplayFlags.
2025-02-06 19:43:35 +00:00
Peter Nelson and Peter Nelson
d30e8dd1c1
Codechange: Use EnumBitSet for WindowDefaultFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson and Peter Nelson
efb05396a7
Codechange: Use EnumBitSet for WindowFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson and GitHub
183779c4a2
Codefix: Incorrect NWidgetPart type for NWID_LAYER. ( #13357 )
...
Due to function overloads and default parameters, the wrong `NWidget()` function was called, resulting resulting in the wrong `NWidgetPart` being created.
2025-01-22 20:43:54 +00:00
Rubidium and rubidium42
08d84b2f4a
Codechange: use AdviceType over StringID to remove vehicle advice news
2025-01-08 02:03:55 +01:00
Rubidium and rubidium42
ef87acc1ff
Codechange: make STR_NULL the default for all widget construction functions
2025-01-03 23:25:27 +01:00
Rubidium and rubidium42
7c1ddd74d5
Codefix: use SetToolTip(..) instead of SetStringTip(STR_NULL, ..)
2025-01-03 14:18:59 +01:00
Rubidium and rubidium42
b60101853c
Codechange: add and use SetString over directly accessing widget_data
2025-01-03 12:14:55 +01:00
Rubidium and rubidium42
9ac1bad480
Codechange: add and use GetString over directly accessing widget_data
2025-01-03 11:11:01 +01:00
Rubidium and rubidium42
7c2668d10f
Codechange: replace SetDataTip(0x0, with SetTooltip(
2025-01-02 23:28:43 +01:00
Rubidium and rubidium42
4bf36e3fa6
Codechange: replace SetDataTip(STR_ with SetStringTip(STR_
2025-01-02 23:28:43 +01:00
Peter Nelson and GitHub
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
Peter Nelson and GitHub
6f8e30c55d
Codechange: Use unique_ptr throughout instead of new raw pointer for company news data. ( #13148 )
...
The pointer was already captured and converted to a unqiue_ptr, but hidden within the call stack.
This now makes it clearer that the object passed to Add.*NewsItem will become owned by the news item.
2024-12-04 12:18:34 +00:00
Peter Nelson and Peter Nelson
910dd65710
Change: Improve news window layouts.
...
* Use appropriate container widget nesting with padding, instead of single-sided padding.
* Use layer widget to allow main news message to overlay close box and date widgets, to more closely match the old fixed-pixel layout.
2024-12-01 09:44:11 +00:00
Peter Nelson and GitHub
568bb1f5da
Change: [UI] Improve visual padding of vehicle news items. ( #13134 )
2024-11-30 15:29:36 +00:00
Peter Nelson and GitHub
446db2c826
Codechange: Remove redundant NewsStringData data. ( #12983 )
...
Since SetDParamStr() always owns a copy of the string, there is no need to make another copy of it to keep it around while the news item exists.
This also fixes a leak in `CmdIndustrySetProduction` as the allocated data wasn't passed to AddIndustryNewsItem.
2024-10-08 19:48:55 +01:00
Peter Nelson and Peter Nelson
3d8d0e0d26
Codechange: Use std::variant to store string parameter data.
...
This avoids storing two separate values and makes the test for which type is held clearer.
This replaces use of unique_ptr for conditionally storing a string, and is also used in place of StringParameterBackup.
2024-09-14 15:31:05 +01:00
Peter Nelson and GitHub
91fd082e93
Fix: Apply widget's internal padding to scrollbar capacity/position. ( #12801 )
...
For non-WWT_MATRIX widgets, scrollbars need to take account of the internal padding used for the widget.
This is not normally noticeable as framerect padding is only 2 extra pixels
2024-06-22 15:42:13 +00:00
Peter Nelson and GitHub
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. ( #12779 )
2024-06-12 23:08:35 +01:00
Peter Nelson and GitHub
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 and GitHub
5b35fbd6f5
Change: Use button aspect ratio for buttons that show vehicle icons. ( #12636 )
2024-05-09 07:01:56 +01:00
Peter Nelson and GitHub
90ca3515da
Fix #12459 , f6a88e4: Crashes when deleting news messages. ( #12460 )
...
The updated logic in f6a88e4 for deleting news messages did things in the wrong order.
2024-04-09 21:46:29 +01:00
Peter Nelson and GitHub
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 Nelson and GitHub
74e09abf76
Codechange: Use dynamic_cast instead of C-cast after FindWindowById. ( #12448 )
...
dynamic_cast was used in most places, but not all.
2024-04-08 13:26:19 +01:00
Peter Nelson and GitHub
f6a88e40a4
Codechange: Use std::list for News Items. ( #12338 )
2024-04-04 07:53:14 +01:00
Peter Nelson and GitHub
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
Rubidium and rubidium42
86cb184eb4
Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc
2024-03-10 10:14:20 +01:00
Tyler Trahan and GitHub
735abfe111
Codechange: Split dates and timers into Economy and Calendar time ( #10700 )
2024-01-22 09:04:34 -05:00
Patric Stout and Patric Stout
fd073a2810
Remove: replace custom span with std::span
2024-01-17 00:25:08 +01:00
Peter Nelson and Peter 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
Rubidium and rubidium42
e3f49ee7a0
Codechange: coding style fixes
2024-01-04 16:23:54 +01:00
Peter Nelson and Peter 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 Nelson and GitHub
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. ( #11481 )
...
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson and Peter Nelson
d4008850e3
Codechange: Ensure function opening { is on new line.
2023-11-09 20:15:38 +00:00
Peter Nelson and Peter 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
frosch and frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
2023-09-10 08:40:25 -04:00
Peter Nelson and PeterN
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