Peter Nelson and Peter Nelson
d30e8dd1c1
Codechange: Use EnumBitSet for WindowDefaultFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson and GitHub
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Rubidium and rubidium42
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Peter Nelson and GitHub
6c9b3f17b7
Fix 4c8f1b0f81: First entry of station cargo filter list was broken. ( #13382 )
...
Additional indent parameter was missing.
2025-01-26 10:09:18 +00:00
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
b60101853c
Codechange: add and use SetString over directly accessing widget_data
2025-01-03 12:14:55 +01:00
Rubidium and rubidium42
9ac1bad480
Codechange: add and use GetString over directly accessing widget_data
2025-01-03 11:11:01 +01:00
Rubidium and rubidium42
7c2668d10f
Codechange: replace SetDataTip(0x0, with SetTooltip(
2025-01-02 23:28:43 +01:00
Rubidium and rubidium42
d8d03212b8
Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_
2025-01-02 23:28:43 +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
Peter Nelson and GitHub
448d6ede4a
Codechange: Use STR_NULL (or {}) instead of literal 0. ( #13222 )
2025-01-01 20:17:20 +00:00
Peter Nelson and Peter Nelson
74087e6a2e
Codechange: Use _TOOLTIP suffix for other tooltip StringIDs.
2025-01-01 02:28:08 +00:00
Peter Nelson and Peter Nelson
3be0166801
Codechange: Use std::ranges::find where possible.
...
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Tyler Trahan and GitHub
c3bb512bd9
Remove: Hidden setting for adjacent stations ( #12862 )
2024-11-06 14:11:07 -05: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
Rubidium and rubidium42
14200212b7
Codechange: use std::optional<std::string> over char * for text query results
2024-06-29 16:33:16 +02:00
Jonathan G Rennison and rubidium42
9c84e5df3f
Add: Road waypoint functionality
2024-06-24 22:12:08 +02:00
Jonathan G Rennison and rubidium42
c6387c7784
Codechange: Use filter template struct for nearby station type filtering
2024-06-24 22:12:08 +02:00
Peter Nelson and GitHub
91fd082e93
Fix: Apply widget's internal padding to scrollbar capacity/position. ( #12801 )
...
For non-WWT_MATRIX widgets, scrollbars need to take account of the internal padding used for the widget.
This is not normally noticeable as framerect padding is only 2 extra pixels
2024-06-22 15:42:13 +00: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
Rubidium and rubidium42
d183d8e587
Codechange: remove INVALID_STRING_ID now drop down uses spans
2024-04-28 18:47:31 +02:00
Rubidium and rubidium42
37a03b513f
Codechange: refactor string list dimension finding into a separate function
2024-04-28 18:47:31 +02:00
Rubidium and rubidium42
ad50c4f298
Codechange: inline sorter name definitions and use proper static accessor instead of (implying) this->
2024-04-28 18:47:31 +02:00
Peter Nelson and Peter Nelson
33aedc43a5
Codechange: Shrink GUIList vectors less often, reserve before use.
...
After sorting and filter lists for GUI, we often shirnk them to reduce size. However this has very little benefit:
1) The memory has already been allocated, so it doesn't prevent that memory being required.
2) It causes a new allocation and copy when the vector is shrunk, actually using more memory.
3) The list is in window state, so the lifetime is only while the window is open.
4) When a filter is clearer, the original size will be needed again, which will cause another allocation.
In fact it is beneficial to reserve to the known maximum in most cases, so do that instead.
2024-04-27 19:25:34 +01:00
Peter Nelson and GitHub
5bc9854be2
Codechange: Make sort list function lists safer. ( #12574 )
...
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.
Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Peter Nelson and Peter Nelson
16eb17418b
Change: Use aspect ratios for some common widgets.
2024-04-19 22:11:16 +01: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
Peter Nelson and Peter Nelson
2047c27445
Codechange: Move drop down list item definitions to separate header.
...
This reduces the scope of the definitions which are no longer needed to create the common lists.
2024-04-01 22:33:16 +01:00
Peter Nelson and Peter Nelson
56cac21086
Codechange: Use functions to create common drop down list items.
2024-04-01 22:33:16 +01:00
Peter Nelson and GitHub
d683ec0183
Codechange: Move dropdown and slider out of widgets directory. ( #12403 )
...
Also shuffle headers to place widget includes near end.
This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Rubidium and rubidium42
e904122441
Codefix: follow coding style
2024-03-22 22:24:17 +01:00
5751da7809
Fix #7982 : Show existing coverage with unambiguous adjacent station ( #12346 )
...
When hovering a tile containing a station, show existing coverage for
that station even when adjacent to a different station.
Co-authored-by: Peter Nelson <peter@fuzzle.org >
2024-03-22 09:33:16 -04:00
Patric Stout and GitHub
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Peter Nelson and GitHub
0058ebe472
Codechange: Check cheap station-facility-filter before expensive in-use-filter. ( #12317 )
2024-03-16 19:37:32 +00:00
Rubidium and rubidium42
27eadc13ec
Codechange: rename TILE_ADD(XY) to TileAdd(XY)
2024-03-10 15:50:24 +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 GitHub
d4f0f0e2c5
Codechange: Use GetVisibleRangeIterators() in more places. ( #12190 )
...
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
2024-02-27 20:10:06 +00:00
Peter Nelson and Peter Nelson
2c78146da5
Change: Limit cargo types in station cargo filter, with "More..." option to show all.
2024-02-07 17:13:37 +00:00
Peter Nelson and Peter Nelson
e517e55620
Change: Include count of stations per cargo type in station cargo filter.
...
Cargo types with no stations are shaded to make the list clearer.
2024-02-07 17:13:37 +00:00
Peter Nelson and Peter Nelson
46da56b191
Change: Replace long list of cargo filter buttons with a multi-select dropdown list.
...
As before, hold ctrl while clicking on an item to toggle selections.
2024-02-07 17:13:37 +00:00
frosch and frosch
68c64d2511
Codechange: Remove TKM string codes by duplicating strings.
2024-01-28 14:44:24 +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
Peter Nelson and Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
2023-12-05 21:12:35 +00:00