Peter Nelson and GitHub
b653f875b0
Codechange: Space between template and < ( #13278 )
...
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Rubidium and rubidium42
ef87acc1ff
Codechange: make STR_NULL the default for all widget construction functions
2025-01-03 23:25:27 +01:00
Rubidium and rubidium42
4bf36e3fa6
Codechange: replace SetDataTip(STR_ with SetStringTip(STR_
2025-01-02 23:28:43 +01:00
Peter Nelson and GitHub
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
Rubidium and rubidium42
c0df898ac5
Codechange: do not implicitly convert during assignment to StrongType
2025-01-01 21:32:51 +01:00
Rubidium and rubidium42
3956ed086a
Codechange: use Date/Year constructor explicitly
2025-01-01 16:25:32 +01:00
Rubidium and rubidium42
58ba8c122b
Codechange: use constructor instead of assignment for date/year constants
2025-01-01 00:10:35 +01:00
Peter Nelson and GitHub
eacec144b0
Fix 56510b5d7b: CargoArray does need to be initialised... ( #13168 )
2024-12-12 19:33:55 +00:00
Peter Nelson and GitHub
56510b5d7b
Codechange: Use CargoArray for linkgraph refresher. ( #13165 )
...
`uint capacities[NUM_CARGO]` looks a lot like CargoArray.
2024-12-11 19:24:58 +00:00
Peter Nelson and Peter Nelson
fa1849b855
Codechange: Use std::range::find_if where possible.
2024-11-24 10:36:03 +00:00
Peter Nelson and GitHub
e1697a6ad1
Codechange: Don't use enums for non-enumerated values. ( #13031 )
...
In the past we have used enums to hold an arbitrary values. These values
are not enumerated types, so make them constants instead.
2024-10-27 18:02:49 +00:00
Peter Nelson and GitHub
d5b57a56f4
Codechange: Use std::unique_ptr for link graph schedule handlers. ( #12988 )
...
This removes manual memory management.
2024-10-15 02:11:06 +01:00
Peter Nelson and GitHub
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
Jonathan G Rennison and rubidium42
4070cf9968
Codefix: LinkGraphOverlay::dirty was never initialised
2024-08-24 21:06:33 +02:00
Peter Nelson and GitHub
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. ( #12779 )
2024-06-12 23:08:35 +01:00
Peter Nelson and GitHub
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
Jonathan G Rennison and rubidium42
9647fe1d05
Change: [Linkgraph] Improve distance scaling algorithm in demand scaler
...
Improve scaling at values other than 0% and 100%
Fix erratic scaling and increase effect size at large setting values
2024-05-01 22:40:17 +02:00
Peter Nelson and Peter 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
Rubidium and rubidium42
4f2412a272
Codechange: range based for loops instead of C-style for loops
2024-04-11 07:05:04 +02:00
Peter Nelson and GitHub
de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. ( #12457 )
...
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Patric Stout and GitHub
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Rubidium and rubidium42
86cb184eb4
Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc
2024-03-10 10:14:20 +01:00
Peter Nelson and Peter Nelson
912d7bd80e
Codechange: Give ColourShade values names instead of numbers.
2024-02-25 12:38:07 +00:00
Peter Nelson and Peter Nelson
ae3390fe48
Codechange: Add ColourShade enum.
2024-02-25 12:38:07 +00:00
Peter Nelson and 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
Richard Wheeler and GitHub
c25d9f5c81
Fix: Make link graph node borders scale with GUI ( #12167 )
2024-02-23 19:04:34 -05:00
frosch and frosch
68c64d2511
Codechange: Remove TKM string codes by duplicating strings.
2024-01-28 14:44:24 +01:00
Tyler Trahan and GitHub
735abfe111
Codechange: Split dates and timers into Economy and Calendar time ( #10700 )
2024-01-22 09:04:34 -05:00
Peter Nelson and GitHub
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
frosch and GitHub
f457be5a27
Fix #11819 , aa5ba5b: Out-of-bounds access in linkgraph GUI. ( #11821 )
2024-01-17 22:26:33 +01:00
Rubidium and rubidium42
aa5ba5bd7f
Codechange: allow certain enumeration to be added
...
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +01:00
Peter Nelson and 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
Peter Nelson and Peter 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 Nelson and Peter Nelson
7124b4eef1
Codechange: Use std::unique_ptr for all NWidgets.
2023-12-31 15:33:56 +00:00
Peter Nelson and 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 and Peter 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
Tyler Trahan
2a62caa30b
Codechange: Use Ticks for BaseConsist timetable fields
2023-12-11 07:12:45 -05:00
Jonathan G Rennison and GitHub
2cbe91c312
Fix #11551 , aab580e0a: Link graph job results were incorrectly applied ( #11558 )
...
Edge flows were incorrectly restricted because the restricted
instead of unrestricted last update date was checked
See also: #10314
2023-12-07 18:38:43 +00:00
Peter Nelson and Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
2023-12-05 21:12:35 +00:00
Jonathan G Rennison and GitHub
c5a292c0df
Fix #11493 : Incorrect flow values in LinkGraphJob::EdgeAnnotation ( #11494 )
2023-11-25 20:57:20 +00:00
Peter Nelson and GitHub
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 and Peter Nelson
d4008850e3
Codechange: Ensure function opening { is on new line.
2023-11-09 20:15:38 +00:00
Peter Nelson and GitHub
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 and GitHub
bbd64bbe2b
Fix #9545 : Crash when all cargo types are disabled. ( #11432 )
...
This is not a very useful state, but it's nice to not crash.
Some parts of the game don't (yet) check for cargo types being redefined, that is out-of-scope here.
2023-11-04 14:42:47 +00:00
Peter Nelson and 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 and Peter Nelson
53845bc024
Codechange: Move includes to correct place.
...
Some other source file inadvertently included things via smallmap_gui.h
2023-11-01 21:49:06 +00:00
Peter Nelson and Peter Nelson
f91462f54b
Codechange: Don't access SmallMapWindow method directly from LinkGraphOverlay.
2023-11-01 21:49:06 +00:00
Peter Nelson and PeterN
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01:00
frosch and frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Peter Nelson and PeterN
9d1b131c44
Codechange: Use correct constant for invalid cargo type.
2023-09-17 16:56:07 +01:00