Commit Graph
110 Commits
Author SHA1 Message Date
Rubidiumandrubidium42 8ac4112aba Codechange: introduce enums for TrainSignalSide and RoadVehicleDrivingSide 2026-06-09 05:39:15 +02:00
Rubidiumandrubidium42 bcda4a72ee Codechange: make WindowClass a scoped enum 2026-05-20 21:39:04 +02:00
Rubidiumandrubidium42 c59d64c132 Codechange: separate TextColour enumeration and flags 2026-05-18 08:37:42 +02:00
Peter NelsonandGitHub 7e624beadc Codechange: make Shade a scoped enum (#15571)
Renamed from `ColourShade` to `Shade` for brevity.
2026-05-03 15:07:29 +01:00
Rubidiumandrubidium42 99c8a637b4 Codechange: make WindowPosition a scoped enum 2026-04-25 17:15:18 +02:00
Peter NelsonandPeter Nelson c45aa3c9b6 Codechange: use EnumBitSet for CargoTypes 2026-04-21 17:13:31 +01:00
Rubidiumandrubidium42 3b5d46e0bb Codechange: make Colours a scoped enum 2026-04-19 20:53:52 +02:00
Rubidiumandrubidium42 7434052eb6 Codechange: make FontSize a scoped enum 2026-04-12 18:10:34 +02:00
Rubidiumandrubidium42 581a038913 Codechange: add missing @param and @return for linkgraph 2026-02-16 16:34:51 +01:00
Rubidiumandrubidium42 bcaf3eaec2 Codefix: wrong parameter names and partially missing parameters 2026-02-02 18:18:51 +01:00
Cyprian KlimaszewskiandGitHub 99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
Peter NelsonandGitHub 66b6d71e32 Codechange: Use std::initializer_list for NWidgetPart data. (#14749)
Avoids using C/C++ arrays.
2025-11-01 22:33:00 +00:00
Peter NelsonandGitHub 8e2df7809b Codechange: Add distinct type to hold pixel drawing colour. (#14457)
This is used for individual pixels as well as line drawing.
2025-07-20 22:57:55 +01:00
Peter NelsonandGitHub 5008568dfc Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
Peter NelsonandPeter Nelson 8275bbfb87 Codechange: Pass Viewport by reference.
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
Peter NelsonandGitHub b96b26ef15 Codechange: Rename short CargoType parameters cargo. (#13848)
Rename CargoType variables and parameters using short or meaningless names.
2025-03-24 18:18:21 +00:00
Rubidiumandrubidium42 754311a779 Codechange: use std::move when appropriate 2025-03-13 13:00:24 +01:00
Peter NelsonandPeter Nelson edf9f597ec Codechange: Use parameterised GetString() for remaining windows. 2025-03-02 07:29:25 +00:00
Rubidiumandrubidium42 f69968f2bc Codechange: explicitly initialise member variables of Windows 2025-02-27 12:21:06 +01:00
Rubidiumandrubidium42 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidiumandrubidium42 1ffc950e22 Codechange: use prefix operator++ for CompanyID iterations 2025-02-16 14:02:18 +01:00
Peter NelsonandGitHub 20e57a02a2 Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Peter NelsonandPeter Nelson 2cb9f55183 Codechange: Store EncodedString for tooltip text.
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Rubidiumandrubidium42 ec492cb267 Codechange: make CompanyMask a BaseBitSet implementation 2025-02-09 19:24:51 +01:00
Peter NelsonandPeter Nelson 28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Peter NelsonandPeter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 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 810e442203 Codechange: Split GoodsEntry cargo and flows data to unique_ptr. (#13058)
This allows cargo packets and cargo flow data to be empty if not in use, which is the case for the majority of station goods entries, and data is allocated when needed.

This reduces the initial size of a Station from 9192 bytes to 2024 bytes (on 64 bit platforms), although an allocation of 120 bytes is made for each active cargo type at a station.

Based on similar changes in JGRPP.
2025-01-02 20:48:23 +00:00
Peter NelsonandGitHub 14b986609b Add: AppendStringInPlace() to append translated string ID into an existing string. (#12969)
This allows avoiding a string copy when building strings.
2024-10-07 19:05:38 +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 NelsonandPeter Nelson 40fa45a76a Codechange: Emplace std::pair into vectors.
This creates the pair in the vector, instead of creating it then copying it in.
2024-04-20 10:25:20 +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
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter NelsonandPeter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter Nelson ae3390fe48 Codechange: Add ColourShade enum. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter 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
Richard WheelerandGitHub c25d9f5c81 Fix: Make link graph node borders scale with GUI (#12167) 2024-02-23 19:04:34 -05:00
froschandfrosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 2024-01-28 14:44:24 +01:00
Peter NelsonandGitHub c0ab436077 Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
2024-01-21 13:23:04 +00:00
froschandGitHub f457be5a27 Fix #11819, aa5ba5b: Out-of-bounds access in linkgraph GUI. (#11821) 2024-01-17 22:26:33 +01:00
Rubidiumandrubidium42 aa5ba5bd7f Codechange: allow certain enumeration to be added
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +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 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 2023-12-31 15:33:56 +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 NelsonandPeter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
2023-12-29 18:45:43 +00:00
Peter NelsonandPeter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 2023-12-05 21:12:35 +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