1
0
Fork 0
Commit Graph

158 Commits (649ed702cc70501c17ebea72289d89186995d59b)

Author SHA1 Message Date
Peter Nelson 3eb89f04b5
Codechange: Use EnumBitSet for QueryStringFlags. (#13792) 2025-03-10 18:59:35 +00:00
Peter Nelson d7963f6eb7 Codechange: Drop default widget strings for NewGRF debug window. 2025-03-04 08:23:28 +00:00
Peter Nelson 913eadd6b0
Codechange: Use GetWidgetString for NewGRF debug window. (#13697) 2025-03-02 12:46:01 +00:00
Peter Nelson 57f0ed716e
Codechange: Use parameterised GetString() for drawing NewGRF info. (#13674) 2025-02-28 21:05:12 +00:00
Rubidium c540c2bcf7 Codechange: explicitly initialise member variables of Windows 2025-02-27 19:58:31 +01:00
Peter Nelson 370c702549
Add: Show badges in NewGRF debug window. (#13597) 2025-02-17 22:15:45 +00:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium 70c9f3963c Codechange: strongly type VehicleID 2025-02-16 14:50:15 +01:00
Rubidium b0eb8fe4db Codechange: introduce ConvertibleThroughBase helpers 2025-02-16 14:02:18 +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 28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Rubidium 8f72a478f0 Codechange: change 'return existing window' to a template parameter
This change is made to make it possible to pass arbitrary other parameters
to the constructor of the window instances.
2025-02-02 15:57:18 +01:00
Peter Nelson 40aeedeade Codechange: Use EnumBitSet for callback masks. 2025-01-31 17:08:24 +00:00
Peter Nelson a252ba3146
Codechange: Modernise NewGRF debug helper definitions. (#13410)
* Replace pointers and null-terminated lists with spans.
* Replace raw (undeleted) pointer with unique_ptr.
* Replace const char * with string_view.
2025-01-30 18:50:53 +00:00
Peter Nelson 56b1e9df1f Codechange: Use EnumBitSet for FrameFlags. 2025-01-30 08:40:42 +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 4099acb946 Codechange: replace BSWAP32/BSWAP16 with std::byteswap 2025-01-28 19:22:12 +01:00
Rubidium e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Peter Nelson 4397aa3909
Codechange: Make StationType an enum class. (#13339) 2025-01-19 20:53:08 +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 ee3ea57a85 Codechange: replace SetDataTip(RWV_ with SetResizeWidgetTypeTip(RWV_ 2025-01-02 23:28:43 +01:00
Rubidium e3a5f9b040 Codechange: replace SetDataTip(AWV_ with SetArrowWidgetTypeTip(AWV_ 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 98e980c478
Codechange: WWT_TEXT, WWT_LABEL and WWT_EMPTY don't use colour. (#13218)
Set colour for these widget types to INVALID_COLOUR to avoid giving the impression that the colour has a purpose.

A runtime exception is added to catch this the existing widget unit test.
2025-01-01 15:38:19 +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
Loïc Guilloux 29ce013eda
Codechange: Pass avail(able) as reference instead of pointer since they are never nullptr (#12696) 2024-05-18 17:04:16 +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
Rubidium 1fcf1a136d Codechange: use single function returning std::span over two functions that return size and begin 2024-04-07 22:02:16 +02:00
Peter Nelson 34ba969c74
Change: Display more useful information in sprite aligner than sprite ID. (#12439)
Sprite IDs are not useful information given they change don't refer to anything outside the loaded game.

Instead, include the filename and nfo line at minimum, and include action A or action 5 sprite replacement information if applicable.
2024-04-06 21:16:02 +01:00
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson 3c94e81665 Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +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
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 a602845d0a
Fix #12202: Race condition when using sprite picker. (#12204)
When using the sprite picker the screen is redrawn so that the sprites under the mouse cursor can be captured. This redraw also caused the sprite aligner window to be redrawn before the OnInvalidateData event that updates its scrollbars with the list count.
2024-03-01 22:08:18 +00:00
Peter Nelson 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 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
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01: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 5cb7a16edc
Fix #11618: Don't try to display unavailable zoom levels in sprite aligner. (#11619) 2023-12-23 13:17:33 +00:00
Peter Nelson 313ee13e5f Codechange: Add Rect version of FillDrawPixelInfo().
This simplifies most callers as they longer have to split out a rect.
2023-12-20 09:29:28 +00:00
Peter Nelson 6e8c27b8e5
Change: Hide bevel for resizeable sparse layout windows. (#11572)
When clicked, the button is still highlighted to show that it is active.

The bevel is controlled with widget_data by RWV_SHOW_BEVEL or RWV_HIDE_BEVEL values.
2023-12-10 17:25:36 +00:00
Peter Nelson 4d9f335f36 Change: Add outline of sprite to sprite aligner. 2023-12-04 08:14:02 +00:00
Peter Nelson f7380a4d2d Change: Make NewGRF Sprite Aligner window resizeable. 2023-12-04 08:14:02 +00:00
Peter Nelson 0434c1b474 Feature: (-tte) Add zoom level buttons to sprite aligner.
This allows for offsets to be adjusted a different zoom level than currently in use, and offset adjustment and display is also more convenient.
2023-12-04 08:14:02 +00:00