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
Rubidium
bab5a8a787
Codechange: use std::source_location over __FILE__ and __LINE__ for Backup
2024-03-10 10:14:20 +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
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
4e26e33805
Change: Improve ScriptSettings windows ( #11958 )
2024-02-02 18:08:05 +00: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
Loïc Guilloux
bf4b669628
Fix: [Script] Improve ScriptText validation ( #11721 )
...
The validation is now done in two steps:
- First we get the list of parameters in the same order they used to be in encoded string
- Then we validate the parameter types like FormatString would use them while encoding the string
2024-01-18 18:06:30 +01: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
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
0ca4b4e146
Change: Allow opening multiple script debug windows by holding Ctrl.
2023-12-20 20:39:07 +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
2272e8fe0e
Add: Website button for Game Script settings window.
2023-12-03 18:52:33 +00:00
Peter Nelson
9a92e02fa7
Change: Add tooltips for text file buttons, and shorten Website / Readme buttons. ( #11534 )
2023-12-03 16:54:57 +00:00
Peter Nelson
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. ( #11481 )
...
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson
cdb4e98a15
Change: Use sparse padding for AI/GS settings windows. ( #11466 )
2023-11-16 20:02:07 +00:00
Peter Nelson
18fb8e153f
Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
...
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +02:00
Peter Nelson
fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. ( #11384 )
...
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
2023-10-20 18:40:48 +01:00
Peter Nelson
f379b31e28
Add: data parameter in Window::Close method.
...
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
2023-09-25 21:27:45 +01:00
frosch
f40816503f
Codechange: Add enum items for dynmically created setting dropdowns.
2023-09-20 22:35:32 +02:00
frosch
b5885295f0
Codechange: Use parameters, which should be used.
2023-09-19 22:49:59 +02:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Peter Nelson
e8015e497d
Codechange: Use begin/end of nwidget parts of begin/length.
...
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.
And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
PeterN
d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. ( #11063 )
...
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.
Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.
This also means that strings no longer need to be formatted on every draw.
2023-06-23 08:30:13 +00:00
Rubidium
7c37dcb8e3
Fix: do not use {STRING} when {STRING1} or {STRING2} is needed
2023-06-14 09:44:06 +02:00
Rubidium
6d597879d0
Codechange: let ReadLine return a string instead of passing a buffer
2023-06-09 19:58:29 +02:00
Rubidium
13cdf5fffa
Codechange: use std::filesystem::path for the language file's path
2023-06-08 23:20:28 +02:00
Peter Nelson
2511649938
Codechange: Use window parent association for dropdowns.
...
This replaces the separate window class and number properties, and
allows the window system to close dropdowns automatically.
2023-06-03 14:17:05 +01:00
Rubidium
802d6cb509
Fix: memory leak when parsing (strgen) commands by moving to C++ containers
2023-06-02 11:57:23 +02:00
Rubidium
4f94655cc2
Codechange: use vector/unorder_map over custom implementation
2023-06-02 11:57:23 +02:00
Rubidium
234a143ee5
Codechange: use std::string for LangString over C-style strings
2023-06-02 11:57:23 +02:00
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
2023-05-20 16:53:10 +02:00
Rubidium
07860e67e2
Codechange: use fmt::format_to to format the help message
2023-05-20 16:50:03 +02:00
Peter Nelson
83f2ad500e
Codechange: stdarg.h include not needed as cstdarg is included.
2023-05-17 10:14:41 +01:00
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
2023-05-17 10:14:41 +01:00
Patric Stout
7634553d22
Feature: opt-in survey when exiting a game
...
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.
When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU
All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
Rubidium
62fda0f505
Codechange: remove manual allocation/free for SQ_instance
2023-05-14 22:54:10 +02:00
Rubidium
d9e93edc8b
Codechange: replace 'const char *' script API parameters with std::string
2023-05-14 22:54:10 +02:00
Rubidium
ab51175db2
Codechange: use std::string for script config
2023-05-14 22:54:10 +02:00
Rubidium
552d2f71a2
Codechange: use std::string for script library category
2023-05-14 22:54:10 +02:00
Rubidium
9f2fc860ad
Codechange: use std::optional<std::string> for changing the script over char *
2023-05-14 22:54:10 +02:00
Rubidium
0fd9eb0faa
Codechange: use std::string for script info/library finding
2023-05-14 22:54:10 +02:00
Rubidium
9b0123ab66
Codechange: use std::string for script API versions
2023-05-14 22:54:10 +02:00