Commit Graph

276 Commits

Author SHA1 Message Date
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
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 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02: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
glx22 b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +01:00
glx22 78e3c93a25 Fix: caption for GS settings window opened from debug window 2023-02-05 19:27:25 +01:00
glx22 cef9931e53 Cleanup: GS don't have "start_date" 2023-02-05 19:27:25 +01:00
Andy 3b0b572ebf
Change: Log AI/GS Squirrel crashes in white text for readability (#10375) 2023-01-20 22:42:57 +01:00
Jonathan G Rennison 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 Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson b6ed595176 Codechange: Prefer suggested widget padding. 2022-11-12 18:28:39 +00:00
Peter Nelson 3ff05321dc Change: Use standard padding for AI Debug window. 2022-11-12 18:28:39 +00:00
Peter Nelson 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 Alavi 5d6cdf4385
Feature: Allow AI/GS to be fully modified in scenario editor (#10152) 2022-11-11 23:48:07 +01:00
Artin Alavi 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 Parera 019dcb7b7b
Change: Let AI developers edit non-editable AI/Game Script Parameters (#8895) 2022-11-08 18:23:34 +00:00
Rubidium 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 Nelson 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
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
glx22 994bf19aef Fix f6d5c01: Delay deletion when closing windows 2021-05-29 21:08:25 +02:00
Peter Nelson 2a0365b3d9 Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
Line height defaults to the resize height of the relevant widget, which is
set in all cases. Therefore it is not necessary to specify this value every time.

Additionally fixes scrolled padding for the framerate window.
2021-04-21 23:12:10 +02:00
PeterN 195cf31cb9
Fix: Inconsistent button sizing on AI/GS setting window depending on scale settings. (#9044) 2021-04-17 19:20:22 +01:00
Tyler Trahan de891238d6
Change: Recolour graph windows to brown (#8700) 2021-03-11 15:30:29 +01:00
glx22 07385c3662 Fix: Use the same safety checks as 'stop_ai' for 'reload_ai' 2021-01-22 22:19:55 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
SamuXarick dc5b8020cc
Fix #6452: Reset only editable and visible settings from GUI (#7890)
Also enables the Reset button while in-game for AI configs.
2020-12-27 15:05:47 +01:00
Patric Stout 8fa2a67f6b Fix f66baa44: for-loop is no longer increasing "i"
During conversion it was overlooked that the for-loop used to do
this. Oops.
2020-12-26 13:32:25 +00:00
Patric Stout e6e91a345c
Fix f66baa44: index was off by one (#8433)
i++ in the 3rd part of a for() is post, not pre. Oops.
2020-12-25 19:57:13 +01:00
Patric Stout f66baa444f
Codechange: use C++11 constructs for for-each loops (#8432) 2020-12-25 19:38:18 +01:00
Quipyowert2 4552b17691 Codechange: Avoid copying function parameters by using const references 2020-02-17 09:15:28 +01:00
Samu 3089c625e4 Fix #7088: close AI/GS textfile window when their data are invalid 2020-02-06 20:58:11 +00:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
2019-04-09 22:45:15 +02:00
glx22 a1e492d0d8
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465) 2019-04-05 15:11:52 +02:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00