Commit Graph
294 Commits
Author SHA1 Message Date
Peter NelsonandPeter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Rubidiumandrubidium42 ef87acc1ff Codechange: make STR_NULL the default for all widget construction functions 2025-01-03 23:25:27 +01:00
Rubidiumandrubidium42 e3a5f9b040 Codechange: replace SetDataTip(AWV_ with SetArrowWidgetTypeTip(AWV_ 2025-01-02 23:28:43 +01:00
Rubidiumandrubidium42 4bf36e3fa6 Codechange: replace SetDataTip(STR_ with SetStringTip(STR_ 2025-01-02 23:28:43 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub 55314513ce Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter NelsonandGitHub 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
Peter NelsonandGitHub de4e00c93f Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Rubidiumandrubidium42 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Loïc GuillouxandGitHub 64611a7d12 Fix #11975, 27a920c: Running AIs also occupy a slot (#11976) 2024-02-04 13:19:35 +01:00
Loïc GuillouxandGitHub 27a920c4a8 Change: Allow to configure AI slots above max_no_competitors (#11961) 2024-02-03 09:42:16 +01:00
Loïc GuillouxandGitHub a2f31c4e61 Change: Improve AIConfig window (#11949) 2024-02-02 14:34:49 +01:00
Patric StoutandGitHub fe035c306e Codechange: prevent out-of-bound read (even if the result is never used) (#11853) 2024-01-21 14:25:00 +00:00
Peter NelsonandPeter 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 NelsonandPeter 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 NelsonandPeter Nelson f60c14a682 Add: Website button for AI settings window. 2023-12-03 18:52:33 +00:00
Peter NelsonandGitHub 9a92e02fa7 Change: Add tooltips for text file buttons, and shorten Website / Readme buttons. (#11534) 2023-12-03 16:54:57 +00:00
Peter NelsonandGitHub 0b1429ce14 Fix: AI window did not update button disabled state when changing values. (#11527) 2023-12-01 12:52:33 +00:00
Peter NelsonandGitHub 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 NelsonandGitHub cdb4e98a15 Change: Use sparse padding for AI/GS settings windows. (#11466) 2023-11-16 20:02:07 +00:00
Peter NelsonandPeter 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 NelsonandGitHub 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
Rubidiumandrubidium42 c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Peter NelsonandPeter 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
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Peter NelsonandPeterN 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
Patric StoutandPatric 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
Rubidiumandrubidium42 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02:00
Patric StoutandGitHub 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 GuillouxandGitHub e4c511d403 Fix #10578: Allow to select any version of AI/GS from GUI (#10604) 2023-04-07 19:33:07 +02:00
glx22andLoïc Guilloux b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +01:00
glx22andLoïc Guilloux 78e3c93a25 Fix: caption for GS settings window opened from debug window 2023-02-05 19:27:25 +01:00
glx22andLoïc Guilloux cef9931e53 Cleanup: GS don't have "start_date" 2023-02-05 19:27:25 +01:00
AndyandGitHub 3b0b572ebf Change: Log AI/GS Squirrel crashes in white text for readability (#10375) 2023-01-20 22:42:57 +01:00
Jonathan G Rennisonandrubidium42 14c1266bbc Fix: Wrong type cast for selected AI/GS script info in AIListWindow
This resulted in technically undefined behaviour when listing GSs
2022-12-22 21:26:27 +01:00
Peter NelsonandPeterN 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN b6ed595176 Codechange: Prefer suggested widget padding. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 3ff05321dc Change: Use standard padding for AI Debug window. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Artin AlaviandGitHub 5d6cdf4385 Feature: Allow AI/GS to be fully modified in scenario editor (#10152) 2022-11-11 23:48:07 +01:00
Artin AlaviandGitHub cbac243216 Feature: [UI] Split AI/Game Script configuration windows and add them to world gen window (#10058) 2022-11-10 21:39:09 +01:00
Didac Perez PareraandGitHub 019dcb7b7b Change: Let AI developers edit non-editable AI/Game Script Parameters (#8895) 2022-11-08 18:23:34 +00:00
Rubidiumandrubidium42 d5aafaee15 Codechange: rename and move some strings to make them more consistent with the rest of the strings 2022-11-02 17:58:44 +01:00
Peter NelsonandPeterN edbf99ed17 Change: Use standard sizing for AI competitor limit buttons. 2022-10-11 08:36:59 +01:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
glx22andLoïc Guilloux 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
glx22andLoïc Guilloux 994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00