Commit Graph
543 Commits
Author SHA1 Message Date
Patric StoutandGitHub 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
Rubidiumandrubidium42 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
glx22andLoïc Guilloux 46b504a700 Fix: ini_key issues reported by the script 2023-07-14 14:32:46 +02:00
merni-nsandGitHub fc9afb2d32 Fix #11115: Focus the abandon game/exit game windows (#11125) 2023-07-14 13:57:45 +02:00
Rubidiumandrubidium42 af9b9327af Codechange: do not keep local variable for temporary string parameters 2023-07-03 18:08:03 +02:00
Rubidiumandrubidium42 f4a3032985 Codechange: move tooltip and query window over to the new StringParameterBackup type 2023-07-02 22:31:01 +02:00
Rubidiumandrubidium42 836541b41c Codechange: use SetDParam and CopyOutDParam for tooltips 2023-06-17 10:01:19 +02:00
PeterNandGitHub 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
Rubidiumandrubidium42 82851a9bef Codechange: do not mess with global string params to get pointer to first element 2023-06-13 23:53:13 +02:00
Rubidiumandrubidium42 82b434b589 Codechange: rename function to better describe what it is doing 2023-06-12 09:12:11 +02:00
Rubidiumandrubidium42 f86500df92 Codechange: remove need for SetDParamX 2023-06-12 09:12:11 +02:00
Rubidiumandrubidium42 6c6f365d2f Codechange: remove offset parameter for copying DParams in and out 2023-06-11 17:03:31 +02:00
Rubidiumandrubidium42 d42ef3a0ef Codechange: inject the query window caption into the widget 2023-06-11 17:03:31 +02:00
Rubidiumandrubidium42 a4bf45729a Change: move string validation (and assignment) to textbuf 2023-06-04 21:43:07 +02:00
Patric StoutandGitHub caa0474d30 Fix: crash with tooltip on low resolution screens (#10933) 2023-06-04 16:28:58 +00:00
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
PeterNandGitHub 1ff0dc11d8 Fix: Land info window maximum width was not scaled. (#10894) 2023-05-31 08:54:39 +00:00
Peter NelsonandPeterN 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
Rubidiumandrubidium42 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
Rubidiumandrubidium42 6d1586dd49 Codechange: use std::string instead of char* for original editor strings 2023-05-10 23:15:09 +02:00
Patric StoutandPatric Stout 60399e17bd Codechange: C++-ify the Layouter and related functions
They all now access a std::string_view, instead of a "const char *"
or std::string (in some cases).

Additionally, GetCharAtPosition and friends now return an index
instead of a "const char *", as it makes for a more clear interface.
2023-05-08 19:21:42 +02:00
Peter NelsonandPeterN 61407840c6 Codechange: Remove STR_BLACK_RAW_STRING. 2023-05-05 07:07:54 +01:00
Peter NelsonandPeterN 0880616851 Codechange: Remove various STRING strings. 2023-05-05 07:07:54 +01:00
Peter NelsonandPeterN 5e185d5328 Codechange: Draw tooltip text in black. 2023-05-05 07:07:54 +01:00
PeterNandGitHub 003bab3c8a Change: Size space for editbox clear button by interface scale. (#10749) 2023-04-30 23:11:00 +01:00
Rubidiumandrubidium42 7b539fa7c9 Fix: fmt's {:#04X} yields '0X00', not '0x0000'
Technically the 0X vs 0x is not a big problem, just not pretty. However, the
length also including the 0x results in unexpected behaviour, so it probably
better to not use it.
2023-04-20 21:39:57 +02:00
Patric StoutandPatric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
PeterNandGitHub f1144de509 Feature: Separate rail/road and sea/air velocity units, and add knots. (#10594)
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2023-04-08 12:26:13 -04:00
PeterNandGitHub 73474b08fe Fix: Clicking on editbox clear button didn't take account of padding. (#10583) 2023-03-31 16:07:15 +01:00
Tyler Trahan 066ae6f3fb Codechange: Simplify some CodeQL-flagged trivial switches 2023-03-25 18:03:16 -04:00
Rubidiumandrubidium42 580d0a6343 Codechange: make use of Tile in for all direct map accesses 2023-02-28 07:11:48 +01:00
Rubidiumandrubidium42 f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2023-01-28 20:33:02 +01:00
Rubidiumandrubidium42 bcfe0fb076 Codechange: introduce GetMainWindow() to properly account for nullptr checks
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
2023-01-14 21:15:23 +01:00
PeterNandGitHub 23eec0b7b3 Fix #8971: Resize QueryStrings with interface scale change. (#10281)
* Fix: Use width of caret symbol '_' for text entry.

This replaces an arbitrary pixel width with the space actually required.

* Fix #8971: Update QueryString sizes with interface scale change.
2022-12-25 00:40:55 +00:00
PeterNandGitHub 485368f607 Fix: Missing extra padding when drawing tooltip text. (#10201)
* Fix: Missing extra padding when drawing tooltip text.

This padding is included when calculating the size of the tooltips, the
difference caused a mismatch in height for some tooltips.

* Codechange: Don't draw grey panel underneath tooltip.

This removes the default framerect padding so it is now added explicitly.
SetMinimalSize is also removed as this is overridden in UpdateWidgetSize
anyway.
2022-11-29 18:55:02 +00:00
Tyler TrahanandGitHub b846c574d7 Update: Developer credits (#10190) 2022-11-24 16:08:33 -05:00
Peter NelsonandPeterN dff03124e5 Change: Use modalpopup padding for error/query windows. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN b6ed595176 Codechange: Prefer suggested widget padding. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN cb059fc081 Change: Use Rect for QueryString editor. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 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 NelsonandPeterN eb4ba1991b Change: Use CenterBounds function in more places.
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2022-11-12 18:28:39 +00:00
Nicolas ChappeandMichael Lutz 65530a76f6 Codechange: Allow use of SetDParam for tooltips 2022-10-18 22:03:39 +02:00
Patric StoutandGitHub 8ac0ab47b0 Update: to all the friends we have lost and those we have gained (#10000) 2022-09-04 22:01:08 +02:00
Charles PigottandGitHub 146827c458 Fix #9877: GS could trigger 'Cost: 0' cost message (#9878) 2022-05-05 19:51:56 +01:00
Michael Lutz c6d7b98808 Codechange: Un-bitstuff landscape commands. 2021-12-16 22:28:32 +01:00
Michael Lutz e740c24eb7 Codechange: Template DoCommand to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
rubidium42andrubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Michael Lutz 418e0ea85f Codechange: Use dynamic string list for contents of land info window. 2021-06-12 22:30:38 +02:00