Commit graph

4659 commits

Author SHA1 Message Date
Edgar 8a3d8fc53f
fix time score info on server detail 2023-05-22 13:53:23 +02:00
Robert Müller ed554368ec Remove unused sv_sql_bindaddr config variable
Closes #6456.
2023-05-19 21:02:39 +02:00
bors[bot] 2d5321d8b7
Merge #6615
6615: Fix logging (fixes #6611) r=Robyt3 a=def-

`@heinrich5991` Was the atomic important? Could we have a lock instead if so?

Seems a bit annoying since atomic can't have a shared_ptr inside

![Screenshot 2023-05-18 at 18 02 32](https://github.com/ddnet/ddnet/assets/2335377/2f8bcc57-2301-4a65-ada2-0e51f2b8c200)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-05-18 20:43:30 +00:00
Dennis Felsing bf1954b389 Fix logging (fixes #6611)
@heinrich5991 Was the atomic important? Could we have a lock instead if so?

Seems a bit annoying since atomic can't have a shared_ptr inside
2023-05-18 21:54:30 +02:00
Robert Müller 15f839960a Port friends list UI from 0.7
Separate friends list into three groups, which can be expanded and collapsed: online players, online clanmates and offline friends.

Friends with the same name/clan are no longer grouped together. Instead, each individual player that is online and has name/clan matching a friend is shown in either the online players or online clanmates group. Friends for which no matching players are found are shown in the offline group.

Friends in the friend list can no longer be selected. Instead, left-clicking a friend selects the server that the friend is on. Double-clicking a friend joins the server that they are playing on.

Render small X button in top-right corner of every friend list entry to remove the respective friend instead of using one button that removes the selected friend.

Change "Add Friend" button to "Add Clan" when only clan is entered.

Remove excess empty space from layout.

Closes #6326.
2023-05-18 16:46:26 +02:00
bors[bot] 6525e9e5dd
Merge #6604
6604: Clean up CServerLogger (fixes #6598) r=edg-l a=def-

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2023-05-18 11:46:59 +00:00
Dennis Felsing caa76249d8 Clean up CServerLogger (fixes #6598) 2023-05-17 01:04:06 +02:00
bors[bot] 2901c19bed
Merge #6602
6602: Revert "Delay disconnecting until after render call" r=def- a=Robyt3

This reverts commit 5c90fd2b83.

Delaying the disconnecting causes issues when the client automatically disconnects immediately before connecting to another server or starting demo playback.

It's not necessary to delay the disconnecting to deal with #6387, as #6589 is already enough. It's easier to revert this instead of rewriting the client so connecting and starting demo playback are also delayed.

Closes #6595.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-16 22:43:29 +00:00
Robert Müller 5ecd025d1d Revert "Delay disconnecting until after render call"
This reverts commit 5c90fd2b83.

Delaying the disconnecting causes issues when the client automatically disconnects immediately before connecting to another server or starting demo playback.

It's not necessary to delay the disconnecting to deal with #6387, as #6589 is already enough. It's easier to revert this instead of rewriting the client so connecting and starting demo playback are also delayed.

Closes #6595.
2023-05-16 19:34:21 +02:00
ChillerDragon c5eb15d9f6 Compare against correct enum in dummy connect 2023-05-16 16:38:55 +02:00
Robert Müller 2f2c86ced3 Move variable declarations closer to usages 2023-05-15 20:56:17 +02:00
Robert Müller cbde0bb7c6 Use nullptr instead of 0 2023-05-15 20:48:02 +02:00
Robert Müller cd9d0e5e16 Add default parameter values to CMap::GetItem 2023-05-15 20:48:01 +02:00
Robert Müller 7273574d68 Add missing CMap::NumData delegate function 2023-05-15 20:47:59 +02:00
Robert Müller 5e215f6ee3 Mark map and datafile functions as const when possible 2023-05-15 20:47:38 +02:00
Robert Müller 6b37c3dbf4 Reorder map and datafile functions 2023-05-15 20:46:50 +02:00
Robert Müller 52e1494347 Remove unused CDataFileReader::Unload function declaration 2023-05-15 20:28:39 +02:00
bors[bot] a38dea4454
Merge #6590
6590: Make text containers bit safer r=Robyt3 a=Jupeyy

From reading the code I couldn't understand how https://github.com/ddnet/ddnet/issues/5143#issuecomment-1546735484 could happen

either (checked = not the case):
 - [x] teini used an outdated client
 - [ ] i am blind
 - [ ] it was a name/clan -plate, scoreboard entry
 - [ ] it leaked somewhere in text.cpp or similar impl
 - [ ] it happened because of an outside write.

We don't really come further with this, so we should probably at least try it out?
`@Robyt3` your opinion? We can still always remove it again

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2023-05-14 19:16:16 +00:00
Jupeyy 370d37b8fd Add shared ptr to track usage 2023-05-14 20:21:59 +02:00
Jupeyy bc006dbf08 make sure it's not modifying memory 2023-05-14 19:26:48 +02:00
Robert Müller d08626cf69 Add default argument to CDataFileReader/IMap::GetItem
Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.

Use `nullptr` instead of `0`.
2023-05-14 16:39:46 +02:00
bors[bot] 03d17a98ed
Merge #6585
6585: Add client_score_kind field to serverinfo (followup) r=Robyt3 a=edg-l

followup on #5960 (fixes conflicts)

It specifies whether the scores are to be interpreted as times (string value starting with "time") or as points (string value starting with "points").

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
2023-05-14 12:17:55 +00:00
Robert Müller bde876dfe5 Fix check for changed os_version_str return value
Missing from #6429.
2023-05-14 13:38:08 +02:00
bors[bot] 1539bbf2d5
Merge #6565
6565: Delay disconnecting until after render call r=def- a=Robyt3

When a client component (e.g. the menu or the console) disconnects the client, this immediately unloads the map data but the render call continues as normal. This causes all components rendered after this component to access invalid memory in place of the map, layers and collision data.

This is fixed by delaying the actual disconnecting until after the render call, to ensure that the map data can be safely unloaded.

Closes #6387. Closes #3179.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [X] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-14 10:02:10 +00:00
bors[bot] ada7c4d597
Merge #6497
6497: Fix client crash/hang when launching without data directory r=edg-l a=Robyt3

Closes #4638.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [X] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-14 09:43:06 +00:00
bors[bot] 648dc9e032
Merge #6429
6429: Minor refactoring of `os_version_str` r=edg-l a=Robyt3



## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-14 09:24:54 +00:00
Edgar 1ca7870bf2
fix conflicts 2023-05-14 11:22:06 +02:00
bors[bot] e9d08a15fd
Merge #6560
6560: Replace EntityEx with new netobjs r=edg-l a=trml

This is a proposal for replacing EntityEx with new netobjects, like suggested in #5860.
- Adds a new DDNetPickup that includes switch number
- a new DDNetProjectile that replaces the old one (which is renamed to DDRaceProjectile)
  - includes switch number, tunezone and velocity/speed (plus a flag that can be used to send velocitiy of player projectiles with full precision)
- switch number and subtype is added to DDNetLaser (to distinguish e.g. draggers with different strength)

The pr removes EntityEx from the server, but keeps compatibility in the client.

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: trml <trml@users.noreply.github.com>
2023-05-14 08:43:02 +00:00
Robert Müller 82fb94a236 Shutdown SDL after kernel and client
Register SDL for cleanup before creating the kernel and client, so SDL is shutdown after kernel and client. Otherwise the client may crash when shutting down after SDL is already shutdown.

Closes #6581.
2023-05-12 16:11:05 +02:00
Robert Müller c8b69dd815 Properly uninitialize all client components
Track stack of cleaner functions that destruct client components so exactly the correct cleanup is performed in the reverse order of initialization.

This allows performing the cleanup also in the early-return cases without introducing duplicate code.
2023-05-10 21:13:28 +02:00
Robert Müller 95b0f8c1e4 Add restart command to client 2023-05-10 21:13:28 +02:00
Robert Müller aced53c6fe Uninitialize entire client before restarting 2023-05-10 21:13:21 +02:00
Robert Müller cda3575d10 Quit client when existing config file cannot be loaded
When the configuration file exists but cannot be loaded, the client continues to launch. When closing, the client then saves the default config and overwrites the existing config that could not be loaded.

This is prevented by quitting the client with an error message popup when the config exists but cannot be loaded.

Closes #3843.
2023-05-10 21:04:02 +02:00
Robert Müller d9307ca756 Use FileExists/fs_is_file instead of opening file
This is more concise and works more reliable e.g. on Windows.

See: https://devblogs.microsoft.com/oldnewthing/20071023-00/?p=24713
2023-05-10 21:04:02 +02:00
bors[bot] e95fb14612
Merge #6573
6573: set SDL_MAC_OPENGL_ASYNC_DISPATCH sdl hint to fix macos resizing r=heinrich5991 a=edg-l

Fixes a issue where ddnet freezes on resize on macos

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Edgar <git@edgarluque.com>
2023-05-09 12:52:23 +00:00
Edgar 3104e669bf set SDL_MAC_OPENGL_ASYNC_DISPATCH sdl hint to fix macos resizing 2023-05-09 14:46:14 +02:00
Jupeyy 0b1960c532 Fix Y Alignment by respecting cursor height independent of character height 2023-05-08 17:49:05 +02:00
Robert Müller d203f38f01 Fix client crash when starting without font file
Add checks to text render functions to prevent crashes when no default font is set.
2023-05-08 14:04:22 +02:00
Robert Müller c841c7ad05 Destroy window before showing popup if graphics initialized
Work around SDL bug that prevents message popup from being closed.
2023-05-07 21:20:47 +02:00
Robert Müller 817d96a73d Only show assertion popup for assertions on main thread
The SDL function may only be called from the main thread, so we can't show a popup for failed assertions on other threads.
2023-05-07 21:20:47 +02:00
Robert Müller 3e810b9814 Also print platform, game and OS version in assertion popup 2023-05-07 15:50:46 +02:00
Robert Müller 5c90fd2b83 Delay disconnecting until after render call
When a client component (e.g. the menu or the console) disconnects the client, this immediately unloads the map data but the render call continues as normal. This causes all components rendered after this component to access invalid memory in place of the map, layers and collision data.

This is fixed by delaying the actual disconnecting until after the render call, to ensure that the map data can be safely unloaded.

Closes #6387. Closes #3179.
2023-05-06 21:10:38 +02:00
bors[bot] cfd003d9c5
Merge #6559
6559: Show error message popup on assertion error in client and when client fails to launch r=def- a=Robyt3

Alternative to #6493. Closes #6482.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-06 15:28:27 +00:00
Robert Müller 0c32eacbab Make text container index type-safe
Use `STextContainerIndex` wrapper instead of `int` for text container index for type-safety.

Add missing checks to ensure valid text container index before rendering FPS and finish time text containers.
2023-05-05 15:58:17 +02:00
Robert Müller 493f47515c Add debug output of text container text on assertion
To get more information on #5143.
2023-05-05 00:03:15 +02:00
trml e10f528215 Add net netobjs for projectile and pickup, extend ddnetlaser, remove EntityEx server-side 2023-05-04 23:43:05 +02:00
Robert Müller 3981f7ffe0 Show error message popup when client fails to launch 2023-05-04 20:03:28 +02:00
Robert Müller ccfca141d4 Show error message popup on assertion error in client
Add assertion handler function to base system. Set handler in client to show a message box on assertion errors.
2023-05-04 20:03:27 +02:00
Robert Müller 00b7bc5bfd Add IClient::ShowMessageBox
To show an error/warning/information message popup with variable title and message.

This uses the SDL function `SDL_ShowSimpleMessageBox` to show the message box, because it is simpler than implementing this ourself in the base system, especially because we would have to add an additional explicit dependency on GTK3 to show a message dialog on Linux.

This function can be used without SDL being initialized.
2023-05-04 19:47:50 +02:00
Robert Müller c9f68901b7 Extract InitNetworkClient method 2023-05-03 20:46:14 +02:00