Commit Graph

1131 Commits

Author SHA1 Message Date
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
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 f60c14a682 Add: Website button for AI 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 0b1429ce14
Fix: AI window did not update button disabled state when changing values. (#11527) 2023-12-01 12:52:33 +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
Peter Nelson 873f93cab1
Fix: AI config window should not have an ini_key. (#11423)
This was missed by the workflow script that enforces this constraint.
2023-11-02 21:28:24 +00:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02: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
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 07860e67e2 Codechange: use fmt::format_to to format the help message 2023-05-20 16:50:03 +02: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
Rubidium 12085d088c Cleanup: remove obsolete string_compare_type 2023-05-09 23:14:48 +02:00
Rubidium bc389a86c9 Codechange: use std::string as std::map key, instead of stredup string 2023-05-09 23:14:48 +02:00
Rubidium 72082aa7d3 Codechange: use std::string for getting a script's name 2023-05-09 23:14:48 +02:00
Rubidium 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02:00
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Patric Stout ed83c4b0da
Change: replace per-AI "start_date" with a global "competitors_interval" (#10653)
The per-AI "start_date" is a lot of custom code, and was rarely
used in the way it was meant.

While at it, also ported this part over to the new timer system.
2023-04-16 20:14:22 +02:00
Loïc Guilloux e4c511d403
Fix #10578: Allow to select any version of AI/GS from GUI (#10604) 2023-04-07 19:33:07 +02:00
dP c73b88ddca
Fix: Don't send unused tile field over the network (#10507) 2023-02-24 22:50:11 +01:00