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
André Cheng
339b0ea0ff
Change: Show correct default value and unit for vehicle service interval setting
2024-04-25 20:07:54 +02:00
André Cheng
fd80a1ec66
Fix #11345 : Use correct default button value for vehicle service interval setting
2024-04-25 20:07:54 +02:00
Peter Nelson
2114888485
Change: De-template BaseSetTextfileWindow. ( #12536 )
...
The BaseSet type is not needed after the window is constructed, only the filename and name are required, which can be passed as parameters from `ShowBaseSetTextfileWindow()` instead.
This avoids compiling three instances of `BaseSetTextfileWindow`.
2024-04-20 10:30:29 +01:00
Peter Nelson
16eb17418b
Change: Use aspect ratios for some common widgets.
2024-04-19 22:11:16 +01:00
Rubidium
4f2412a272
Codechange: range based for loops instead of C-style for loops
2024-04-11 07:05:04 +02:00
Peter Nelson
332cbca36e
Codechange: Pass std::string_view from drivers instead of char *.
2024-04-10 22:02:04 +01:00
Peter Nelson
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
eb094a953c
Codefix: Social Plugins widget parts were not constexpr. ( #12443 )
...
Widget lists were made constexpr except these.
2024-04-06 22:32:26 +00:00
Peter Nelson
2047c27445
Codechange: Move drop down list item definitions to separate header.
...
This reduces the scope of the definitions which are no longer needed to create the common lists.
2024-04-01 22:33:16 +01:00
Peter Nelson
56cac21086
Codechange: Use functions to create common drop down list items.
2024-04-01 22:33:16 +01:00
Peter Nelson
d68e5159e1
Feature: Allow base sounds set to be changed mid-game. ( #12399 )
2024-04-01 17:54:42 +01:00
Peter Nelson
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
Peter Nelson
8d312b305b
Codechange: Replace currency macros with functions. ( #12396 )
2024-03-29 14:49:48 +00:00
Rubidium
d09b5aaeba
Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity
2024-03-24 08:30:38 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Rubidium
86cb184eb4
Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc
2024-03-10 10:14:20 +01:00
Peter Nelson
912d7bd80e
Codechange: Give ColourShade values names instead of numbers.
2024-02-25 12:38:07 +00:00
Peter Nelson
ae3390fe48
Codechange: Add ColourShade enum.
2024-02-25 12:38:07 +00:00
Peter Nelson
0463d4c198
Codechange: Remove direct access to _colour_gradient.
...
Access is now through GetColourGradient, which ensures parameters are in range.
2024-02-25 12:38:07 +00:00
Rubidium
4c117dd2d8
Revert #11993 : new number format system does not and cannot work for CJK languages
...
There are too many intricacies that I am unaware of that are popping up after
asking whether things are right or not.
I do not want to keep playing whack-a-mole, so just revert the whole thing.
This reverts:
15be383b93
360fe8b0b6
1aa9a5c0ab
59f56941e5
7e2eefb91f
b741b2ba6f
609d0071d5
9f8fd80112
a253205b93
819c6c756e
2024-02-22 20:40:12 +01:00
Rubidium
15be383b93
Fix a253205: remove (now) unused currency separator
2024-02-18 16:56:52 +01:00
Patric Stout
839f2e025c
Fix: visually also disable vsync when not using HW acceleration ( #12066 )
2024-02-12 03:19:08 +01:00
Patric Stout
849fd5ae03
Change: [Script] replace easy/medium/hard values with default value ( #11959 )
2024-02-03 09:15:03 +00:00
Tyler Trahan
41f2eed425
Feature: Settings to scale cargo production of towns and industries ( #10606 )
2024-01-30 15:11:46 -05:00
merni-ns
5a88027a19
Feature: Infinite money mode ( #11902 )
2024-01-30 18:01:02 +00:00
frosch
022b9e92d2
Codechange: Move settings string formatting into IntSettingDesc members.
2024-01-28 14:44:24 +01:00
Peter Nelson
fef0bfcfd3
Fix: TextfileWindow called virtual methods before constructor completed. ( #11889 )
...
SetStringParameters() was called during widget tree init in the constructor.
Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
2024-01-27 14:45:37 +00:00
Tyler Trahan
21581b6ab3
Feature: Setting for minutes per calendar year ( #11428 )
2024-01-23 18:33:54 -05:00
Tyler Trahan
fd9e72a7e7
Feature: Use real-time "wallclock" timekeeping units ( #11341 )
2024-01-23 11:36:09 -05:00
Patric Stout
d3b2a576de
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc ( #11628 )
2024-01-22 19:22:45 +00:00
Peter Nelson
7faa3848de
Change: Mark whole screen dirty when toggling font AA. ( #11825 )
2024-01-17 23:04:07 +00:00
Michael Lutz
fd59393899
Fix #11791 , e1f5be62: Run missing-glyph detection after toggling sprite font. ( #11812 )
2024-01-17 00:00:26 +01:00
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
Jonathan G Rennison
94e74a45c2
Fix: Viewport virt coords not updated when sprite font toggled ( #11784 )
2024-01-15 19:16:04 +01:00
Peter Nelson
53fa54f8e9
Fix e1f5be62: Clear font cache when toggling sprite font. ( #11780 )
...
This is necessary for the sprite font height and ascender to be updated correctly.
2024-01-15 00:21:11 +00:00
Michael Lutz
e1f5be6244
Add: GUI options to select sprite font and AA mode for all fonts.
2024-01-14 22:50:56 +01:00
Peter Nelson
e3bb6497f7
Codechange: Don't assume game options widget is a dropdown list.
2024-01-14 11:41:11 +00:00
Peter Nelson
8ca867ef63
Codechange: Replace game options' style-breaking if-condition with switch.
2024-01-14 11:41:11 +00:00
Tyler Trahan
1e56bd1e5a
Change: Reorganize Settings menu items ( #11683 )
2024-01-07 08:44:50 -05:00
EmperorJake
6522351a1f
Feature: Setting to disable the loading speed penalty for trains longer than the station
2024-01-04 16:59:11 +01:00
Rubidium
e3f49ee7a0
Codechange: coding style fixes
2024-01-04 16:23:54 +01:00
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
Tyler Trahan
2bada59193
Feature: Mode to display timetable in seconds
2023-12-11 07:12:45 -05:00
Peter Nelson
54d45a6047
Codechange: Don't keep autosave_interval in std::chrono::minutes.
...
This variable is saved as a setting which requires the variable type to be known, but std::chrono::minutes may vary depending on system type.
Instead, keep as uint32_t and convert to std::chrono::minutes only when setting the timer.
2023-12-09 08:13:03 +00:00
Loïc Guilloux
2a22063d77
Change: Remember the active game option window tab ( #11547 )
2023-12-06 14:44:38 +00:00
Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
2023-12-05 21:12:35 +00:00
Peter Nelson
1084ab4b66
Add: Website button to Game Options window for basesets.
...
This links to the optional "url" item in the baseset's [metadata] section.
2023-12-03 18:52:33 +00:00
Peter Nelson
9a92e02fa7
Change: Add tooltips for text file buttons, and shorten Website / Readme buttons. ( #11534 )
2023-12-03 16:54:57 +00:00
Peter Nelson
49532914dd
Change: Use CRTP-mixins to compose dropdown list items.
...
This allows list items to built from component parts as required, and additional
functionality is added:
* Icons and text can be positioned at the start or end of the space (templated.)
* Font size of text can be changed (templated.)
* Palette of sprites can be set (runtime.)
2023-12-02 15:23:05 +00:00
rubidium42
27082f9efa
Codechange: pass std::string references to OpenBrowser
2023-11-29 02:02:30 +01:00
Peter Nelson
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
c80fa7d752
Codechange: Simplify setting minimum width for game options dropdown lists. ( #11474 )
...
Height isn't necessary as drop down controls already have sufficient height, so we can use GetDropDownListDimension() to get the width.
2023-11-20 00:44:06 +00:00
Peter Nelson
293a26f248
Change: Use sparse padding and SETTING_BUTTON sizes for custom currency window. ( #11472 )
2023-11-19 21:12:55 +00:00
Peter Nelson
17ceed0241
Change: Use sparse padding for Game Options window. ( #11463 )
2023-11-16 17:06:38 +00:00
Peter Nelson
bd2ddb07ca
Change: Move baseset missing/corrupted files label to list item. ( #11455 )
...
This allows any baseset error to be displayed in the drop down list so it is more easily visible, and avoids wasted space in the layout.
2023-11-10 12:25:56 +00:00
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
e81313e93e
Feature: Base graphics can offer parameters for additional settings.
2023-10-31 01:41:50 +01:00
frosch
0b7ecf6102
Codechange: use the shortname as unique id to identify the base graphics in openttd.cfg.
2023-10-31 01:41:50 +01:00
frosch
97df27e41f
Codechange: Store base graphics settings in a separate section in openttd.cfg.
2023-10-31 01:41:50 +01:00
Bernhard Reutner-Fischer
ac42dea7b2
Codechange: Remove unused parameter for Height()
...
DropDownListItem::Height does not need to take an argument so remove it
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2023-10-21 18:53:35 +02:00
Peter Nelson
fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. ( #11384 )
...
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
2023-10-20 18:40:48 +01:00
Peter Nelson
f379b31e28
Add: data parameter in Window::Close method.
...
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01:00
frosch
f40816503f
Codechange: Add enum items for dynmically created setting dropdowns.
2023-09-20 22:35:32 +02:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
2023-09-16 23:09:53 +02:00
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
2023-09-10 08:40:25 -04:00
Patric Stout
337b7b0c63
Fix 8c9ecde9: actually remove autosave_interval from setting window ( #11260 )
2023-09-04 11:18:47 +00:00
Peter Nelson
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
mrmbernardi
a5c8365aa4
Feature: Setting to disallow level crossings with competitors ( #10755 )
2023-09-02 12:46:24 +02:00
Tyler Trahan
c7b51a8c3a
Codechange: Use proper date types in various places ( #11177 )
2023-08-11 13:32:42 +00:00
Henry Wilson
a9c65a69d0
Feature: Add config option to set default company secondary colour for new games
...
This does duplicate translation strings for the colours
2023-07-26 16:22:30 +02:00
MasonGulu
0be27778af
Add: alternative setting for right-click close window option to exclude pinned windows ( #10204 )
2023-07-19 23:24:22 +02:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Patric Stout
4f4810dc28
Fix: store autosave settings under the new names
2023-07-19 13:17:50 +02:00
glx22
46b504a700
Fix: ini_key issues reported by the script
2023-07-14 14:32:46 +02:00
merni-ns
161cc04b8a
Fix #11087 : Disable base graphics/sound dropdown outside main menu
2023-07-01 19:03:45 +02:00
PeterN
d140acf34e
Fix: Setting tree lines drawn incorrectly for RTL languages. ( #11070 )
2023-06-25 19:32:53 +01:00
Peter Nelson
40a9b080aa
Fix: Ensure settings page label is orange.
2023-06-25 17:22:02 +01:00
Peter Nelson
9dd9b8ec74
Fix #11054 : Prevent translation of currency codes.
...
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.
Instead, hard code the currency code list and add it when drawing the
currency name.
2023-06-23 16:47:32 +01:00
PeterN
d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. ( #11063 )
...
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.
Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.
This also means that strings no longer need to be formatted on every draw.
2023-06-23 08:30:13 +00:00
Rubidium
74924c8186
Codechange: includes must be before 'safeguards.h'
2023-06-18 21:22:14 +02:00