1
0
Fork 0
Commit Graph

459 Commits (4ee57ed4928e62c169ec808208be584a23dc06a3)

Author SHA1 Message Date
Peter Nelson 4ee57ed492
Codechange: Move to GetWidgetString for build vehicle window. (#13702) 2025-03-02 21:26:44 +00:00
Rubidium 0afae7c546 Codechange: explicitly initialise member variables of Windows 2025-02-23 14:53:42 +01:00
Peter Nelson b28dca2222
Codechange: Preprocess text ref stack parameters. (#13642)
NewGRF text ref stack is now processed in advance, creating parameters as necessary, and then encoding this into an EncodedString.
2025-02-22 22:03:38 +00:00
Peter Nelson bb4ac915ff
Fix 8f14894024: Badge widths were not updated on interface scale change. (#13630)
Prepare GUI badge class lists in OnInit() method of Windows, so that they handle scaling changes.
2025-02-22 13:29:52 +00:00
Peter Nelson 24d327a30b Codechange: Use parameterised-GetString for vehicle related windows. 2025-02-22 10:33:22 +00:00
Peter Nelson 7a23bfa747
Add: Filter purchase lists by badge text. (#13588) 2025-02-17 17:28:26 +00:00
Peter Nelson 8f14894024 Add: NewGRF Badges. 2025-02-16 22:24:25 +00:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Peter Nelson 20e57a02a2
Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Rubidium c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Rubidium ec492cb267 Codechange: make CompanyMask a BaseBitSet implementation 2025-02-09 19:24:51 +01: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 d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson 3c2706f859 Codechange: Use EnumBitSet for EngineDisplayFlags. 2025-01-29 21:46:39 +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
Rubidium 4b2051a1c1 Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf 2025-01-19 23:01:35 +01:00
Rubidium ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidium 9ac1bad480 Codechange: add and use GetString over directly accessing widget_data 2025-01-03 11:11:01 +01:00
Rubidium f0a74fcabb Codechange: use SetToolTip instead of accessing tool_tip directly 2025-01-03 11:09:49 +01:00
Rubidium 3dd0b93698 Codechange: use SetStringTip instead of accessing widget_data and tool_tip directly 2025-01-03 11:09:49 +01:00
Rubidium 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter Nelson 2d372fa516 Codechange: NewGRF strings are not StringIDs.
Add GRFStringID type and use it when dealing with GRF-local string IDs.
2025-01-02 20:03:40 +00:00
Rubidium 562ec74812 Codechange: use explicit TileIndex constructor for converting from window number 2025-01-01 08:26:54 +01:00
Peter Nelson fa1849b855 Codechange: Use std::range::find_if where possible. 2024-11-24 10:36:03 +00:00
Peter Nelson 059a4b22f7 Codechange: Use projection-based std::range::find where possible.
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter Nelson 376e882a14
Codechange: Add HasFlag() to test if a value is present in a bitset enum type. (#12959)
This simplifies tests for `(x & y) != y` with enum classes by reducing repetition, similar to HasBit(), and also makes the intent of the expression clearer.
2024-09-22 14:51:37 +01:00
Joan Josep 891e53c72e
Codechange: move large switch case to separate function (#12863) 2024-07-16 19:41:04 +00:00
Rubidium 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02: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 546a996d95 Codechange: pass options to ShowDropDownMenu using a span 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 f44d8fa2e4
Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter Nelson 0075a95278
Codefix: Make three _filter_funcs definitions distinct. (#12573)
Rename the GUIList function lists defined as the same symbol.
2024-04-25 21:01:15 +01:00
Rubidium b2218e75d4 Codefix: missing space between close parenthesis and open curly brace 2024-04-16 19:28:09 +02:00
Peter Nelson dc7c2bb30d
Fix: Draw continuation lines for engine variant hierarchy tree. (#12434) 2024-04-09 08:35:12 +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 56cac21086 Codechange: Use functions to create common drop down list items. 2024-04-01 22:33:16 +01:00
Peter Nelson 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
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter Nelson a61311fcb0 Codefix: DrawEngineList does not accept EngineID.
Replace min/max parameters of DrawEngineList with scrollbar reference, and use iterators instead of indices.
2024-02-27 17:18:53 +00:00
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 2024-02-25 12:38:07 +00:00
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 2024-02-25 12:38:07 +00:00
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
Peter Nelson 2b79e7cdf5
Fix b7630b0: Incorrect padding for text purchase list. (#12160)
Restore to original (and more normal) framerect padding.
2024-02-22 22:23:29 +00:00
Peter Nelson 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
frosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 2024-01-28 14:44:24 +01:00