1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 00:42:45 +01:00
Commit Graph

485 Commits

Author SHA1 Message Date
Jonathan G Rennison
7dcc932d44 Fix: Drag drop line position when dragging NewGRF from file to active panel (#14316) 2025-06-05 14:09:51 -04:00
Peter Nelson
82f5af7ecd Codechange: Allow all widget types to have a WidgetID index. 2025-06-05 17:55:24 +01:00
Peter Nelson
4ab48f34f5 Fix 5664b1e2f6: Upgrade button in NewGRF window no longer worked. (#14315) 2025-05-31 08:20:55 +00: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
Peter Nelson
77d6f6c69f Codechange: Make ContentType::State an enum class. (#14279) 2025-05-19 17:11:28 +01:00
Peter Nelson
d37d4c18b5 Change: Remove Apply button from NewGRF config window when unneeded. (#14254)
When configuring NewGRFs outside of a game, the changes are always applied when the window is closed, even if the Apply button is not used.

The Apply button only needs appear during a game when changes are not automatically applied.
2025-05-13 01:22:23 +01:00
Peter Nelson
d9247fa1a0 Change: Remove extra close buttons from some windows. (#14124)
All windows have an X button to close it, so remove the redundant close buttons.
2025-05-12 14:54:44 +01:00
Peter Nelson
ac76212b80 Fix: Closing the Game Options window closes all textfile windows.
Record the parent window that opens a textfile window so only child windows are closed instead of all.
2025-05-04 19:36:46 +01:00
Rubidium
7805c1c189 Codechange: use std::string_view for ini_key 2025-05-01 23:24:43 +02:00
frosch
36ce1f890a Codechange: Remove c_str, if std::string_view is already accepted. 2025-04-30 19:33:56 +02:00
Rubidium
708e6a512d Codechange: replace char* with C++ style strings 2025-04-30 12:05:04 +02:00
Rubidium
ef71ce0a9d Codechange: return std::string_view for Textbuf::GetText() 2025-04-29 22:15:49 +02:00
frosch
cdafc50c94 Codechange: Replace atoi and atoll with ParseInteger. 2025-04-29 20:14:56 +02:00
Peter Nelson
b87ce9c845 Change: Draw info headers as shade of window colour instead of pixel colour. (#14123)
Use the normal or lightest colour gradient to pick a suitable colour, instead of an arbitrary pixel colour.

(Except for the NewGRF window's info panel, this happens to be the same colour.)
2025-04-26 22:38:24 +01:00
Peter Nelson
e3d2d68bd4 Change: Draw boolean toggle as a slider widget.
This improves usability as the slider position indicates the state instead of a red/green colour change.
2025-04-21 16:23:11 +01:00
frosch
354ad43edb Codechange: Remove unnecessary string constructions. (#14063) 2025-04-21 16:46:31 +02:00
Peter Nelson
5008568dfc Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
Peter Nelson
20d83677eb Codechange: Use unique_ptr to manage ContentInfo lifetime.
Removes manually managed new/delete.
2025-04-11 23:08:59 +01:00
Peter Nelson
5b9d171e63 Codechange: Use EnumBitSet for StringValidationSettings. (#13974) 2025-04-08 21:19:17 +01:00
stormcone
8d0ba5649a Fix 667d0137: NewGRF details view does not show the "No information available", if the NewGRF sets an empty description. (#13939) 2025-04-01 16:10:59 +02:00
frosch
5aa4ad5135 Codechange: Pass unformatted strings from GetStringPtr as std::string_view. (#13871) 2025-03-23 19:23:31 +01:00
frosch
84f785b06b Codechange: Pass GRF name as std::string to UpdateNewGRFScanStatus. (#13870) 2025-03-23 16:58:43 +01:00
frosch
667d013726 Codechange: Return name, description and URL as std::string from GRFConfig. (#13868) 2025-03-22 20:30:40 +01: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
0de7fd3c24 Codefix: check the result of dynamic_cast for nullptr 2025-03-09 19:35:14 +01:00
Peter Nelson
3fbd6f776c Codechange: Move to GetWidgetString for newgrf windows. 2025-03-03 21:19:44 +00:00
Peter Nelson
e0e845fc4d Fix #13681: Missing unused string parameter for NewGRF parameter string. (#13682) 2025-03-01 16:12:52 +00:00
Peter Nelson
57f0ed716e Codechange: Use parameterised GetString() for drawing NewGRF info. (#13674) 2025-02-28 21:05:12 +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
c540c2bcf7 Codechange: explicitly initialise member variables of Windows 2025-02-27 19:58:31 +01:00
Rubidium
5cee804f98 Codechange: remove ZeroedMemoryAllocator from NWidgetBase 2025-02-22 14:38:33 +01:00
Peter Nelson
2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +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
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
Peter Nelson
6f52a977a8 Codechange: Use EnumBitSet for GRFConfigFlags.
This is renamed from `GCF_Flag` didn't match convention.
2025-02-02 10:49:45 +00:00
Peter Nelson
5664b1e2f6 Codechange: Use std::vector for GRFConfig lists. (#10835)
This replaces the C-style custom managed linked-list and allows use of iterators etc.
2025-01-31 17:09:09 +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
Rubidium
4099acb946 Codechange: replace BSWAP32/BSWAP16 with std::byteswap 2025-01-28 19:22:12 +01:00
Peter Nelson
9b947a37b8 Codechange: Pass GRFConfig by reference where feasible. (#13388)
In places where a GRFConfig is passed by pointer and not checked for nullptr, use a reference instead.
2025-01-26 22:41:08 +00:00
Peter Nelson
f6ab2b69c6 Codechange: Define GRFConfigList alias and pass by reference. (#13358)
This adds the distinction between a single GRFConfig and a GRFConfig list, and simplifies how GRFConfig lists are passed to various functions.
2025-01-22 22:30:32 +00:00
Rubidium
4b2051a1c1 Codechange: use Textbuf::GetText() to access the buffer / hide Textbuf::buf 2025-01-19 23:01:35 +01:00
Peter Nelson
65665ccb78 Fix bb8a0c7641: Strip control codes before sorting NewGRF names. (#13034)
Now that SkipGarbage doesn't skip all multi-byte utf-8 characters, string control codes are not skipped either. This gave unintended sorting when NewGRF names start with colour codes.

Use StrMakeValid() before comparing. This has to make a copy of the string for each sort step, so there is likely a performance penalty.
2025-01-19 21:39:44 +00:00
Peter Nelson
2f0b52d5b3 Codechange: Use sorted vector for NewGRF parameter value names. (#13326)
This replaces use of a std::map per GRF-parameter.
2025-01-17 19:33:11 +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
9ac1bad480 Codechange: add and use GetString over directly accessing widget_data 2025-01-03 11:11:01 +01:00