Commit Graph

552 Commits

Author SHA1 Message Date
Peter Nelson
e4cf6ca0ba
Fix: Mis-sized widgets due to missing widget fill. (#14370)
In most places where we calculate and set widget resize step we neglect
to set widget fill step to match. Initial widget sizing uses fill step
instead of resize step, which means the initial size may not be a
multiple of the resize step as intended. In particular this will cause
WWT_MATRIX to be misrendered.

Whether or not this matters depends on the widget type being resized and
the window layout, however for consistency always set fill step to the
same as resize step when calculating.
2025-06-17 17:40:11 +01:00
Colin Caine
5f8e04457e
Codechange: Use default OnHotkey handler for focusing editboxes (#14358) 2025-06-16 22:25:54 +02:00
Peter Nelson
984d864c72 Codechange: Add OnClick handler for dropdown items.
This allows each dropdown item to indicate if something different should happen depending on where in the item was clicked.
2025-05-25 09:13:05 +01:00
frosch
2926179d02 Fix: Restore the behaviour when entering numbers in query windows: clamp integers out of range to the maximum valid value. 2025-05-20 12:57:30 +02:00
frosch
a277cb2b4c Change: [NewGRF] Increase the textstack for all callbacks to 16 registers. 2025-05-09 12:39:11 +02:00
frosch
c6fa5022cb Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100. 2025-05-09 12:39:11 +02:00
frosch
eb9bbb2456 Codechange: Remove direct access to temporary storage from TextRefStack. 2025-05-06 22:24:41 +02:00
frosch
0d5b3ebd7f Codechange: Declare all IntervalTimers const, which can be const. 2025-05-06 18:29:41 +02:00
Peter Nelson
3e608b5fe4
Fix: Zoom-scroll extra viewports only if the mouse cursor is over the viewport. (#14209) 2025-05-04 14:16:05 +01:00
frosch
8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
frosch
cdafc50c94 Codechange: Replace atoi and atoll with ParseInteger. 2025-04-29 20:14:56 +02:00
Rubidium
78250c3bba Codechange: remove const char* overloads when there are std::string_view and std::string& overloads 2025-04-29 10:14:53 +02:00
Peter Nelson
2c4897c2cd
Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
frosch
2a62eea005
Codefix: Comment style. (#14064) 2025-04-21 17:25:09 +02:00
Peter Nelson
394adb654e
Codechange: Move GUI parts of badges to a separate file. (#14023) 2025-04-18 17:20:31 +01:00
Peter Nelson
5008568dfc
Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
frosch
b0d678e375 Codechange: Rename _ignore_restrictions to _ignore_industry_restrictions. 2025-04-11 22:11:28 +02:00
Peter Nelson
2ae84f3c9e
Codechange: CargoSpec::Iterate already tests cargo validity. (#13941) 2025-04-01 18:23:26 +01:00
Peter Nelson
3eb89f04b5
Codechange: Use EnumBitSet for QueryStringFlags. (#13792) 2025-03-10 18:59:35 +00:00
Peter Nelson
b55af05626 Codechange: Pass encoded script strings as EncodedString.
This removes the ambiguity of having std::strings that may or may not be encoded.
2025-03-04 21:40:39 +00:00
Peter Nelson
997b013e6b Codechange: Move to GetWidgetString for industry window. 2025-03-03 20:54:48 +00:00
Peter Nelson
170002ff7e
Codechange: Use parameterised GetString() for industry window. (#13685) 2025-03-01 19:59:43 +00:00
Peter Nelson
6d2f17b92f
Codechange: Use parameterised GetString() for various build windows. (#13676) 2025-03-01 11:08:46 +00:00
Rubidium
f69968f2bc Codechange: explicitly initialise member variables of Windows 2025-02-27 12:21:06 +01:00
Peter Nelson
3cf9b15959 Codechange: Handle SnowTile state separately from ClearGround.
This removes the need for ClearGround to pretend that CLEAR_SNOW exists.
2025-02-25 08:22:46 +00: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
4ac81656ee
Codechange: Simplify some calls to DrawStringMultiLine(). (#13643)
Sometimes the bottom is passed as UINT16_MAX for no reason. In this case just pass the rect.

Other times it's to extend the window height; in that case just extend the rect itself.
2025-02-22 20:41:40 +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
5e43aaff35
Add: Also show badges in fund industry list. (#13590) 2025-02-17 17:27:57 +00:00
Peter Nelson
8f14894024 Add: NewGRF Badges. 2025-02-16 22:24:25 +00:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00: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
Peter Nelson
984da2455b
Codechange: Use EncodedString for Query window. (#13528)
This removes the need to separately capture and store global parameters.
2025-02-11 17:30:16 +00:00
Peter Nelson
2cb9f55183 Codechange: Store EncodedString for tooltip text.
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Rubidium
6e0378f7c1 Codechange: use IndustryID instead of int 2025-02-07 19:26:34 +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
2bb3f368e3 Codechange: Use EnumBitSet for IndustryBehaviours. 2025-02-07 12:30:06 +00:00
Peter Nelson
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. (#13436) 2025-02-01 23:09:18 +00:00
Peter Nelson
40aeedeade Codechange: Use EnumBitSet for callback masks. 2025-01-31 17:08:24 +00:00
Peter Nelson
d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson
efb05396a7 Codechange: Use EnumBitSet for WindowFlags. 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
Rubidium
4b2051a1c1 Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf 2025-01-19 23:01:35 +01:00
Loïc Guilloux
46f181c8a6
Fix #13299: Merge IT_INVALID and INVALID_INDUSTRYTYPE (#13300)
* Fix #13299: Merge IT_INVALID and INVALID_INDUSTRYTYPE

* Codefix: Use NUM_INDUSTRYTILES where it's intended
2025-01-10 01:17:11 +01:00
Peter Nelson
f404f3154e
Fix #13293: Incorrect GRFStringID used for industry cargo suffix text. (#13294)
Industry cargo suffix string should be mapped to 0xD000-0xD400 when the callback result is between 0x800-0xC00,
2025-01-08 19:37:38 +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