Rubidium
2926dd2c2f
Codefix: do not dereference the std::end() iterator
2025-03-09 23:33:25 +01:00
Rubidium
0b102db421
Codefix: initialise a few uninitialised variables
2025-03-08 18:01:25 +01: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
Peter Nelson
d30e8dd1c1
Codechange: Use EnumBitSet for WindowDefaultFlags.
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
7c1ddd74d5
Codefix: use SetToolTip(..) instead of SetStringTip(STR_NULL, ..)
2025-01-03 14:18:59 +01:00
Rubidium
e3a5f9b040
Codechange: replace SetDataTip(AWV_ with SetArrowWidgetTypeTip(AWV_
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
fa1849b855
Codechange: Use std::range::find_if where possible.
2024-11-24 10:36:03 +00:00
Peter Nelson
059a4b22f7
Codechange: Use projection-based std::range::find where possible.
...
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter Nelson
3cd1200668
Fix #12976 : Incorrect widget rect scrolling for RTL languages. ( #12978 )
...
Industry directory, AS/GS and Textfile window did not consider RTL when applying horizontal scrolling.
2024-10-05 08:02:59 +01:00
Peter Nelson
908ee7292b
Codechange: Replace all FILE * with FileHandle RAII class. ( #12718 )
...
This removes the need to manually ensure all files are closed.
2024-09-16 08:45:26 +01:00
Peter Nelson
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
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
3d4b98845a
Codechange: Remove initial colour from layouter cache. ( #12728 )
...
Initial colour is now always TC_INVALID, which is substituted with the desired colour when drawing the layout line.
This allows strings which differ only by initial colour to use the same layout cache entry, increasing the efficacy of the cache.
2024-05-28 19:33:44 +01:00
Rubidium
9fe9e4d398
Codechange: use vector instead of manual memory management for decompressing text files
2024-05-04 17:43:02 +02:00
Peter Nelson
a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. ( #12455 )
...
* Codechange: Replace C-style casts to size_t with static_cast.
This touches only simple value-type casts.
* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX
Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +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
56cac21086
Codechange: Use functions to create common drop down list items.
2024-04-01 22:33:16 +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
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
83d63464db
Fix #11966 : Scrollbar may be incorrect on first opening of text file window. ( #11981 )
...
The scrollbar is set up before the true monospace is loaded, so reinitialise the window after loading.
2024-02-04 10:15:20 +00: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
Rubidium
2d77cf9c80
Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with
2024-01-17 19:48:22 +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
Patric Stout
6860a86d45
Codechange: remove all u8 prefix in favour of compile-time option ( #11807 )
2024-01-16 21:33:53 +00: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
Peter Nelson
fd84f73323
Fix #11643 : Empty area at top of survey preview. ( #11647 )
...
Empty area at the top of some textfile windows due to calling
SetDisplayedPlane() after calling FinishInitNested(), and/or changing
the displayed plane and not calling ReInit() after.
This was previously hidden by CheckForMissingGlyphs() reinitialising
all windows anyway.
2023-12-30 00:19:27 +00:00
Peter Nelson
313ee13e5f
Codechange: Add Rect version of FillDrawPixelInfo().
...
This simplifies most callers as they longer have to split out a rect.
2023-12-20 09:29:28 +00:00
rubidium42
27082f9efa
Codechange: pass std::string references to OpenBrowser
2023-11-29 02:02:30 +01:00
Peter Nelson
e3622da408
Fix #11500 : Rename Textfile GUI's LinkType to HyperlinkType. ( #11502 )
...
This disambiguates it with LinkType in league tables.
2023-11-27 10:06:46 +00: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
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
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +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
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Niels Martin Hansen
41de0d46f3
Feature: Help and manuals access window
2023-09-13 16:11:08 +02: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
Patric Stout
7634553d22
Feature: opt-in survey when exiting a game
...
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.
When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU
All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
Patric Stout
febe394806
Codechange: replace C-style strings with C++-style strings in textfile ( #10772 )
2023-05-09 19:35:50 +00:00
Rubidium
fb856e16c1
Codechange: replace some min/clamp constructs to ClampTo
2023-05-06 21:26:13 +02:00
Rubidium
877349c13d
Codechange: use std::string for text file name resolution
2023-05-05 08:54:29 +02:00
Rubidium
f001e84e5e
Codechange: use RAII to automatically restore _cur_dpi after use
2023-01-28 20:33:02 +01:00
Charles Pigott
67f02e20de
Change: Display text files in black ( #10291 )
2022-12-30 10:31:02 +00:00
Peter Nelson
890b2666d3
Change: Use scaled WidgetDimensions.
2022-11-12 18:28:39 +00:00
Peter Nelson
6f95e04005
Change: Use Rect helpers for widget drawing.
...
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Peter Nelson
f6ad8e1c9c
Change: Rename some freetype things to fontcache.
...
The font cache supports more than just FreeType as a font provider, but still used freetype in some naming.
This now uses more suitable terms.
2022-09-25 18:34:24 +01:00
Patric Stout
ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) ( #9304 )
...
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +02:00