Commit Graph

376 Commits

Author SHA1 Message Date
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
Rubidium
e937c4dcfd Codechange: change DestinationID into class with conversion helpers
A DestinationID is either a DepotID or StationID, where the aircraft hangar
being conceptually a depot is actually a StationID. When making those types
stronger, a lot of casts would need to be added, but this shows the intent
much better.
2025-02-06 21:03:24 +01:00
Peter Nelson
28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Peter Nelson
6c4ddb242a Codechange: Use EnumBitSet for EngineMiscFlags. 2025-01-31 18:55:31 +00: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
ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidium
7c1ddd74d5 Codefix: use SetToolTip(..) instead of SetStringTip(STR_NULL, ..) 2025-01-03 14:18:59 +01:00
Rubidium
b60101853c Codechange: add and use SetString over directly accessing widget_data 2025-01-03 12:14:55 +01:00
Rubidium
f0a74fcabb Codechange: use SetToolTip instead of accessing tool_tip directly 2025-01-03 11:09:49 +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
Rubidium
fedfacf472 Codechange: always do StringID + offset, instead of offset + StringID 2025-01-02 17:09:31 +01: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
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
fc7f184dbd Codechange: move knowledge about 'packed' orders to the saveload code 2024-04-20 11:58:07 +02:00
Peter Nelson
6cbb8d02cf Change: Use aspect ratio for shared order list button. 2024-04-19 22:11:16 +01:00
Rubidium
4f2412a272 Codechange: range based for loops instead of C-style for loops 2024-04-11 07:05:04 +02: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
Rubidium
d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 2024-03-24 08:30:38 +01:00
Tyler Trahan
2732b3d6c6
Change: Show unbunching action in timetable window (#12351) 2024-03-23 08:23:13 -04: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
Loïc Guilloux
82430a1086
Fix ab315d0: Don't show "insert order" errors in the console (#12245) 2024-03-09 16:33:44 +00:00
Tyler Trahan
ab315d0dc9
Fix #12118: When adding an unbunching order, properly check for unsafe conditions (#12136) 2024-03-09 08:28:05 -05: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
Tyler Trahan
87a80c7ff2
Change: When adding orders, Ctrl+Click on a depot to unbunch, instead of service if required (#12023) 2024-02-18 10:43:44 -05:00
Tyler Trahan
7b32d9cff5 Fix #12019: Correctly highlight depot unbunch action in dropdown 2024-02-10 15:11:24 -05:00
Peter Nelson
e9ea837311
Fix #12012: Crash when opening orders of another company. (#12013)
Orders window changes tooltip depending on vehicle type but did check if widget exists.
2024-02-06 12:53:23 +00:00
Tyler Trahan
d5e936c9d4
Fix #11968: Always set string parameters to avoid undefined behavior (#11973) 2024-02-04 07:07:47 +01:00
Tyler Trahan
80a704ba11 Fix f6dd505: Split depot action tooltip by vehicle type 2024-02-03 17:32:25 -05:00
Tyler Trahan
f6dd5053a3
Feature: Order flag to unbunch vehicles at depot (#11945) 2024-02-03 08:04:24 -05:00
frosch
b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Tyler Trahan
86981c0983
Fix: Extra refit button when train/RV is in a depot (#11904) 2024-01-28 08:01:09 -05:00
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
400ae65ff2 Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
2024-01-09 18:56:05 +00:00
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
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
938c8339d2 Codechange: Ensure space between for/if and (. 2023-11-09 20:15:38 +00:00
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