Commit Graph

1675 Commits (36e1b32ccf47586eb3cc6eae90090548ca9d10f5)

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(...)`.
7 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.
8 months ago
Peter Nelson ef385499c7
Codechange: Remove ineffective NWidgetParts. (#11443) 8 months ago
Michael Lutz 071fdab236 Codechange: Replicate cursor screen backup to chat message display, removing explicit memory management.
Incidentally, this makes Blitter::GetBytesPerPixel unneeed.
8 months ago
Peter Nelson 18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
8 months ago
Rubidium a849b4e175 Fix: allow same length server password in the UI 8 months ago
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 8 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.
8 months ago
Peter Nelson 8a49c0eb2c Change: Use modalpopup spacing for network relay and survey windows. 8 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.
8 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.
8 months ago
Rubidium 37f84b7372 Codechange: replace x.size() != 0 with !x.empty() 8 months ago
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 8 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 8 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.
8 months ago
Peter Nelson e1c83869ed
Fix: Scale minimum width for server name by interface scale. (#11381) 9 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.
9 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.
9 months ago
Peter Nelson 49dae08a3b Codechange: Add missing override specifiers. 9 months ago
frosch 5733145c59 Cleanup: Remove unneeded parameters. 10 months ago
frosch b5885295f0 Codechange: Use parameters, which should be used. 10 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 10 months ago
Rubidium 7ef22af2bb Codechange: introduce and use function to raise and dirty a set of widgets when they are lowered 10 months ago
Patric Stout 37e2f99c09
Change: store crash logs in JSON format (#11232) 10 months ago
Patric Stout ba67f39db6
Codechange: vendor the nlohmann-json library (#11290) 10 months ago
Tyler Trahan 701a61c9af Codechange: Delete date_type.h 10 months ago
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 10 months ago
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 10 months 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.
10 months ago
Patric Stout 5f9b8aaa95
Codechange: [Script] use nlohmann for Squirrel <-> JSON conversion (#11251) 10 months 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.
10 months 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.
10 months ago
Patric Stout ecb4bb5161
Change: for surveys capture more information about the OpenTTD version (#11244) 10 months ago
Patric Stout a3d631ffed
Change: make nlohmann a mandatory library to build OpenTTD (#11235) 10 months ago
Patric Stout abc060525d
Add: calendar date for Survey results
This means no heuristics is possible on around which date people
play the game.
10 months ago
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 11 months ago
Patric Stout 01f55eb734
Codechange: introduce week/quarter triggers for TimerGameCalendar (#11189)
This simplifies code that triggers on these periods.
11 months ago
Tyler Trahan 93069066f9
Codechange: Use auto type when sorting dates (#11175) 11 months 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
12 months 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
Tyler Trahan ba3de0383a
Codechange: Pass more std::string to StringFilter::AddLine() (#10743) 1 year ago
Rubidium c829930440 Codechange: replace strnatcmp with C++ string capable version 1 year ago
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 1 year ago
Patric Stout 36a0818bc5
Remove: buying/selling/owning company shares (#10709) 1 year ago
Rubidium b221fa3c5a Codechange: use fmt::format_to instead of seprintf to create the search URL 1 year ago
Rubidium 3105d0b09e Codechange: replace text-buf printf with fmt::format 1 year ago
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 1 year ago
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 1 year ago
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 1 year ago
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 1 year ago
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 1 year ago
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
1 year ago
rubidium42 730687080a
Fix: Update some network documentation to match the new command system (#10657) 1 year ago
Peter Nelson e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
1 year ago
Peter Nelson 47e12a8790 Codechange: Check that CompanyMask fits into 16 bits during compilation. 1 year ago
Peter Nelson b6609d1833 Fix: Network server highlight invisible with RTL layout. 1 year ago
Zachary e17c82e32b Add: maximum number of companies allowed to the client list 1 year ago
dP c73b88ddca
Fix: Don't send unused tile field over the network (#10507) 1 year ago
Patric Stout fdfcb09aa3 Fix #10131: actually cancel downloads when pressing cancel 1 year ago
Patric Stout dea2dea881 Fix: reset content download progress to zero if falling back to TCP
Otherwise this chain of events can happen:
- You already have a (partial) file downloaded
- You start the download, and HTTP fails
- This resets the download progress to the current size of the file
- The TCP download starts at a very large value (UINT32_MAX - filesize)

It now resets to 0% done when any negative value is being given.
As added bonus, we no longer have to query how much was already
downloaded.
1 year ago
Patric Stout 1c17556f96 Codechange: replace instance of char * with std::string 1 year ago
Patric Stout 0722bb3bf4
Change: try to detect the CA file/path for CURL (#10481)
The default is given compile-time, not run-time. So libcurl is
of no use to us.

Current list is kindly borrowed from
https://go.dev/src/crypto/x509/root_linux.go
1 year ago