Peter Nelson
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
Peter Nelson
3503082f19
Codechange: Move template class implementation includes.
...
These are now placed at the bottom of the including files include list.
2025-03-21 12:53:40 +00:00
Peter Nelson
89948b941b
Codechange: Use emplace_back instead of push_back. ( #13855 )
2025-03-20 17:39:10 +00:00
Peter Nelson
3eb89f04b5
Codechange: Use EnumBitSet for QueryStringFlags. ( #13792 )
2025-03-10 18:59:35 +00:00
Peter Nelson
92fa1b4444
Codechange: Move to GetWidgetString for station windows.
2025-03-03 21:23:13 +00:00
Peter Nelson
78aebfc693
Codechange: Use parameterised GetString() for station view. ( #13692 )
2025-03-01 23:04:51 +00:00
Peter Nelson
6d2f17b92f
Codechange: Use parameterised GetString() for various build windows. ( #13676 )
2025-03-01 11:08:46 +00:00
Peter Nelson
e2c1b9f03e
Codechange: Use only raw strings in drop down lists. ( #13667 )
...
Strings with parameters are now pre-formatted, avoiding global parameters.
Helper functions still allow StringID.
2025-02-27 21:11:16 +00:00
Rubidium
b376e2655a
Codechange: explicitly initialise member variables of Windows
2025-02-27 20:06:06 +01:00
Rubidium
fd4adc55e3
Codechange: replace INVALID_X with XID::Invalid() for PoolIDs
2025-02-16 20:23:00 +01:00
Peter Nelson
f309b90a1d
Codechange: Use EnumBitSet for Airport blocks.
2025-02-13 22:02:02 +00:00
Peter Nelson
75387b9e2b
Codechange: Use EnumBitSet for StationFacility.
2025-02-13 18:03:13 +00:00
Peter Nelson
d61b376998
Codechange: Use EnumBitSet for CargoClasses. ( #13491 )
2025-02-08 08:46:38 +00:00
Peter Nelson
c3643e3ee0
Codechange: Pass raw string to editable query window. ( #13481 )
...
This avoids separating string id and parameters. EncodedString is not needed as it is the raw text that is editable.
2025-02-07 17:03:53 +00:00
Peter Nelson
28eb5e05c8
Codechange: Use EnumBitSet for NWidContainerFlags.
2025-02-06 19:43:35 +00:00
Rubidium
6f8b9fc737
Codechange: remove unneeded casts
2025-02-02 19:45:17 +01:00
Rubidium
9bfddcdbbe
Codechange: make WindowNumber accept ConvertibleThroughBase types
2025-02-02 19:45:17 +01:00
Peter Nelson
fb55ab0742
Codechange: Pass rect to DrawStationCoverageAreaText. ( #13442 )
...
This moves the overflow behaviour to the callers, making it clearer why that is desired.
2025-02-02 17:15:47 +00:00
Rubidium
5a78bb8fac
Codechange: ToWindowNumber describes better what is the intent than Pack
2025-02-02 15:57:18 +01:00
Peter Nelson
d30e8dd1c1
Codechange: Use EnumBitSet for WindowDefaultFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Rubidium
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Peter Nelson
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
b653f875b0
Codechange: Space between `template` and `<` ( #13278 )
...
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Rubidium
ef87acc1ff
Codechange: make STR_NULL the default for all widget construction functions
2025-01-03 23:25:27 +01:00
Rubidium
b60101853c
Codechange: add and use SetString over directly accessing widget_data
2025-01-03 12:14:55 +01:00
Rubidium
9ac1bad480
Codechange: add and use GetString over directly accessing widget_data
2025-01-03 11:11:01 +01:00
Rubidium
7c2668d10f
Codechange: replace SetDataTip(0x0, with SetTooltip(
2025-01-02 23:28:43 +01:00
Rubidium
d8d03212b8
Codechange: replace SetDataTip(SPR_ with SetSpriteTip(STR_
2025-01-02 23:28:43 +01:00
Rubidium
4bf36e3fa6
Codechange: replace SetDataTip(STR_ with SetStringTip(STR_
2025-01-02 23:28:43 +01:00
Peter Nelson
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
448d6ede4a
Codechange: Use STR_NULL (or {}) instead of literal 0. ( #13222 )
2025-01-01 20:17:20 +00:00
Peter Nelson
74087e6a2e
Codechange: Use _TOOLTIP suffix for other tooltip StringIDs.
2025-01-01 02:28:08 +00:00
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
c3bb512bd9
Remove: Hidden setting for adjacent stations ( #12862 )
2024-11-06 14:11:07 -05:00
Peter Nelson
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
14200212b7
Codechange: use std::optional<std::string> over char * for text query results
2024-06-29 16:33:16 +02:00
Jonathan G Rennison
9c84e5df3f
Add: Road waypoint functionality
2024-06-24 22:12:08 +02:00
Jonathan G Rennison
c6387c7784
Codechange: Use filter template struct for nearby station type filtering
2024-06-24 22:12:08 +02:00
Peter Nelson
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
55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. ( #12779 )
2024-06-12 23:08:35 +01:00
Peter Nelson
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
d183d8e587
Codechange: remove INVALID_STRING_ID now drop down uses spans
2024-04-28 18:47:31 +02:00
Rubidium
37a03b513f
Codechange: refactor string list dimension finding into a separate function
2024-04-28 18:47:31 +02:00
Rubidium
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
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
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
16eb17418b
Change: Use aspect ratios for some common widgets.
2024-04-19 22:11:16 +01:00
Peter Nelson
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
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