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

1163 Commits

Author SHA1 Message Date
Peter Nelson
7b31f26611 Codechange: Pass ContentInfo by reference.
Many functions take a ContentInfo pointer, but do not check for nullptr.
Pass by reference instead to assure it is present.
2025-04-11 23:08:59 +01:00
Peter Nelson
936d78fefc Codefix: Avoid uppercase characters in variable names. (#13985) 2025-04-10 07:19:27 +01:00
Peter Nelson
6a3d17923b Codechange: Use range filter to simplify picking a random AI. (#13897) 2025-03-31 20:32:16 +01:00
Peter Nelson
ff08a22aa4 Codechange: Simplify AI/GameConfig::GetConfig. (#13900)
Reorganise these methods to reduce nesting and remove a raw pointer to a unique_ptr.
2025-03-26 21:53:05 +00:00
Peter Nelson
422ff9dbd8 Codechange: Use std::unique_ptr for ai/game config. 2025-03-26 10:54:11 +00:00
Peter Nelson
fb008436b8 Codechange: Use std::unique_ptr for script info/library instances. (#13892) 2025-03-25 21:07:02 +00:00
Peter Nelson
79ef4e98fe Codechange: Use std::swap() instead of Swap() (#13883) 2025-03-24 23:47:34 +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
3d95a7813f Codechange: Drop default widget strings for AI config window. 2025-03-04 08:23:28 +00:00
Rubidium
8d63aea929 Codechange: replace SetStringParameters with GetWidgetString for AI, airport and autoreplace windows 2025-03-02 11:04:15 +01:00
Peter Nelson
94783fe2ed Codechange: Use EnumBitSet for ScriptConfigFlags. (#13669) 2025-02-28 18:57:40 +00:00
Peter Nelson
ddb502d097 Codechange: Use parameterised GetString() for script-related windows. (#13671) 2025-02-27 23:53:04 +00:00
Rubidium
0afae7c546 Codechange: explicitly initialise member variables of Windows 2025-02-23 14:53:42 +01:00
SamuXarick
847fbe3348 Fix: [Script] Set DummyAI Api version to last available (#13610) 2025-02-22 12:58:29 +01:00
glx22
a577229e95 Revert d7bd67cda3: [Scripts] "_typeof" metamethod negatively affects old scripts 2025-02-19 19:21:50 +01:00
glx22
d7bd67cda3 Add: [Scripts] "_typeof" metamethod 2025-02-18 21:19:15 +01:00
Rubidium
fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium
ab8177ea77 Codechange: strongly type CompanyID 2025-02-16 14:02:18 +01:00
Rubidium
1ffc950e22 Codechange: use prefix operator++ for CompanyID iterations 2025-02-16 14:02:18 +01:00
Peter Nelson
2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Rubidium
77bf3084da Codefix f60b3d7f79: compilation failure using GCC-12 2025-02-09 22:51:02 +01:00
Patric Stout
f60b3d7f79 Codechange: [Script] rework how compat-scripts work and are loaded (#13504)
- compat_NNN.nut files now only defines what is needed to downgrade from API NNN + 1 to NNN.
- Automatically load all required compatibility files based on the API version of the script, starting with the latest.
2025-02-09 15:04:04 +00:00
Peter Nelson
28eb5e05c8 Codechange: Use EnumBitSet for NWidContainerFlags. 2025-02-06 19:43:35 +00:00
Peter Nelson
fe31538a27 Codechange: Use EnumBitSet for Scanner::Modes. (#13471) 2025-02-05 20:08:12 +00:00
Peter Nelson
d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Rubidium
ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidium
e3a5f9b040 Codechange: replace SetDataTip(AWV_ with SetArrowWidgetTypeTip(AWV_ 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
bacd3e83c6 Codechange: Use ScriptObjectRef to handle Event reference counting.
This removes manual reference counting.
2024-10-16 21:52:00 +01: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
c5ef47ee09 Codechange: [Script] Use std::unique_ptr for Company::ai_instance (#12544) 2024-04-20 16:58:46 +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
86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Rubidium
bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Loïc Guilloux
ef40c5e240 Fix #12225, 977aba7: [Script] Missing AI:ResetConfig support for running AI config (#12226) 2024-03-06 21:16:07 +01:00
Loïc Guilloux
845b894fd8 Remove: [Script] random_deviation from setting description table (#12221) 2024-03-05 12:41:04 +01:00
Loïc Guilloux
25d1238907 Fix #12133: [Script] Don't crash when emergency saving (#12138) 2024-02-20 18:55:18 +01:00
Loïc Guilloux
2d7ad9f717 Fix: [Script] Only show debug script window at the end of savegame loading (#12135) 2024-02-20 16:08:26 +00:00
Rubidium
a4d4301a0c Codechange: We are heading to 15 2024-02-18 21:48:54 +01:00
Loïc Guilloux
8d9fa0ea89 Change: [Script] Use company randomizer when adding random deviation (#12065) 2024-02-11 18:58:41 +00:00
Loïc Guilloux
977aba73be Change: Store running AI config inside Company (#12003) 2024-02-09 22:55:49 +01:00
Loïc Guilloux
64611a7d12 Fix #11975, 27a920c: Running AIs also occupy a slot (#11976) 2024-02-04 13:19:35 +01:00
Loïc Guilloux
27a920c4a8 Change: Allow to configure AI slots above max_no_competitors (#11961) 2024-02-03 09:42:16 +01:00
Loïc Guilloux
a2f31c4e61 Change: Improve AIConfig window (#11949) 2024-02-02 14:34:49 +01:00
Loïc Guilloux
ab1407fc43 Fix: [Script] Apply random deviation only at script start (#11944) 2024-02-01 10:48:40 +01:00
Patric Stout
e28edf6945 Remove: [Script] CONFIG_RANDOM from AddSetting flags (#11942)
It had a very weird interaction, and was only ever used by a single
AI.
2024-01-31 22:24:36 +00:00
Patric Stout
fe035c306e Codechange: prevent out-of-bound read (even if the result is never used) (#11853) 2024-01-21 14:25:00 +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