Commit Graph

573 Commits

Author SHA1 Message Date
Rubidium 1a3cbaec56 Cleanup: remove warning about server administrators being able to read passwords 2024-05-07 00:03:15 +02:00
Peter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +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 fbdf26800b
Codechange: Use std::initializer_list and range-for for credits window. (#12431)
Replaces C-style array, indexed looping, and char * strings.
2024-04-06 19:30:23 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Kuhnovic ab353f8ad5
Update: Developer credits (#12235) (#12235) 2024-03-08 18:31:58 +01:00
Kuhnovic 1a2b54498b
Change: Show tile index as decimal number in land info window (#12104) 2024-03-05 21:32:29 +01:00
Tyler Trahan 890040ceea
Update: Developer credits (#12173) 2024-03-01 15:47:10 -05: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
Koen Bussemaker 35c89d57f8 Codechange: Added debug printing for Water Regions 2024-02-04 22:50:04 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Peter Nelson 0be26f5856
Change: Remove extra padding from query text. (#11823)
This window uses 'modalpopup' padding so does not need extra padding on its text.
2024-01-17 22:17:14 +00: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 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
Peter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 2023-12-05 21:12:35 +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 ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
2023-11-06 20:29:35 +00:00
Peter Nelson d4a77411a5
Fix: Some NWidget lists were not properly closed. (#11425) 2023-11-03 08:17:26 +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
Peter Nelson bb6fa9bf3b
Change: Display cargo lists in sorted cargo order. (#11383) 2023-10-20 17:32:17 +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
frosch b5885295f0 Codechange: Use parameters, which should be used. 2023-09-19 22:49:59 +02:00
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
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04: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 07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype (#11190)
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
2023-08-15 18:12:05 +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
glx22 46b504a700 Fix: ini_key issues reported by the script 2023-07-14 14:32:46 +02:00
merni-ns fc9afb2d32
Fix #11115: Focus the abandon game/exit game windows (#11125) 2023-07-14 13:57:45 +02:00
Rubidium af9b9327af Codechange: do not keep local variable for temporary string parameters 2023-07-03 18:08:03 +02:00
Rubidium f4a3032985 Codechange: move tooltip and query window over to the new StringParameterBackup type 2023-07-02 22:31:01 +02:00
Rubidium 836541b41c Codechange: use SetDParam and CopyOutDParam for tooltips 2023-06-17 10:01:19 +02:00
PeterN f51f117b00
Change: Add window description flag to disallow interactive window closing. (#11008)
This replaces/simplifies testing for a closebox to allow closing a window with right-click, and testing for specific window classes when closing all windows by hotkey.

This allows right-click closing of dropdowns and the high-score window.
2023-06-14 17:24:14 +01:00
Rubidium 82851a9bef Codechange: do not mess with global string params to get pointer to first element 2023-06-13 23:53:13 +02:00
Rubidium 82b434b589 Codechange: rename function to better describe what it is doing 2023-06-12 09:12:11 +02:00
Rubidium f86500df92 Codechange: remove need for SetDParamX 2023-06-12 09:12:11 +02:00
Rubidium 6c6f365d2f Codechange: remove offset parameter for copying DParams in and out 2023-06-11 17:03:31 +02:00
Rubidium d42ef3a0ef Codechange: inject the query window caption into the widget 2023-06-11 17:03:31 +02:00
Rubidium a4bf45729a Change: move string validation (and assignment) to textbuf 2023-06-04 21:43:07 +02:00
Patric Stout caa0474d30
Fix: crash with tooltip on low resolution screens (#10933) 2023-06-04 16:28:58 +00:00
Patric Stout 0f3dd9c796
Fix: crash when window can't be placed on low resolution screens. (#10932)
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
2023-06-04 15:39:57 +00:00
PeterN 1ff0dc11d8
Fix: Land info window maximum width was not scaled. (#10894) 2023-05-31 08:54:39 +00:00
Peter Nelson f177ce7c9a Codechange: Base CargoArray off std::array.
This avoids needing to define array accessors and allows use of
default value initialization.
2023-05-23 19:07:36 +01:00
Rubidium 6f2f38b3ed Codechange: fmt (and std::format) do explicitly not support enums out-of-the-box
That it works for the version we have packaged it pure coincidence, as that is
one of the few versions that due to a bug allow it. So add the appropriate
template specialisations to support it out-of-the-box within OpenTTD.
2023-05-22 14:42:18 +02:00
Rubidium 6d1586dd49 Codechange: use std::string instead of char* for original editor strings 2023-05-10 23:15:09 +02:00