Commit Graph
562 Commits
Author SHA1 Message Date
Peter NelsonandPeter Nelson ba2b14b075 Change: [UI] Use proper matrix padding for server list test.
Text was only positioned correctly at 1x scale due to old pixel-based positioning method.
2024-07-21 10:07:50 +01:00
Peter NelsonandPeter Nelson d85f4b3ebf Change: [UI] Use interface scaled sizes for server list.
Avoid hardcoded values and use WidgetDimensions to set icon positions.

This fits better with non-power-of-2 interface scale.
2024-07-21 10:07:50 +01:00
Peter NelsonandGitHub 4b6e3f86c2 Cleanup: Remove write-only flag_offset member from server list. (#12872)
A remnant of language flags, removed from the server list long ago.
2024-07-21 08:18:09 +01:00
Rubidiumandrubidium42 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
Peter NelsonandGitHub 55314513ce Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter NelsonandGitHub 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
Peter NelsonandGitHub 0f230244fe Codechange: [UI] Remove redundant SetMinimalSize for WWT_EDITBOX widgets. (#12733) 2024-05-30 08:34:26 +01:00
Rubidiumandrubidium42 fea9ffa808 Codechange: also allow removing clients from the company allow lists 2024-05-22 22:20:10 +02:00
Peter NelsonandGitHub 5442b0dd2d Fix: Make progress bars obey language direction. (#12704)
With RTL languages, progress bars should start from the right.
2024-05-21 00:40:08 +01:00
Rubidiumandrubidium42 ed888c617b Codechange: just use ::Post over ::SendNet for creating new companies 2024-05-09 21:51:26 +02:00
Rubidiumandrubidium42 849d1fa1b3 Cleanup: remove UI for asking user for company password 2024-05-07 00:03:15 +02:00
Rubidiumandrubidium42 a9318cf653 Cleanup: remove UI for changing the password 2024-05-07 00:03:15 +02:00
Rubidiumandrubidium42 71fc907584 Change: remove company passwords over client allow lists 2024-05-07 00:03:15 +02:00
Rubidiumandrubidium42 4f3db8eeaf Feature: authorize specific clients to join network company without password 2024-05-07 00:03:15 +02:00
Peter NelsonandGitHub 84ebae0bf5 Codechange: Tweak layout of network client list. (#12624)
Use PIP spacing instead of spacers and more used of standard WidgetDimensions.
2024-05-05 14:57:17 +01:00
Peter NelsonandPeter 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 NelsonandGitHub f44d8fa2e4 Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter NelsonandGitHub 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 NelsonandPeter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01:00
Peter NelsonandPeter Nelson d43ff8dc49 Change: Ability to set aspect ratio of a widget.
This allows setting the shape of a widget without dealing with absolute pixel sizes.
2024-04-19 22:11:16 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub 74e09abf76 Codechange: Use dynamic_cast instead of C-cast after FindWindowById. (#12448)
dynamic_cast was used in most places, but not all.
2024-04-08 13:26:19 +01:00
Rubidiumandrubidium42 c544a2be0a Fix: do not use lengthof() for non C-style arrays 2024-04-06 07:21:31 +02:00
Peter NelsonandPeter 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 NelsonandPeter Nelson 56cac21086 Codechange: Use functions to create common drop down list items. 2024-04-01 22:33:16 +01:00
Peter NelsonandGitHub 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
Rubidiumandrubidium42 5706801ea7 Feature: authenticate to the server without sending the password
Either using password-authentication key exchange or via authorized keys
2024-03-17 19:09:22 +01:00
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter NelsonandGitHub 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 NelsonandPeter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter Nelson ae3390fe48 Codechange: Add ColourShade enum. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter 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
froschandfrosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Patric StoutandGitHub 3e6ed6f44a Fix #9697: don't extend the Online Players window too wide on opening (#11936) 2024-01-31 19:03:07 +01:00
Jonathan G RennisonandGitHub 1df7b21ee3 Fix #11889: ConstructWindow not called from SurveyResultTextfileWindow constructor (#11903) 2024-01-27 19:44:10 +00:00
Patric StoutandGitHub 89520f5665 Add: show in multiplayer the amount of hours a game has been unpaused (#11886) 2024-01-27 12:35:09 +01:00
Rubidiumandrubidium42 2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
Peter NelsonandPeter 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
Rubidiumandrubidium42 e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter NelsonandPeter Nelson 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 2023-12-31 15:33:56 +00:00
Peter NelsonandPeter Nelson 9a3934ae23 Codechange: Use vector/unique_ptr inside widget containers.
This replaces a C-style double-linked-list which required all widgets
to have next/prev pointers, and removes the need for manual pointer management.
2023-12-31 15:33:56 +00:00
Peter NelsonandPeter 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 NelsonandPeter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
2023-12-29 18:45:43 +00:00
Peter NelsonandGitHub feb94d233d Codechange: Remove deferred nested_array initialization path. (#11640)
Having two ways (`FillNestedArray` and `SetupSmallestSize`) to initialize
`Window::nested_array` introduces confusion.

Instead, make `FillNestedArray` the canonical way, always call it, and remove
init_array from `SetupSmallestSize`.
2023-12-29 14:27:04 +00:00
Peter NelsonandGitHub 33ff64ef74 Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 2023-12-28 21:34:08 +00:00
Peter NelsonandGitHub 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 NelsonandGitHub 09251d993c Change: Use sparse padding for network server list. (#11571) 2023-12-10 14:48:58 +00:00
Peter NelsonandGitHub d6060a4d47 Change: Use sparse padding for start network server window. (#11569) 2023-12-09 23:35:46 +00:00
Peter NelsonandGitHub a759d35f26 Fix #11352: Draw all network server info as multiline strings. (#11567)
This also allows the 'header' (which is not actually a widget) to grow
as necessary to fit the server name.
2023-12-09 20:43:36 +00:00
Peter NelsonandPeter Nelson dcf730f1f6 Codechange: Optionally allow passing state to GUIList sorter function.
GUIList sorter functions can currently only use global state, which makes per-window-instance sorting difficult.
2023-12-04 08:24:39 +00:00