Commit graph

13048 commits

Author SHA1 Message Date
Robert Müller 5963a7ae42 Remove unnecessary usage of preprocessor
Using the preprocessor here doesn't reduce any duplicate code and it adds false positives for the unused config variable check.
2023-06-01 20:25:41 +02:00
Dennis Felsing 4785ac3298 Version 17.0.2 2023-06-01 11:39:59 +02:00
Robert Müller cde1143528 Regenerate key lists with latest SDL version
Update `SDL_scancode.h` which is used by `gen_keys.py` to generate the list of keys enum (`keys.h`) and the list of key names (`keynames.h`) and regenerate the lists.

This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).
2023-05-30 23:39:47 +02:00
bors[bot] 8659578798
Merge #6657
6657: Allow rcon users access to reserved slots r=def- a=Learath2

<!-- What is the motivation for the changes of this pull request? -->
The password for the reserved slots keep getting leaked. Hopefully this will fix the issue.

<!-- 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
- [x] 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
- [ ] 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: Learath <learath2@gmail.com>
2023-05-30 10:40:20 +00:00
bors[bot] eb63cb3c2b
Merge #6686
6686: Fix switch prediction on solo server r=def- a=trml

Fixes #6644 by sending switch state for team 0 on sv_solo_server 1 to match the team of the clients own character, and by not predicting other characters/entities when in solo.

<!-- 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
- [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: trml <trml@users.noreply.github.com>
2023-05-29 21:09:12 +00:00
Robert Müller d0333f10b0 Fix flashing window not working with newer SDL versions
Minimum SDL version 2.0.16 is required for `SDL_FlashWindow`. The SDL version schema changes after version 2.0.22 to 2.24.0 etc. (minor version is used instead of patchlevel) which was causing the condition that checks for minimum version 2.0.16 to not work correctly with newer SDL versions.

Closes #6687.
2023-05-29 19:43:45 +02:00
trml ed89ba543a Send team 0 for switchers as well on solo server 2023-05-29 16:05:53 +02:00
trml a090ba8cb3 Don't predict other players in solo 2023-05-29 15:01:38 +02:00
bors[bot] 6c7f6a4494
Merge #6665
6665: Fix ordering of unfinished/unconnected tees r=heinrich5991 a=Learath2

<!-- What is the motivation for the changes of this pull request? -->
I thought there was initially a strict weak ordering issue here but upon further inspection noticed it's fine.
However, people with negative score were getting sorted undeterministically, basically every unfinished tee was treated as equal since `!comp(a, b) && !comp(b, a)`. Sorting them by name was the intention.

I also got rid of the old `INT_MIN` "hack", it was only there to make the code shorter and it's no longer possible with the newly flipped sign without flipping it back on the client which is ugly.

Also made `ScoreKind` `const`, not sure if any compiler optimizes on that but why not? If we ever move to C++20 this could be a generic lambda instead where we can template `ScoreKind` and make sure it gets optimized properly.

Tidbit: I treated score 0 as a normal score, I'm not sure what it implies. 

<!-- 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: Learath <learath2@gmail.com>
2023-05-29 11:02:52 +00:00
Robert Müller 3130649721 Support dragging demo player controls to move them
Allow dragging the demo player controls anywhere on the screen. The controls can't be moved outside of the screen. Round corners are automatically disabled when the controls are on the edge of the screen.
2023-05-29 12:35:23 +02:00
Robert Müller 6aa7d3dc63 Delay menu (de)activation until end of render call
The escape key was previously always causing the menus to be toggled in addition to the normal key handling.

Now the menu is activated/deactivated by using the same UI hotkey system as in the rest of the menus. By checking for the escape hotkey last in the render call, other parts of the menu, especially popup menus, can use the hotkey first.

Fixes escape key in the demo player closing demo controls and slice popup at the same time. Now the popup is closed first.
2023-05-29 12:30:17 +02:00
Robert Müller bbe2430be9 Fix tooltips being active behind popups and outside clipping rects
Ensure that tooltips are only activated when the associated UI element is currently the hot item. This prevents tooltips from being activated for UI elements that are currently not enabled due to them being behind a popup or outside of a clipping rect.
2023-05-29 12:29:02 +02:00
Robert Müller 90ae59a666 Make server settings editor height adjustable by dragging
Same as for the envelope editor. Extract `RenderExtraEditorDragBar` function to reduce duplicate code.

Fix height being changed by repeated clicking on the draggable element by also resetting `s_Operation` when `Clicked` is `true`.
2023-05-29 12:26:04 +02:00
Robert Müller d9b5a8c3c4 Use X icon for demo close button, remove DoButton_DemoPlayer 2023-05-28 21:53:04 +02:00
Robert Müller 6feb46183e Improve demo slice popup
Show begin time, end time and length of demo cut in popup.

Replace demo slice error/confirm messages with generic popups.

Improve layout. Remove unnecessary empty space.
2023-05-28 15:03:52 +02:00
Robert Müller 1667861857 Use nullptr instead of 0 2023-05-28 14:59:46 +02:00
Robert Müller 6ff418322b Support rendering generic popup menus in demo player
Due to different code paths for the demo player, the `RenderPopupMenus` funtion needs to be called separately.
2023-05-28 14:59:46 +02:00
Robert Müller be8a601e9e Render demo popups above/after other demo controls
Prevent using other demo controls while a demo popup is open.
2023-05-28 14:59:45 +02:00
Robert Müller 20ce930765 Move variable declarations closer to usages 2023-05-28 14:59:45 +02:00
Robert Müller b01e8b7bc5 Extract CMenus::RenderDemoPlayerSliceSavePopup function 2023-05-28 14:59:45 +02:00
Robert Müller 1015176ae1 Fix inconsistent width/height calculation for generic popups
Sometimes the calculated popup width and height do not perfectly match the width and height when the text is rendered, so a small nudge value is added to prevent cases where this was noticeable.
2023-05-28 14:59:45 +02:00
Robert Müller 4ec4560679 Show error instead of replacing existing demo when renaming
Renaming a demo to the name of another demo would overwrite the target demo. Now an error message popup is shown instead to prevent this.

After a demo rename error popup is shown, return to the demo rename popup instead of closing the popup.
2023-05-28 14:02:08 +02:00
bors[bot] d433a2fd1d
Merge #6677
6677: Use icons for refresh and connect buttons, refactor `DoButtonMenu` r=def- a=Robyt3

Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes #5605. Closes #5878.

The "Refreshing..." text is replaced with combined refresh and ellipsis icons.

Alpha and saturation of the green color of the connect button are increased.

Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.

Screenshots:
- Before:
![screenshot_2023-05-27_19-52-37](https://github.com/ddnet/ddnet/assets/23437060/3bf27f53-b034-4147-97ee-5c24a5b68457)
- After:
![screenshot_2023-05-27_19-51-07](https://github.com/ddnet/ddnet/assets/23437060/702a9c1c-be07-4cd6-94b5-b4b0fd9b4fa1)
- After (when refreshing):
![screenshot_2023-05-27_19-56-15](https://github.com/ddnet/ddnet/assets/23437060/0a456467-6550-4ce7-b756-56e3bbbc4f43)


## 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: Robert Müller <robytemueller@gmail.com>
2023-05-27 19:53:09 +00:00
bors[bot] 9dfcbd9ff4
Merge #6678
6678: Fix undefined behavior in `CSnapshotDelta::DiffItem` r=Chairn a=Robyt3

Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.

```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)

src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```

See #6650.

<!-- 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: Robert Müller <robytemueller@gmail.com>
2023-05-27 19:29:12 +00:00
Dennis Felsing 7cdc92859e Version 17.0.1 2023-05-27 21:27:35 +02:00
Robert Müller 36dd5c5075 Fix undefined behavior in CSnapshotDelta::DiffItem
Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.

```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)

src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
    0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
    1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
    2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
    3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
    4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
    5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
    6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```

See #6650.
2023-05-27 20:57:05 +02:00
Robert Müller 08e0a87ff1 Use icons for refresh and connect buttons, refactor DoButtonMenu
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes #5605. Closes #5878.

The "Refreshing..." text is replaced with combined refresh and ellipsis icons.

Alpha and saturation of the green color of the connect button are increased.

Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.
2023-05-27 19:48:32 +02:00
bors[bot] ba7b82258e
Merge #6673 #6676
6673: Clear Victim Team render info on skin changes r=Robyt3 a=Jupeyy

fixes #6662

This should fix the issue, I guess, by simply clearing the render info. I can't find an easy way to restore the original skins of the team members as we don't save their IDs.
I couldn't directly trigger the assert, but I could certainly see the skin getting invalid when killen the team and switch to "vanilla only skins". (Edit: When triggering it a few times I got the assert)

The code generally looks a bit hacky. Maybe the original author can refactor it a bit

## 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)


6676: Show GPU info (if available) in assert r=Robyt3 a=Jupeyy

first part of #6672

![image](https://github.com/ddnet/ddnet/assets/6654924/0e9aec5a-528a-4e7a-a3fa-93108e55597e)



## 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: Jupeyy <jupjopjap@gmail.com>
2023-05-27 09:01:26 +00:00
Jupeyy 70d48140f0 Show GPU info (if available) in assert 2023-05-27 09:51:22 +02:00
Jupeyy ad40156a3b Wait for graphics thread's current execution to end before triggering the assert dialog 2023-05-27 09:34:21 +02:00
Jupeyy fe20459138 Clear Victim Team render info on skin changes 2023-05-27 09:10:39 +02:00
bors[bot] 144bb1dd7f
Merge #6671
6671: Ensure line inputs are deactivated when they are not rendered r=def- a=Robyt3

Check if the active line input was not rendered and deactivate it in that case.

This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.

This was causing the IME candidate list to be rendered ingame after closing the menu. Closes #6666.

## 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-26 22:26:18 +00:00
Robert Müller 71c56f1e70 Ensure line inputs are deactivated when they are not rendered
Check if the active line input was not rendered and deactivate it in that case.

This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.

This was causing the IME candidate list to be rendered ingame after closing the menu. Closes #6666.
2023-05-26 23:58:04 +02:00
bors[bot] 4070a9587a
Merge #6670
6670: Delete selection with backspace/delete regardless of word mode r=def- a=Robyt3

Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.

## 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-26 21:46:52 +00:00
Robert Müller b0c4d3fcde Delete selection with backspace/delete regardless of word mode
Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.
2023-05-26 23:32:17 +02:00
Jupeyy 52d61244cd Remove inp_mouseold config
Because it causes trouble with newer SDL2 versions
`https://github.com/libsdl-org/SDL/issues/7159`
2023-05-26 22:44:32 +02:00
Robert Müller 448a39768b Add inp_ime_native_ui to toggle native IME UI on Windows
Add `inp_ime_native_ui` on Windows to use native IME UI instead of rendering the candidate list in the client.

Always set the SDL hint to use native UI on non-Windows, as we cannot determine the list of candidates on those systems.
2023-05-26 15:39:28 +02:00
Learath a63404409b Fix ordering of unfinished/unconnected tees 2023-05-26 01:43:42 +02:00
Dennis Felsing a5332f0b11 Version 17.0 2023-05-25 12:09:12 +02:00
Robert Müller 34b66d2107 Pass nullptr instead of unused UI rect 2023-05-24 21:16:13 +02:00
Robert Müller 60ac3b3d48 Remove settings checkbox for cl_threadsoundloading
The default value `1` should be fine for most users and this setting is not likely to be changed very often, so it doesn't need a checkbox in the settings menu.
2023-05-24 21:12:44 +02:00
Robert Müller b5637df2bf Enable threaded sound loading per default again
Change `cl_threadsoundloading` default to `1` again. The default was previously set to `0` in 1287cc3f20 because the setting may have caused crashes. Now that `mem_alloc` is replaced with `malloc` and therefore thread-safe we can enable this setting again per default.
2023-05-24 21:12:43 +02:00
Robert Müller 70b5e4b5bd Remove settings edit box for snd_rate
The default setting `48000` should be fine for the majority of the users so it's not necessary to be able to change this in the settings menu.
2023-05-24 21:12:43 +02:00
Robert Müller 460cda85d7 Set minimum/maximum values for snd_rate
Hopefully prevent crashes that some users are experiencing when using very unreasonable `snd_rate` values.
2023-05-24 21:12:43 +02:00
Robert Müller fd0e9b18b4 Remove unused snd_device config variable 2023-05-24 21:12:43 +02:00
bors[bot] 03a5dde418
Merge #6639
6639: Fix- Replaced usage of m_ProofBorders and m_MenuProofBorders with enum EProofBorder r=Robyt3 a=tarunsamanta2k20

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

Changes requested.
closes #6609 

<!-- 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
- [x] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [x] 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
- [x] 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: Tarun Samanta <tarunsamanta77@gmail.com>
Co-authored-by: Tarun Samanta <55488549+tarunsamanta2k20@users.noreply.github.com>
2023-05-24 18:30:44 +00:00
Robert Müller ff51edec2d Fix incorrect swapping with draggers
There is another member variable `CDragger::m_aTargetIdInTeam` that contains for every team the client ID of the team member currently being dragged by this dragger.

The client IDs in this array also need to be swapped accordingly or the dragger will not switch target correctly when swapping.

Closes #5865.
2023-05-24 17:47:09 +02:00
Learath 6f9c387e95 Add config option. Make it untidy per clang-tidy 2023-05-24 16:01:21 +02:00
Learath f1cee7475b Allow rcon users access to reserved slots 2023-05-24 15:19:09 +02:00
bors[bot] 422ff844b8
Merge #6656
6656: Fix crash with super (fixes #6654) r=Learath2 a=def-

CClientMask has size MAX_CLIENTS, so it can't be used for super team

<!-- 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: Dennis Felsing <dennis@felsin9.de>
2023-05-24 12:04:25 +00:00
Dennis Felsing 3dd1d784d6 Fix crash with super (fixes #6654)
CClientMask has size MAX_CLIENTS, so it can't be used for super team
2023-05-24 13:34:38 +02:00
Tarun Samanta f982dd77c1 fixing linting issue 2023-05-24 01:27:57 +05:30
Tarun Samanta e8a33cfade fiing linting issue 2023-05-23 23:57:08 +05:30
Tarun Samanta 050bf4a9b8 Made sugested changes 2023-05-23 23:46:42 +05:30
Dennis Felsing bdc916faa9 Fix swapping with dragger beams (fixes #6597) 2023-05-23 00:42:04 +02:00
Robert Müller 23d8acd96c Replace country server filter fullscreen popup with smaller popup
Replace the large hard-coded popup to select the country for the server filter with a small overlay popup for better usability.
2023-05-22 20:32:15 +02:00
Robert Müller 83c19a1e96 Add highlight color when hovering country button of server filter 2023-05-22 20:32:15 +02:00
Robert Müller 4dcb80e462 Enable country button also when filter not enabled
Selecting a flag will also enable the filter in this case.
2023-05-22 20:32:14 +02:00
Robert Müller f16f77ce26 Slightly decrease size of country flag in server filter 2023-05-22 20:32:14 +02:00
Robert Müller 9be72db36a Remove unnecessary margin on left side of server filter
To improve layout. The "Filter connecting players" checkbox can now use the original font size without being resized.
2023-05-22 20:31:02 +02:00
Robert Müller 0d0f9ed232 Remove dead code 2023-05-22 20:31:02 +02:00
Robert Müller 59fafdbf4e Only activate server browser list box when no popup is open
To support popup menus over the server browser.
2023-05-22 20:30:06 +02:00
Tarun Samanta fcaab778ca modified some files as asked 2023-05-22 23:50:45 +05:30
Robert Müller e175c0a79f Remove duplicate enter hotkey used for connecting to server
The list box already takes care of the enter hotkey for connecting. Furthermore, the list box can be inactive, whereas the now removed hotkey was always active.

Minor refactoring of `DoButtonMenu` usage.
2023-05-22 20:09:33 +02:00
Robert Müller 808d604579 Propagate list box active state to underlying scroll region
Fix inactive list box still consuming mouse scroll events.
2023-05-22 20:09:32 +02:00
bors[bot] b2eacf7f09
Merge #6648
6648: Fix filling switch layer not setting switch number 0, clear unused switch/tele properties when filling selection r=def- a=Robyt3

Closes #5464.

## 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-22 17:25:35 +00:00
Robert Müller 6ca74ec39e Clear unused switch/tele properties when filling selection
Set switch number/delay/flags to 0 when unused for a specific tile.

Set tele number to 255 when unused for a specific tile.
2023-05-22 17:46:50 +02:00
Robert Müller d5e4597012 Fix filling switch layer not setting switch number 0
Closes #5464.
2023-05-22 17:46:50 +02:00
Robert Müller a068034e61 Extract duplicate expressions into variables 2023-05-22 17:46:50 +02:00
Edgar a4abc1fdd9
factor out scorekind backwards compat gametype check 2023-05-22 17:22:52 +02:00
Edgar 1d30462e50
clean time score handling, with positive time values 2023-05-22 16:36:46 +02:00
Tarun Samanta ef78e36c6f replaced second enum 2023-05-22 18:16:25 +05:30
Edgar 8a3d8fc53f
fix time score info on server detail 2023-05-22 13:53:23 +02:00
Tarun Samanta 79d8928a03 made requested changes 2023-05-22 01:51:13 +05:30
Robert Müller 1b6be5e10b Use different color for offline clanmates in friends list
Closes #6643.
2023-05-21 22:06:56 +02:00
Tarun Samanta e74c60d9a5 Modified some files 2023-05-22 00:56:23 +05:30
Tarun Samanta f23f74ee9e fixing some error 2023-05-21 22:42:53 +05:30
Tarun Samanta 61ef6210d1 Modifications in three files 2023-05-21 21:30:41 +05:30
Tarun Samanta 523a3c4450 fix- Replaced usage of m_ProofBorders and m_MenuProofBorders with enum EProofBorder 2023-05-21 14:47:27 +05:30
Robert Müller 68d2d466d5 Fix use of invalid text container index for finish message HUD 2023-05-20 19:20:48 +02:00
bors[bot] fb2d5e35dc
Merge #6630
6630: Remove unused `sv_sql_bindaddr` config variable r=edg-l a=Robyt3

Closes #6456.

## 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: Robert Müller <robytemueller@gmail.com>
2023-05-19 19:55:21 +00:00
Robert Müller ed554368ec Remove unused sv_sql_bindaddr config variable
Closes #6456.
2023-05-19 21:02:39 +02:00
bors[bot] 4ab55bd722
Merge #6626 #6629
6626: Remove popup for unofficial servers r=Robyt3 a=def-

Via https://github.com/ddnet/ddnet/pull/6618/files#r1199072246

Thoughts?

## 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)


6629: Remove unused `CMenus::DoToolTip` declaration r=def- a=Robyt3



## 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: Dennis Felsing <dennis@felsin9.de>
Co-authored-by: Robert Müller <robytemueller@gmail.com>
2023-05-19 18:55:32 +00:00
Dennis Felsing 3593cce9b4 Revert "Add popup to confirm connecting to friend on non-official server"
This reverts commit 2e46460302.
2023-05-19 20:31:59 +02:00
Robert Müller 3d9d18c511 Remove unused CMenus::DoToolTip declaration 2023-05-19 19:40:46 +02:00
Robert Müller 56d1c8e560 Slightly increase font size of friend name 2023-05-19 19:22:11 +02:00
Dennis Felsing cca040274f Remove popup for unofficial servers
Via https://github.com/ddnet/ddnet/pull/6618/files#r1199072246

Thoughts?
2023-05-19 17:09:01 +02:00
bors[bot] d4582fb08e
Merge #6618
6618: Render tees for online friends in friends list, change friend info text to `Map | Mode | Country/Ping`, show official server icon, show confirmation popup r=edg-l a=Robyt3

Closes #6614.

![friends](https://github.com/ddnet/ddnet/assets/23437060/946cd095-a1f3-420c-b158-2e66687e7806)

Show race disconnect confirmation when joining friend. Closes #6622.

Add popup to confirm connecting to friend on non-official server:

![popup](https://github.com/ddnet/ddnet/assets/23437060/cb702277-93a5-4d90-9369-0f3dbff7cca3)


## 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: Robert Müller <robytemueller@gmail.com>
2023-05-19 14:03:37 +00:00
Robert Müller 2e46460302 Add popup to confirm connecting to friend on non-official server 2023-05-19 15:51:05 +02:00
Robert Müller 1bea7a2cd5 Show race disconnect confirmation when joining friend
Closes #6622.
2023-05-19 15:16:32 +02:00
Robert Müller fc3583a18e Show official server icon in friends list
Show the official server icon for online friends who are currently on official servers.
2023-05-19 15:15:44 +02:00
Robert Müller 637f7fd736 Reduce duplicate UI spacing code 2023-05-19 15:14:46 +02:00
bors[bot] dcb67cb17a
Merge #6617
6617: Add /unsolo and /undeep practice commands r=def- a=hus3h

Related: https://github.com/ddnet/ddnet/issues/6318#issuecomment-1498626132 and #2391

Unsolo is often needed especially in maps with death tiles and solo part spawns, undeep can also be useful for some parts.

Some notes:

- didn't use `CFGFLAG_SERVER` for the commands as it resulted in a conflict with the registered `unsolo` and `undeep` super team console commands, not entirely sure if that's okay
- `/help unsolo` and `/help undeep` will print the help text of the super team commands, not the new chat commands. The texts are currently the same, but it's still a sign of possible conflicts
- prevented `/unsolo` on solo servers by checking for `SV_TEAM_FORBIDDEN` and `SV_TEAM_FORCED_SOLO`, let me know if that's not enough (Tutorial map?)
- no server message is sent on `/unsolo` (as opposed to going through unsolo tiles), didn't seem like it's needed here even if it feels different at first

 If the conflicts are problematic enough, the easiest fix might be using new unique commands instead of `unsolo` and `undeep`, I couldn't think of something that would fit as well though.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] 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
- [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: hus3h <39054982+hus3h@users.noreply.github.com>
2023-05-19 12:25:53 +00:00
Robert Müller b33ce0f37d Change friend info text to Map | Mode | Country/Ping 2023-05-18 23:06:29 +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
Robert Müller a2cbc7fb24 Render tees for online friends in friends list
Closes #6614.
2023-05-18 22:03:43 +02: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
bors[bot] 7790937fa8
Merge #6616
6616: fix timescore r=Robyt3 a=edg-l

Fixes the time displayed, this time i tested it quite thoroughly, i could reproduce the wrong ordering in scoreboard and the time not updating before, and fixed it now.

The previous way also had a issue with times that ended up with a value of -1, which is fixed now too

## 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
- [ ] 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 Luque <git@edgarluque.com>
2023-05-18 19:36:06 +00:00
Edgar 48feb2abbb
fix test 2023-05-18 21:11:04 +02:00
hus3h 939f2f7d50 Add /unsolo and /undeep practice commands 2023-05-18 22:08:58 +03:00
Edgar 654ee03b67
fix timescore 2023-05-18 20:49:22 +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
bors[bot] 373595dec8
Merge #6608
6608: Support rendering tooltips with multiple lines of text, support overlapping tooltip activation rects, add alpha fade-in for tooltips  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-18 11:24:25 +00:00
Robert Müller 47fca7683d Add alpha fade-in for tooltips
After 0.75 seconds of hovering the tooltip rect without rendering the tooltip, start fading in the tooltip for the remaining 0.25 seconds.
2023-05-18 13:22:52 +02:00
bors[bot] ac820ce62d
Merge #6607
6607: Minor refactoring of `CMenus::RenderLoading` r=Learath2 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-18 10:52:23 +00:00
Robert Müller 13ed0e386a Use const when possible 2023-05-18 12:21:34 +02:00
Robert Müller fe359e2909 Combine Margin function calls
Both calls put a margin around the same rect but the intermediate result is never used, so both margins can be combined.

The variable `Screen` is also not necessary.
2023-05-18 12:20:53 +02:00
Robert Müller f60dd0d3c2 Fix name of static variable s_LastLoadRender 2023-05-18 12:19:10 +02:00
Robert Müller af67130dbd Use nullptr for unused UI rect splitting parameters 2023-05-18 12:18:22 +02:00
Robert Müller 05f2b19391 Remove unused SLabelProperties Props variable 2023-05-18 12:17:15 +02:00
Robert Müller 31304c4573 Support overlapping tooltip activation rects
When the activation rects for two tooltips overlap, this always causes the first tooltip to be rendered.

This is changed so the last active tooltip is rendered instead, to simplify the usage of the tooltip function.
2023-05-18 12:12:44 +02:00
Robert Müller ed09bba45a Support rendering tooltips with multiple lines of text
Render tooltip text correctly with multiple lines when the maximum tooltip width is limited.

Add missing padding when rendering multi-line tooltip.

Update doxygen documentation.
2023-05-18 12:12:26 +02:00
VoxelDoesCode 2222612412 Only run KillTeam() when team has more than 1 tee
Clang format #6606
2023-05-17 16:12:10 -04:00
bors[bot] 20032b5a24
Merge #6546
6546: move some editor buttons into menus r=Robyt3 a=Marmare314

The entities and unused buttons are now in a new "Settings" menu.
![menu_settings](https://user-images.githubusercontent.com/49279081/235301689-a1375024-9233-432b-9ab3-4545f982711f.png)

The border and goto buttons got moved to the "Tools" menu.
![tools_menu](https://user-images.githubusercontent.com/49279081/235301690-6883e6a7-0afe-4b2f-826c-3fb48694f7f4.png)


## 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
- [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: marmare314 <49279081+Marmare314@users.noreply.github.com>
2023-05-17 15:59:42 +00:00
marmare314 76eac08783 fix padding of buttons in settings 2023-05-17 17:25:21 +02: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
marmare314 37791ada99 enable brush coloring -> brush coloring 2023-05-16 22:24:26 +02:00
bors[bot] 065149ebe9
Merge #6600 #6601
6600: Compare against correct enum in dummy connect r=heinrich5991 a=ChillerDragon

Why did we allow connecting dummy in state pending? Maybe because state online did not match because the wrong enum was used?

```C++
int CNetClient::State()
{
	if(m_Connection.State() == NET_CONNSTATE_ONLINE)
		return NETSTATE_ONLINE;
	if(m_Connection.State() == NET_CONNSTATE_OFFLINE)
		return NETSTATE_OFFLINE;
	return NETSTATE_CONNECTING;
}
```

We map from NET_CONNSTATE_  to NETSTATE_ so it should also be compared against NETSTATE_

<!-- 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)


6601: try to fix broken score r=heinrich5991 a=edg-l

not sure if this is the fix, but -9999 is wrong, and -1 is set on reset

## 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: ChillerDragon <chillerdragon@gmail.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
2023-05-16 17:43:03 +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
Edgar 8c298413bd try to fix broken score 2023-05-16 16:42:08 +02:00
ChillerDragon c5eb15d9f6 Compare against correct enum in dummy connect 2023-05-16 16:38:55 +02:00
bors[bot] 22df50c9bd
Merge #6592
6592: Minor refactoring of map and datafile r=def- a=Robyt3



## 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: Robert Müller <robytemueller@gmail.com>
2023-05-15 21:45:22 +00:00
Robert Müller dd7cf38be5 Fix uninitialized field causing assertion error with MSVC
The modified time was uninitialized for the editor file browser entry corresponding to the downloadedmaps-link. The time is never rendered for links, but the uninitialized time value was still passed to `str_timestamp_ex`, which results in an assertion error due to an incorrect time value being used when compiling with MSVC.

This is fixed by properly initializing the field and also by only calling `str_timestamp_ex` when the time value will be rendered.

Closes #6579.
2023-05-15 22:07:37 +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
Edgar e75a763454
add unit test for updating teamranks 2023-05-15 09:07:29 +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
bors[bot] cca6d867cb
Merge #6588 #6589
6588: Add default argument to `CDataFileReader/IMap::GetItem` r=def- a=Robyt3

Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.

Use `nullptr` instead of `0`.

## 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)


6589: Fix heap-use-after-free when quitting/restarting r=def- a=Robyt3

Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.

Closes #6387 until further notice.

## 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 18:58:08 +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 f3e8513477 Fix heap-use-after-free when quitting/restarting
Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.
2023-05-14 18:12:47 +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
Edgar 044c0e3985
fix sql tests 2023-05-14 11:35:50 +02: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
bors[bot] d873095d33
Merge #6582
6582: Shutdown SDL after kernel and client r=edg-l a=Robyt3

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.

## 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: Robert Müller <robytemueller@gmail.com>
2023-05-12 15:28:41 +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
Edgar 1e319fa279
fix opacity for jumps 2023-05-11 23:04:05 +02:00