Commit Graph

351 Commits

Author SHA1 Message Date
Rubidium
7805c1c189 Codechange: use std::string_view for ini_key 2025-05-01 23:24:43 +02:00
frosch
98481ecc01 Codechange: Replace strtol, strtoll, stroul and strtoull with ParseInteger. 2025-04-29 20:14:56 +02:00
Peter Nelson
7846f0f4ee
Fix a4dc7249ee: Changing language or interface scale could hang. (#14087)
A bit of hysteresis caused by OnResize calling ReInit calling OnResize calling ReInit calling OnResize calling ReInit ...
2025-04-24 00:29:54 +01:00
Peter Nelson
9ff2b4991f
Change: Add scrollbar to infrastructure window. (#14056)
Company infrastructure window will no longer overflow the screen when lots of rail and road types are present.

To further declutter the list, we now only show a value when the count for that item is non-zero.
2025-04-21 08:46:09 +01:00
frosch
cde350dc01 Codechange: Replace macros GENERAL_SPRITE_COLOUR and COMPANY_SPRITE_COLOUR with functions GetColourPalette and GetCompanyPalette. 2025-04-18 23:41:37 +02:00
Peter Nelson
5008568dfc
Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
frosch
cedc511324
Fix: Numbers were left-aligned for RTL languages in several windows. (#13959) 2025-04-04 11:48:50 +02:00
Peter Nelson
47d078c033 Codechange: Use EnumBitSet for RailTypes. 2025-03-25 20:15:48 +00:00
Peter Nelson
732109e444 Codechange: Use EnumBitSet for RoadTypes. 2025-03-25 20:15:48 +00:00
Peter Nelson
adb20f99ea
Fix: Autoreplace rail/road list only listed buildable types. (#13887)
Instead list all possible types which includes hidden types compatible with buildable types.
2025-03-25 08:22:30 +00:00
Peter Nelson
3503082f19 Codechange: Move template class implementation includes.
These are now placed at the bottom of the including files include list.
2025-03-21 12:53:40 +00:00
Peter Nelson
2909a14374 Codechange: Include table/strings.h in files that use StringIDs.
Be consistent with how and where the file is incldued.
2025-03-21 12:53:40 +00:00
Peter Nelson
3eb89f04b5
Codechange: Use EnumBitSet for QueryStringFlags. (#13792) 2025-03-10 18:59:35 +00:00
Rubidium
cfa31849be Fix: company livery window's instance variables were not set 2025-03-08 16:14:08 +01:00
Peter Nelson
72832894e4
Codechange: Drop SetToolTip for window caption. (#13708)
This is set by default so isn't needed.
2025-03-03 08:52:53 +00:00
Peter Nelson
712ed867b2
Codechange: Move to GetWidgetString for company windows. (#13704) 2025-03-02 21:45:17 +00:00
Peter Nelson
2aa99a70ff
Codechange: Use parameterised GetString() for company windows. (#13690) 2025-03-01 22:25:11 +00:00
Peter Nelson
63812a45bb
Codechange: Pass single rect to DrawString calls instead of separate parameters. (#13675) 2025-03-01 10:12:43 +00:00
Peter Nelson
e2c1b9f03e
Codechange: Use only raw strings in drop down lists. (#13667)
Strings with parameters are now pre-formatted, avoiding global parameters.

Helper functions still allow StringID.
2025-02-27 21:11:16 +00:00
Rubidium
0afae7c546 Codechange: explicitly initialise member variables of Windows 2025-02-23 14:53:42 +01:00
Rubidium
fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Jonathan G Rennison
d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Rubidium
1e24b41f22 Codechange: strongly type GroupID 2025-02-09 16:52:21 +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
6f8b9fc737 Codechange: remove unneeded casts 2025-02-02 19:45:17 +01:00
Peter Nelson
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. (#13436) 2025-02-01 23:09:18 +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
b60101853c Codechange: add and use SetString over directly accessing widget_data 2025-01-03 12:14:55 +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
Peter Nelson
74087e6a2e Codechange: Use _TOOLTIP suffix for other tooltip StringIDs. 2025-01-01 02:28:08 +00:00
Peter Nelson
ad26b1e8b1 Codechange: Use _TOOLTIP suffix for custom face tooltip StringIDs. 2025-01-01 02:28:08 +00:00
Peter Nelson
0446123194
Change: Show company finances column if it has any values in it. (#13112)
This solves finances not being show if the company inauguration date is in the future.

Current period is now always shown in the same position instead of moving for the first 2 years.
2024-11-24 11:59:30 +00:00
Kaiden Joy
7a698c7f1c Fix #12365: Company Window now displays proper inauguration year and period while in wallclock mode. 2024-08-13 20:13:51 +02: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
a9318cf653 Cleanup: remove UI for changing the password 2024-05-07 00:03:15 +02:00
Rubidium
9dc1fdc385 Cleanup: remove client side password checks when moving to a different company 2024-05-07 00:03:15 +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
e028c15555
Codechange: Use std::accumulate to get infrastructure total rail/road pieces. (#12442) 2024-04-20 10:22:19 +01:00
Peter Nelson
16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01:00
Peter Nelson
db56499c01 Codechange: Use std::array for company infrastructure arrays. 2024-04-18 22:13:55 +01:00
Rubidium
4f2412a272 Codechange: range based for loops instead of C-style for loops 2024-04-11 07:05:04 +02:00