Commit Graph
176 Commits
Author SHA1 Message Date
Peter NelsonandPeter Nelson efb05396a7 Codechange: Use EnumBitSet for WindowFlags. 2025-01-30 08:40:42 +00:00
Rubidiumandrubidium42 e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Rubidiumandrubidium42 ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidiumandrubidium42 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter NelsonandGitHub 55314513ce Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub de4e00c93f Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Jonathan G Rennisonandrubidium42 e42aec5a89 Fix #12305: Crash with large positive sprite x offset in engine preview window 2024-03-21 21:05:27 +01:00
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter NelsonandGitHub 2fd9096070 Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
2024-02-04 10:16:08 +00:00
froschandfrosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
froschandfrosch abfeeea849 Codechange: Compose engine preview text from multiple strings. 2024-01-28 14:44:24 +01:00
Peter NelsonandPeter 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
Peter NelsonandPeter Nelson 952d111b94 Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00
Peter NelsonandPeter 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 NelsonandGitHub 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 NelsonandPeter 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 NelsonandPeter Nelson 616fb48e25 Change: Use modalpopup spacing for engine preview window. 2023-10-26 12:43:20 +01:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter NelsonandPeterN 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
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
PeterNandGitHub 64930c343a Codechange: Pass reference instead of pointer to GUI*Lists. (#10822)
Pointer-avoidance.
2023-05-14 09:17:44 +01: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
Michael Lutz 05ed9f56fd Feature: [NewGRF] Engine name callback. 2023-01-30 22:00:56 +01:00
Rubidiumandrubidium42 8aeef665c7 Fix #10377, Fix 94167df: bad sorting of rail vehicles when primary variant is missing 2023-01-22 21:13:17 +01:00
PeterNandGitHub 53b827c460 Fix: Maximum space for engine preview image was never scaled. (#10219) 2022-12-05 17:57:27 +00:00
Peter NelsonandPeterN 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN cd0d5a771d Fix: Engine preview text overly padded.
WIP_EP_QUESTION is already padded at the widget level, so no need to apply
extra padding to left/right.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN f5f035a22b Codechange: Make use of Rect Width/Height helpers. 2022-11-12 18:28:39 +00:00
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP 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 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
glx22andLoïc Guilloux 994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00
Charles PigottandGitHub 9b800a96ed Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
S. D. CloudtandCharles Pigott 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138andMichael Lutz c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
glxandPeterN b52561fd38 Codechange: use std::sort() in EngList_Sort[Partial]() 2019-04-13 12:49:18 +01:00
glx22andGitHub 66dd7c3879 Fix: MSVC warnings (#7423) 2019-03-28 00:09:33 +01:00
Henry WilsonandPeterN ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN aa7ca7fe64 Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n 2019-03-26 20:15:57 +00:00
Henry WilsonandPeterN a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
peter1138andMichael Lutz 317f69c152 Codechange: Use override specifier in Window-derived classes. 2019-03-24 16:10:04 +01:00
Nikolas NybyandPeterN 6a56a4ce84 Fix #6584: text layout problem in engine preview dialog
With language set to German, there was a problem in this dialog box due
to the long strings in this language. It looks like the call to
`GetStringHeight()` here is using `r.top` to help calculate the
max width, rather than `r.left`.
2019-01-29 07:18:48 +00:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch a682962719 (svn r27889) -Change: Do not cancel headquarter construction and engine-preview-query when shift-clicking (adf88) 2017-07-11 19:37:10 +00:00
alberth da608f6214 (svn r27802) -Add: Display aircraft type in engine preview window (patch by Samu) 2017-03-18 20:48:54 +00:00
alberth dda71fab19 (svn r27800) -Change: Rename long aircraft string names of the preview window 2017-03-18 20:47:48 +00:00
peter1138 1748d7ad6b (svn r26934) -Fix (r26933): Don't statically initialise non-static variables. 2014-09-28 09:21:51 +00:00
peter1138 2b9782fd95 (svn r26933) -Codechange: Resize engine preview window to fit vehicle sprite. 2014-09-28 09:02:11 +00:00