Commit Graph

1697 Commits (8fb26612c0dadfa28fd8ee33cb2ec3d34ffa5d0a)

Author SHA1 Message Date
Jonathan G Rennison 51ef416b49 Fix: libcurl HTTP thread race at uninit preventing thread exit 9 months ago
Patric Stout aef49e9933
Fix: race-conditions in GUI updates when downloading HTTP files (#11639) 9 months ago
Jonathan G Rennison 502a52edd5
Fix: Spurious cancellations of HTTP content downloads (#11668) 9 months ago
Peter Nelson 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 9 months ago
Peter Nelson 9a3934ae23 Codechange: Use vector/unique_ptr inside widget containers.
This replaces a C-style double-linked-list which required all widgets
to have next/prev pointers, and removes the need for manual pointer management.
9 months ago
Charles Pigott 1e60734660
Fix: Compilation with DEBUG_DUMP_COMMANDS enabled (#11607) 9 months ago
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.
9 months ago
Peter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
9 months ago
Peter Nelson feb94d233d
Codechange: Remove deferred nested_array initialization path. (#11640)
Having two ways (`FillNestedArray` and `SetupSmallestSize`) to initialize
`Window::nested_array` introduces confusion.

Instead, make `FillNestedArray` the canonical way, always call it, and remove
init_array from `SetupSmallestSize`.
9 months ago
Patric Stout 11ba951250
Fix: race-condition when creating new HTTP requests from different threads (#11638) 9 months ago
Peter Nelson 33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 9 months ago
Rubidium 2072e532f7 Codechange: replace NULL with nullptr 9 months ago
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.
10 months ago
Peter Nelson 09251d993c
Change: Use sparse padding for network server list. (#11571) 10 months ago
Peter Nelson d6060a4d47
Change: Use sparse padding for start network server window. (#11569) 10 months ago
Peter Nelson a759d35f26
Fix #11352: Draw all network server info as multiline strings. (#11567)
This also allows the 'header' (which is not actually a widget) to grow
as necessary to fit the server name.
10 months ago
Peter Nelson dcf730f1f6 Codechange: Optionally allow passing state to GUIList sorter function.
GUIList sorter functions can currently only use global state, which makes per-window-instance sorting difficult.
10 months ago
Peter Nelson 9122b4eb47
Codechange: SetMinimalTextLines(1, 0) is implied for widgets with text. (#11536) 10 months ago
Peter Nelson cc528bd8fc Change: Adjust layout of Content and NewGRF Website buttons for consistency. 10 months ago
Peter Nelson 9a92e02fa7
Change: Add tooltips for text file buttons, and shorten Website / Readme buttons. (#11534) 10 months ago
rubidium42 27082f9efa Codechange: pass std::string references to OpenBrowser 10 months ago
Peter Nelson f268c90bd3
Change: Use sparse padding for content download window. (#11501) 10 months ago
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(...)`.
10 months ago
Peter Nelson ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
11 months ago
Peter Nelson ef385499c7
Codechange: Remove ineffective NWidgetParts. (#11443) 11 months ago
Michael Lutz 071fdab236 Codechange: Replicate cursor screen backup to chat message display, removing explicit memory management.
Incidentally, this makes Blitter::GetBytesPerPixel unneeed.
11 months ago
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
11 months ago
Rubidium a849b4e175 Fix: allow same length server password in the UI 11 months ago
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 11 months ago
Peter Nelson bb50cbb772
Codechange: Assign/StoreSizePosition x/y can be negative. (#11416)
AssignSizePosition is used with negative values when an NWidgetMatrix is
scrolled, but they were passed as unsigned and then stored as signed.

Widget pos_x/pos_y were already made signed.
11 months ago
Peter Nelson 8a49c0eb2c Change: Use modalpopup spacing for network relay and survey windows. 11 months ago
Peter Nelson 59a2abd298 Codechange: Use unified NWidgetContainer methods instead of duplicating.
Most NWidgetContainer derivatives implemented Draw() and GetWidgetFromPos()
the same way. Move this these to NWidgetContainer itself to avoid repeating.
11 months ago
Peter Nelson 81ecbaaa33 Codechange: Hide multiplayer headers by setting width to zero.
Zero-width is how widgets are hidden elsewhere.
This removes the need for an extra array to lookup if a header is hidden.
11 months ago
Rubidium 37f84b7372 Codechange: replace x.size() != 0 with !x.empty() 12 months ago
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 12 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 12 months ago
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.
12 months ago
Peter Nelson e1c83869ed
Fix: Scale minimum width for server name by interface scale. (#11381) 12 months ago
Peter Nelson bdcf6b6acd Fix: Treat closing network relay window as a choice of "No".
Issue ConnectFailure when closing the window if the relay request is
considered unhandled.
12 months ago
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.
12 months ago
Peter Nelson 49dae08a3b Codechange: Add missing override specifiers. 1 year ago
frosch 5733145c59 Cleanup: Remove unneeded parameters. 1 year ago
frosch b5885295f0 Codechange: Use parameters, which should be used. 1 year ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 1 year ago
Rubidium 7ef22af2bb Codechange: introduce and use function to raise and dirty a set of widgets when they are lowered 1 year ago
Patric Stout 37e2f99c09
Change: store crash logs in JSON format (#11232) 1 year ago
Patric Stout ba67f39db6
Codechange: vendor the nlohmann-json library (#11290) 1 year ago
Tyler Trahan 701a61c9af Codechange: Delete date_type.h 1 year ago
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 1 year ago
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 1 year ago
PeterN afc1ea8135
Codechange: Using alias and std::array for company expense storage. (#11273)
This simplifies passing yearly expenses to functions and use of std algorithms.
1 year ago
Patric Stout 5f9b8aaa95
Codechange: [Script] use nlohmann for Squirrel <-> JSON conversion (#11251) 1 year ago
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.
1 year ago
Bouke Haarsma 7e54418022
Codechange: workaround CMake/Xcode duplicate file name issue (#11186)
Having a library with files with the same name isn't supported in CMake's Xcode project file generation: https://gitlab.kitware.com/cmake/cmake/-/issues/20501. One of the files is renamed to work around this bug.
1 year ago
Patric Stout ecb4bb5161
Change: for surveys capture more information about the OpenTTD version (#11244) 1 year ago
Patric Stout a3d631ffed
Change: make nlohmann a mandatory library to build OpenTTD (#11235) 1 year ago
Patric Stout abc060525d
Add: calendar date for Survey results
This means no heuristics is possible on around which date people
play the game.
1 year ago
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 1 year ago
Patric Stout 01f55eb734
Codechange: introduce week/quarter triggers for TimerGameCalendar (#11189)
This simplifies code that triggers on these periods.
1 year ago
Tyler Trahan 93069066f9
Codechange: Use auto type when sorting dates (#11175) 1 year ago
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
1 year ago
Rubidium af9b9327af Codechange: do not keep local variable for temporary string parameters 1 year ago
Rubidium 0ea3e338ab Codechange: replace buffer+strecpy with std::string 1 year ago
Rubidium f333372dd1 Codechange: let IConsoleCmdExec accept std::string 1 year ago
Jonathan G Rennison 55c07eed59
Change: Add separate setting for server sent commands per frame limit (#11023)
Set a higher default value for this setting.
Use the higher of this and existing commands per frame limit
setting for server-originating commands, e.g. GS.

This is to support the GSAsyncMode class.
This also avoids undue throttling when more than one
script is in operation (e.g. AIs).
1 year ago
Rubidium 700241410b Remove: support for not having getifaddrs 1 year ago
Jonathan G Rennison 4f6d75f97d Fix #11016: Defer deletion of client and server game socket handlers
This fixes various use after free scenarios in error handling paths
1 year ago
Jonathan G Rennison 19ae88fb63 Fix: Error logging in game and admin server HandlePacket
Don't invent a packet type in the log message if we can't/don't
read a packet type at all.
Fix packet type not being logged when appropriate.
1 year ago
Rubidium 836541b41c Codechange: use SetDParam and CopyOutDParam for tooltips 1 year ago
Owen Rudge 1a3d1bca59 Remove: OS/2 port 1 year ago
Rubidium d4c2043294 Codechange: remove a number of unneeded c_str() calls 1 year ago
Rubidium 13cdf5fffa Codechange: use std::filesystem::path for the language file's path 1 year ago
Rubidium a47de4b2ab Cleanup: remove DRAW_STRING_BUFFER constant 1 year ago
Rubidium 1fa432ca92 Codechange: replace C-style string building with C++-style building 1 year ago
Rubidium 55dfca1936 Codechange: replace seprintf with C++ style formatting 1 year ago
Rubidium c158089eff Codechange: use C++ style methods to combine a Utf8Encoded character and a formatted string 1 year ago
Patric Stout 21adfa7567
Fix: track "memory installed" for surveys less precisely (#10910)
It turns out, for Windows and Linux having the exact memory allows
for easy tracing of an individual. That is exactly against the idea
of the survey. And honestly, we don't need this precision.
1 year ago
Rubidium d9f8a4c380 Codechange: use std::string GetString variant 1 year ago
Rubidium f4b0ac2bd4 Codechange: use std::string for formatting settings 1 year ago
axet 60540f7df6 Change: Allow dedicated server to use threaded saves. (#10787)
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
1 year ago
Rubidium c518293135 Codechange: replace printf with fmt::print 1 year ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Rubidium acec34a0fe Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex 1 year ago
Rubidium d9a04ba446 Codechange: make the MD5 hash/digest/checksum variables a std::array 1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 72018badff Codechange: Swap SocketList map key/value around.
This map is used store socket and address together, and, other than
checking that the address does not already have a socket, the data layout
does not seem particularly important.

However, as address is the key, technically it should not be modified,
and address may self-modify itself during comparisons.
1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 1 year ago
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.
1 year ago
Patric Stout 8493719cf4
Fix: padding miscalculated for the network-relay and bootstrap-question GUI (#10827) 1 year ago
Rubidium a372c59483 Codechange: replace C-style (stredup) chat completion with std::string_view 1 year ago
Peter Nelson 941dbadf9e Codechange: Add and use GetScrolledItemFromWidget to get a list item.
This function returns an iterator, either to the selected item or the
container's end.

This makes handling the result more robust as indices are not used.
1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Peter Nelson d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
1 year ago
Rubidium 877349c13d Codechange: use std::string for text file name resolution 1 year ago
Peter Nelson 61407840c6 Codechange: Remove STR_BLACK_RAW_STRING. 1 year ago
Peter Nelson 0880616851 Codechange: Remove various STRING strings. 1 year ago
Rubidium 3901ef9760 Codechange: use std::string for the GRF filenames 1 year ago
Rubidium a312a6c1b2 Codechange: make md5sumToString std::string compatible 1 year ago
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 1 year ago