Commit graph

12537 commits

Author SHA1 Message Date
Robert Müller f78fd6bda1 Minor refactoring of CFifo
- Remove unused include.
- Instead of quitting entirely, only disable the fifo component when file cannot be used.
- Return early to reduce indentation.
2023-01-20 22:52:55 +01:00
heinrich5991 e06052292e CMsgPacker doesn't know about message ID encoding
CC #6289
2023-01-20 21:09:58 +01:00
bors[bot] 4a4d6c5483
Merge #6284
6284: Ensure integer wrapping instead of preventing overflow/underflow r=heinrich5991 a=Robyt3

As the integer overflow/underflow in `UndiffItem` can happen during normal gameplay, we should in this case neither ignore the snapshot delta nor show an error message.

Instead of depending on the particular compiler doing integer wrapping, when integer overflows or underflows occur, we make it part of the design, by casting to `unsigned`, which ensures that integer wrapping is being used.

## 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-01-18 22:46:52 +00:00
Dennis Felsing f3867d677f Version 16.7.2 2023-01-18 23:20:15 +01:00
bors[bot] 0ba6c1c3b6
Merge #6289
6289: Fix `sv_vanilla_antispoof` for vanilla 0.6.5 clients r=def- a=Robyt3

This fixes issues that prevented vanilla 0.6.5 clients from joining DDNet servers with `sv_vanilla_antispoof 1` (closes #2074).

The dummy map was not valid. The size of the tiles and game layers was calculated incorrectly. The last member variable included in `CMapItemLayerTilemap` version 2 should be `m_Data`. Previously only the size of the member `m_aName` was subtracted from the total size, which was resulting in an incorrect item size, as the size of the following 5 members also needs to be subtracted.

The handshake messages were packed incorrectly. The message ID and the system flag were not added to the six packers that are passed to `SendMsgs`. The lines that are removed in this function seemed to assume that the message ID was already added but not packed, which was no longer the case. Presumable at some point `CMsgPacker` was changed without adapting the vanilla antispoof feature. Now, the message ID and system flag are properly packed when initially creating the message packers.

The `dummy_map` tool is improved to also print the generated map file's hashes and data as a C style array, so the data can immediately be copied to `network_server.cpp`.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [X] 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: Robert Müller <robytemueller@gmail.com>
2023-01-18 21:51:46 +00:00
Robert Müller 1a9357b961 Fix sv_vanilla_antispoof for vanilla 0.6.5 clients
This fixes issues that prevented vanilla 0.6.5 clients from joining DDNet servers with `sv_vanilla_antispoof 1` (closes #2074).

The dummy map was not valid. The size of the tiles and game layers was calculated incorrectly. The last member variable included in `CMapItemLayerTilemap` version 2 should be `m_Data`. Previously only the size of the member `m_aName` was subtracted from the total size, which was resulting in an incorrect item size, as the size of the following 5 members also needs to be subtracted.

The handshake messages were packed incorrectly. The message ID and the system flag were not added to the six packers that are passed to `SendMsgs`. The lines that are removed in this function seemed to assume that the message ID was already added but not packed, which was no longer the case. Presumable at some point `CMsgPacker` was changed without adapting the vanilla antispoof feature. Now, the message ID and system flag are properly packed when initially creating the message packers.

The `dummy_map` tool is improved to also print the generated map file's hashes and data as a C style array, so the data can immediately be copied to `network_server.cpp`.
2023-01-18 20:21:12 +01:00
Robert Müller 0e59b84718 Add str_hex_cstyle to print bytes as a C style array
This function converts data to a C style array string presentation.
2023-01-18 17:29:23 +01:00
Robert Müller 64578d4954 Improve str_hex documentation 2023-01-18 00:09:23 +01:00
Robert Müller 65cb2ed7de Ensure integer wrapping instead of preventing overflow/underflow
As the integer overflow/underflow in `UndiffItem` can happen during normal gameplay, we should in this case neither ignore the snapshot delta nor show an error message.

Instead of depending on the particular compiler doing integer wrapping, when integer overflows or underflows occur, we make it part of the design, by casting to `unsigned`, which ensures that integer wrapping is being used.
2023-01-16 18:12:28 +01:00
bors[bot] 029b42458c
Merge #6288
6288: Fix layout of kick/spec vote list items r=def- a=Robyt3

The tee and label were overlapping due to a regression from #6240.

## 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-01-16 15:15:15 +00:00
Robert Müller 0948a1dc4c Fix layout of kick/spec vote list items
The tee and label were overlapping due to a regression from #6240.
2023-01-16 15:37:58 +01:00
ChillerDragon f2a26aa452 Fix build with clang on debian 11
$ clang --version
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Fixes this error

```
In file included from
/home/chiller/Desktop/git/ddnet/src/base/color.h:6:
/home/chiller/Desktop/git/ddnet/src/base/vmath.h:141:38: error:
constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr inline vector2_base<float> direction(float angle)
                                     ^
/home/chiller/Desktop/git/ddnet/src/base/vmath.h:143:29: note:
non-constexpr function 'cosf' cannot be used in a constant expression
        return vector2_base<float>(cosf(angle), sinf(angle));
                                   ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:62:1: note: declared here
__MATHCALL_VEC (cos,, (_Mdouble_ __x));
^
/usr/include/math.h:266:3: note: expanded from macro '__MATHCALL_VEC'
  __MATHCALL (function, suffix, args)
  ^
/usr/include/math.h:273:3: note: expanded from macro '__MATHCALL'
  __MATHDECL (_Mdouble_,function,suffix, args)
  ^
/usr/include/math.h:275:3: note: expanded from macro '__MATHDECL'
  __MATHDECL_1(type, function,suffix, args); \
  ^
/usr/include/math.h:283:15: note: expanded from macro '__MATHDECL_1'
  extern type __MATH_PRECNAME(function,suffix) args __THROW
              ^
/usr/include/math.h:303:34: note: expanded from macro '__MATH_PRECNAME'
                                 ^
<scratch space>:34:1: note: expanded from here
cosf
^
1 error generated.
make[2]: *** [CMakeFiles/engine-shared.dir/build.make:173:
CMakeFiles/engine-shared.dir/src/engine/shared/console.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:604:
CMakeFiles/engine-shared.dir/all] Error 2
make: *** [Makefile:171: all] Error 2
```
2023-01-16 15:10:19 +01:00
bors[bot] 4c639a5965
Merge #6286
6286: Add tooltip to demo seekbar showing the currently hovered time r=Chairn a=Robyt3

When hovering the demo seekbar, show a tooltip with the time at the hovered position.

![screenshot](https://user-images.githubusercontent.com/23437060/212565749-a38951a3-1f08-43a6-b607-02f379b28c52.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
- [ ] 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-01-15 21:07:54 +00:00
Robert Müller d662c7e9fd Add tooltip to demo seekbar showing the currently hovered time
When hovering the demo seekbar, show a tooltip with the time at the hovered position.
2023-01-15 21:31:45 +01:00
Robert Müller 315e52fb99 Refactor demo seekbar width calculation 2023-01-15 21:31:21 +01:00
Robert Müller a127890e2d Clear editor file browser search term when entering folder
Closes #5620.
2023-01-15 20:46:10 +01:00
Robert Müller aa23873af8 Add a refresh button to the editor file browser 2023-01-13 22:54:29 +01:00
bors[bot] 4a6d6fb654
Merge #6281
6281: Support longer file/folder names in editor r=heinrich5991 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-01-13 21:28:25 +00:00
Robert Müller 6b873cab1a Use sizeof for array sizes that should equal other array sizes 2023-01-13 22:07:21 +01:00
Robert Müller d1712f30e6 Support longer file/folder names in editor 2023-01-13 22:07:20 +01:00
Robert Müller 25b487703f Make color pickers not change selected color as much
As described in #5844, sometimes the color kept changing when activating a color picker.

By rounding the color components before packing them into an unsigned, the color only changes very little and only at most once when activating a color picker.
2023-01-13 21:40:25 +01:00
bors[bot] a9207a931f
Merge #6276
6276: Fix announcement feature, don't depend on buffer staying consistent r=Jupeyy a=def-

There is a change in behavior: The file is now only reread if the filename changed, previously it was reread every time.

## 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-01-13 16:30:46 +00:00
Dennis Felsing 43e994a002 Fix announcement feature, don't depend on buffer staying consistent
There is a change in behavior: The file is now only reread if the
filename changed, previously it was reread every time.
2023-01-13 16:22:22 +01:00
Jupeyy c820ac22d3 Merge most entity textures again 2023-01-13 15:25:38 +01:00
Dennis Felsing b62e7f1299 Quick fix for old client on new server
Introduced in https://github.com/ddnet/ddnet/pull/6214/
Not a proper solution yet
2023-01-13 14:46:01 +01:00
Dennis Felsing 007bba9313 Version 16.7.1 2023-01-13 10:48:36 +01:00
bors[bot] dd09c59710
Merge #6269
6269: Fix ddnet.org change in UUIDs r=def- a=heinrich5991

One case was a ddnet.tw UUID's string being changed (but the UUID was not), and the other case is a ddnet.tw UUID's string being changed in one place but not in another in documentation.

Fixes the commit c479230d71.

CC #5312

## 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: heinrich5991 <heinrich5991@gmail.com>
2023-01-12 16:45:27 +00:00
heinrich5991 f2530cfbf2 Add forgotten call 2023-01-12 16:18:03 +01:00
heinrich5991 a0221c3038 Fix ddnet.org change in UUIDs
One case was a ddnet.tw UUID's string being changed (but the UUID was
not), and the other case is a ddnet.tw UUID's string being changed in
one place but not in another in documentation.

Fixes the commit c479230d71.

CC #5312
2023-01-12 15:38:17 +01:00
bors[bot] a93f89c72a
Merge #6266
6266: Show current memory usage in assert too r=def- a=Jupeyy

Since it seems a rather common problem:
![image](https://user-images.githubusercontent.com/6654924/211884998-11486383-a1a2-4313-9a4c-7bfa6034164c.png)


## 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-01-11 18:53:03 +00:00
Jupeyy 69c3fa2a61 Show current memory usage in assert too 2023-01-11 19:26:04 +01:00
Jupeyy 8a8dab5611 Missing parameter in error list 2023-01-11 18:46:33 +01:00
bors[bot] 067af3abbd
Merge #6264
6264: Hand the client IP addresses to the antibot module r=def- a=heinrich5991

## 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>
2023-01-11 08:57:46 +00:00
heinrich5991 05f2c1e43f Hand the client IP addresses to the antibot module 2023-01-11 01:35:50 +01:00
Dennis Felsing c7e54d2462 Version 16.7 2023-01-10 23:47:53 +01:00
Robert Müller bbd20cde2b Add ui_smooth_scroll_time variable to adjust smooth scrolling
This variable adjusts the time for smooth scrolling of all scrollregions and listboxes in the menus and editor.

The value `0` disables smooth scrolling entirely.
2023-01-10 18:19:06 +01:00
heinrich5991 e62293e56c Remove remaining extern "C" from codebase
This might require rebuilding the antibot
2023-01-09 17:58:38 +01:00
bors[bot] 1347101a32
Merge #6249
6249: Fix DoLabelStreamed by using offsets, instead of rebuilding when x,y changes r=Robyt3 a=Jupeyy

<!-- 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: Jupeyy <jupjopjap@gmail.com>
2023-01-08 14:43:13 +00:00
bors[bot] a2737de1c5
Merge #6253
6253: Allow navigating listboxes when no item is currently selected r=Chairn a=Robyt3

It was no longer possible to navigate listboxes (e.g. the server browser) by using keyboard hotkeys when no item is currently selected due to a regression from #6240.

Additionally, it was not possible even before #6240 to start navigating the server browser with the keyboard afer manually clearing the server address input, which is now possible as well.

## 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-01-08 14:15:45 +00:00
Robert Müller 8845a15f14 Allow navigating listboxes when no item is currently selected
It was no longer possible to navigate listboxes (e.g. the server browser) by using keyboard hotkeys when no item is currently selected due to a regression from #6240.

Additionally, it was not possible even before #6240 to start navigating the server browser with the keyboard afer manually clearing the server address input, which is now possible as well.
2023-01-08 14:48:30 +01:00
Robert Müller 066768cf70 Use distinct error return codes for CSnapshotDelta::UnpackDelta
Use a different error code for every return statement, so it's easier to determine why unpacking a delta failed.

The codes are grouped by the first digit of the error code:

- `-1xx`: not enough data to read
- `-2xx`: value is invalid
- `-3xx`: could not build snapshot item
2023-01-08 14:31:07 +01:00
bors[bot] bda61e586e
Merge #6251
6251: Always assume there could potentially be a skin in serverbrowser's pl… r=def- a=Jupeyy

…ayer list

<!-- 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: Jupeyy <jupjopjap@gmail.com>
2023-01-08 13:09:11 +00:00
Jupeyy ed1af6edb9 Always assume there could potentially be a skin in serverbrowser's player list 2023-01-08 13:42:18 +01:00
Robert Müller a0d4a55023 Fix server browser selection not being updated based an address input
The selected server browser entry was not being updated anymore when the server address input is changed manually by the user or when selecting an entry in the LAN server list and then switching back to the Internet list.

Regression from #6240.
2023-01-08 11:06:57 +01:00
Jupeyy 7815be7b75 Fix DoLabelStreamed by using offsets, instead of rebuilding when x,y changes 2023-01-07 11:51:48 +01:00
bors[bot] 69931336fc
Merge #6242
6242: Add skin to serverbrowser's scoreboard r=def- a=Jupeyy

with #6240 we might get few more pixels for either flag or margin

![image](https://user-images.githubusercontent.com/6654924/211063976-4acb60ca-9a49-4d1b-b556-a82f88b28303.png)


## 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-01-07 10:29:22 +00:00
Jupeyy 1182180e23 Add skin to serverbrowser player list 2023-01-07 09:20:25 +01:00
Adrian Bunk abb1979d20 src/engine/shared/datafile.cpp: Re-add #include <base/math.h> for big endian 2023-01-07 04:38:06 +02:00
bors[bot] 73ce7598fa
Merge #6240
6240: Port `CListBox` from upstream, smooth scrolling for all lists r=def- a=Robyt3

Replace existing listbox implementations (`CMenus::UiDoListbox*` and `HandleListInputs` functions) with `CListBox` from upstream.

Reimplement additional feature that was already present in ddnet: page up/down, home and end key handling.

Affects the following lists:

- server browser
  - see screenshots for scoreboard
- server browser scoreboard
  - before:
![server-browser-scoreboard old](https://user-images.githubusercontent.com/23437060/211005067-3a08f874-bcb5-40e1-84e8-3f3e8e3133c9.png)
  - after:
![server-browser-scoreboard new](https://user-images.githubusercontent.com/23437060/211005074-5d113fd3-e541-45e6-95d1-4d7f633b4d12.png)
- server browser friends
  - before:
![server-browser-friends old](https://user-images.githubusercontent.com/23437060/211005039-13ef4bda-5be4-4be4-8561-19cde9f487aa.png)
  - after:
![server-browser-friends new](https://user-images.githubusercontent.com/23437060/211005048-d9f74d13-e93d-4a35-b848-bee0c84ea047.png)
- country / region selection popup (server browser filter)
  - before:
![country-popup old](https://user-images.githubusercontent.com/23437060/211004344-04651e63-7931-4e82-8f6b-c0afa6f0ed33.png)
  - after:
![country-popup new](https://user-images.githubusercontent.com/23437060/211004353-866f081b-2444-4184-8194-9468c15460f0.png)
- player skin list
  - before:
![player-skins old](https://user-images.githubusercontent.com/23437060/211004903-88864d5d-17d8-4b23-836a-1ae24a9f36ac.png)
  - after:
![player-skins new](https://user-images.githubusercontent.com/23437060/211004909-a096b98e-e754-4e76-94ff-571a7462ba81.png)
- player country / region list
  - before:
![player-country old](https://user-images.githubusercontent.com/23437060/211004564-fbd7320b-95b5-4d0a-9629-9e511ff70f34.png)
  - after:
![player-country new](https://user-images.githubusercontent.com/23437060/211004571-4f3e1aed-b878-4b84-aa81-fe8edbee6ebd.png)
- theme list
  - before:
![themes new](https://user-images.githubusercontent.com/23437060/211005196-0692fcd1-770f-45a3-9290-2ac1af75e097.png)
  - after:
![themes old](https://user-images.githubusercontent.com/23437060/211005187-48a4436f-df54-43de-a15e-bf4920d99c85.png)
- assets list
  - before:
![assets old](https://user-images.githubusercontent.com/23437060/211004237-41b71b0d-c030-4ea6-9c6b-7be4aae0836b.png)
  - after:
![assets new](https://user-images.githubusercontent.com/23437060/211004251-9be08d8d-4b16-487f-82cc-a40c7e17bc48.png)
- graphics resolutions list
  - before:
![resolutions-dropdown old](https://user-images.githubusercontent.com/23437060/211004941-23105a96-815e-4ee9-b39a-de24dcd9e4e3.png)
  - after:
![resolutions-dropdown new](https://user-images.githubusercontent.com/23437060/211004947-e251ff3e-ece6-4c59-b62c-39ca277461b5.png)
- dropdown menus (e.g. graphics fullscreen mode)
  - see screenshots for graphics resolutions list
- ingame player list
  - before:
![players old](https://user-images.githubusercontent.com/23437060/211004612-f79e892c-2712-4904-9f5e-8ee7909c4a56.png)
  - after:
![players new](https://user-images.githubusercontent.com/23437060/211004632-b6b73c8e-3c14-4d72-8178-a1562bf968f9.png)
  - before (low number): 
![players-few old](https://user-images.githubusercontent.com/23437060/211004760-cd82b93f-b978-484b-a893-a9af2b881848.png)
  - after (low number):
![players-few new](https://user-images.githubusercontent.com/23437060/211004768-b844a98d-19d7-4519-883d-939ca9b4ef89.png)
- vote options list
  - before:
![vote-options old](https://user-images.githubusercontent.com/23437060/211005215-e9db81f2-24f2-48cd-9293-99a957fa372b.png)
  - after:
![vote-options new](https://user-images.githubusercontent.com/23437060/211005229-e9285a12-efb3-4236-9317-377ae0daf834.png)
- kick/specvote lists
  - before:
![kick-spec-vote old](https://user-images.githubusercontent.com/23437060/211004518-d6ed6869-6dda-46a4-a83f-b370c58a5727.png)
  - after:
![kick-spec-vote new](https://user-images.githubusercontent.com/23437060/211004527-5844caf8-6983-49e6-b309-c717a26de0c9.png)
- ghost list
  - before:
![ghosts old](https://user-images.githubusercontent.com/23437060/211004481-7be7d338-77fe-499d-9fba-3721e2d00215.png)
  - after:
![ghosts new](https://user-images.githubusercontent.com/23437060/211004490-d875eaf7-9fb0-4a29-9bbd-0226c7997434.png)
- language list (in settings and in popup on first launch)
  - settings:
    - before: 
![languages-setting old](https://user-images.githubusercontent.com/23437060/211007012-85d16464-6bd6-4444-bd32-57385afeb2c6.png)
    - after:
![languages-setting new](https://user-images.githubusercontent.com/23437060/211007018-faafdb88-9a0c-4e80-9955-0871c7cc4107.png)
  - popup:
    - before:
![languages-popup old](https://user-images.githubusercontent.com/23437060/211006181-2faa36be-3a4c-467b-91c2-2b0b9ea8eed2.png)
    - after:
![languages-popup new](https://user-images.githubusercontent.com/23437060/211006210-f91234f0-9d70-44a2-902d-0c049c63b2ba.png)
- demo browser
  - before:
![demos old](https://user-images.githubusercontent.com/23437060/211004399-c0f49652-cd0d-478c-8b2b-328512d6367b.png)
  - after:
![demos new](https://user-images.githubusercontent.com/23437060/211004406-ee1d2637-4d69-4aec-ba0b-26750bb5bf44.png)
- editor file browser (saving, loading, adding images / sounds)
  - before:
![editor old](https://user-images.githubusercontent.com/23437060/211004451-1d989358-f811-42ba-834f-0344e5e3f280.png)
  - after:
![editor new](https://user-images.githubusercontent.com/23437060/211004459-12c7abc7-4cc5-4610-b7e0-dfc546754c24.png)
  - The search / filename input is also improved so navigating a filtered list works correctly by porting the logic from upstream.

There are minor changes to the visual appearance of some lists, due to changed margins.

The vertical alignment of some list item texts is improved so the text is centered vertically.

Closes #5791.

## 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-01-06 23:40:55 +00:00
bors[bot] 45557c69e3
Merge #6247
6247: Remove projectiles on team change r=def- a=Zwelf

## 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
- [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: Zwelf <zwelf@strct.cc>
2023-01-06 23:18:08 +00:00
bors[bot] f79412c59c
Merge #6244 #6245 #6246
6244: Minor base refactoring 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)


6245: Add ingame and browser buttons to copy server info to clipboard r=def- a=Robyt3

Add "Copy info" buttons to server browser and ingame menu to copy the server info of the selected/current server to the clipboard.

The margins around the server browser details are improved.

Closes #5440.

Screenshots:
- browser (old):
![browser old](https://user-images.githubusercontent.com/23437060/211093742-b877f1e2-6be0-4827-b1c8-0fd209f697aa.png)
- browser (new):
![browser new](https://user-images.githubusercontent.com/23437060/211093750-f0b3e2c2-8f95-42e1-94bf-ec8b9da4132f.png)
- ingame: 
![ingame](https://user-images.githubusercontent.com/23437060/211093736-04569b8e-96d6-40ab-a37e-8c581f2d8aea.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
- [ ] 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)


6246: Remove dead freeze code r=def- a=Zwelf

Remove unused `m_FreezeTime == -1` state

Reduces code complexity. Both `g_Config.m_SvFreezeDelay`[[1]] and `GetSwitchDelay(int Index)`[[2]] can only return non-negative numbers, therefore this is currently dead code and can be removed.

The last time it was possible to pass a negative number was removed in 561ce64666 (diff-29ffe32916052e1066eed938021aadfeb29f855d7c63d9c1ca3350aceffb79f3L1624)

[1]: c8ea372d98/src/engine/shared/config_variables.h (L213)
[2]: c8ea372d98/src/game/mapitems.h (L467)

## 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>
Co-authored-by: Zwelf <zwelf@strct.cc>
2023-01-06 22:56:49 +00:00
Zwelf 0ef312d739 Remove unused m_HookState assignments 2023-01-06 23:11:19 +01:00
Zwelf e4157a744b Remove unused m_FreezeTime == -1 state
Reduces code complexity. Both `g_Config.m_SvFreezeDelay`[[1]] and `GetSwitchDelay(int Index)`[[2]] can only return non-negative numbers, therefore this is currently dead code and can be removed.

The last time it was possible to pass a negative number was removed in 561ce64666 (diff-29ffe32916052e1066eed938021aadfeb29f855d7c63d9c1ca3350aceffb79f3L1624)

[1]: c8ea372d98/src/engine/shared/config_variables.h (L213)
[2]: c8ea372d98/src/game/mapitems.h (L467)
2023-01-06 23:09:01 +01:00
Robert Müller fc7c376738 Add ingame and browser buttons to copy server info to clipboard
Add "Copy info" buttons to server browser and ingame menu to copy the server info of the selected/current server to the clipboard.

The margins around the server browser details are improved.

Closes #5440.
2023-01-06 21:23:33 +01:00
Jupeyy 9cf82dfcbc Add warning for missing integrated CPU driver 2023-01-06 20:57:31 +01:00
Jupeyy 334b0fe757 Followup fixes for physical devices 2023-01-06 20:57:27 +01:00
Robert Müller a20fa17587 Mark math functions as constexpr when possible 2023-01-06 20:38:59 +01:00
Robert Müller 1a29a85c7e Add operator != for vec4
As an operator `==` already exists for `vec4` and the operator `!=` exists for `vec2` and `vec3` already.
2023-01-06 20:38:59 +01:00
Robert Müller 89eb05b4ed Use length and dot functions to reduce duplicate code 2023-01-06 20:38:59 +01:00
Robert Müller 2c0acb4590 Remove obsolete set_console_msg_color function declaration 2023-01-06 20:28:38 +01:00
Jupeyy fda0f5a29d Add error handling when enumerating physical devices 2023-01-06 15:11:46 +01:00
Robert Müller 91a23f00cb Port CListBox from upstream, smooth scrolling for all lists
Replace existing listbox implementations (`CMenus::UiDoListbox*` and `HandleListInputs` functions) with `CListBox` from upstream.

Reimplement additional feature that was already present in ddnet: page up/down, home and end key handling.

Affects the following lists:

- server browser
- server browser scoreboard
- server browser friends
- country / region selection popup (server browser filter)
- player skin list
- player country / region list
- theme list
- assets list
- graphics resolutions list
- dropdown menus (e.g. graphics fullscreen mode)
- ingame player list
- vote options list
- kick/specvote lists
- ghost list
- language list (in settings and in popup on first launch)
- demo browser
- editor file browser (saving, loading, adding images / sounds)
  - The search / filename input is also improved so navigating a filtered list works correctly by porting the logic from upstream.

There are minor changes to the visual appearance of some lists, due to changed margins.

The vertical alignment of some list item texts is improved so the text is centered vertically.
2023-01-06 12:46:16 +01:00
Robert Müller f79daac222 Add page up/down, home, end hotkeys to UI 2023-01-06 00:52:46 +01:00
Dennis Felsing 6a13008147 Update translations for upcoming 16.7 2023-01-05 09:39:34 +01:00
Zwelf 877ab41dd7 Remove projectiles on team change 2023-01-04 21:08:47 +01:00
bors[bot] c7192d703e
Merge #6226 #6230
6226: Remove projectiles on save and load r=def- a=Zwelf

Restructured CSaveTeam a bit, because I also needed access to CGameWorld. I don't store pointer to IGameController in CSaveTeam anymore, because we pass CSaveTeam to the database thread. If it would be accessed there, it could cause a race conditions.

## 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
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6230: For integrated and discrete GPUs always prefer what comes first in the list r=def- a=Jupeyy

fixes #6200

## 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: Zwelf <zwelf@strct.cc>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2023-01-04 18:03:11 +00:00
Jupeyy 7ca20a5873 For integrated and discrete GPUs always prefer what comes first in the list 2023-01-04 18:25:35 +01:00
Jupeyy a077c01b80 Less translations for vk errors from backend 2023-01-04 18:19:53 +01:00
bors[bot] f3fca968f1
Merge #6158
6158: Add F-DDrace gametype color r=def- a=fokkonaut

Been using this color already since a while. I'd like to keep it.

![image](https://user-images.githubusercontent.com/35420825/208289135-e8f5ba01-f487-47f2-929c-f1029ddfbab5.png)
![image](https://user-images.githubusercontent.com/35420825/208289140-2b807ef3-4b0f-4917-9485-c47977d95aa2.png)


## 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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
2023-01-04 10:26:06 +00:00
Robert Müller 21636912c0 Refactor team state unpacking 2023-01-03 23:55:26 +01:00
Zwelf 73b5d885fa Remove projectiles on save and load
Restructured CSaveTeam a bit, because I also needed access to CGameWorld. I don't store pointer to IGameController in CSaveTeam anymore, because we pass CSaveTeam to the database thread. If it would be accessed there, it could cause a race conditions.
2023-01-03 23:38:58 +01:00
Robert Müller dfe0ec3385 Restart client race demo when round is restarted 2023-01-03 23:38:37 +01:00
Robert Müller dd4e2d615b Send updated teams state to clients after resetting round 2023-01-03 22:40:03 +01:00
bors[bot] 6d3af742dd
Merge #6180
6180: Implement exact matches in search and exclude strings r=Robyt3 a=def-

Thanks to bencie for discussion

<!-- 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-01-03 18:16:03 +00:00
bors[bot] b36726bbca
Merge #6156
6156: Swap times should be per player, not per team (fixes #6155) r=Learath2 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: def <dennis@felsin9.de>
2023-01-03 15:59:25 +00:00
Robert Müller 9ea665cd69 Fix undefined demo timeline markers when recording is not stopped
When the demo recording is not stopped properly (e.g. client crashes during recording), the timeline markers and the demo length are not updated.
The length is always set to zero when starting the recording, but uninitialized memory is written for the timeline markers, which causes these demos to likely show the maximum number of markers with some markers possibly being outside the ticks that the demo contains.
This is fixed by initially setting all timeline marker data to zero when starting the recording.
2023-01-03 15:38:54 +01:00
Robert Müller c2c21298e2 Fix signed integer overflow on client input message
Swap mathematical operations to avoid multiplication by `1000`. As `time_freq()` returns the nanoseconds in a second (1e9), first dividing this number by 1000 does not lose any precision.

Also ensure that `IntendedTick` is in the valid range of ticks.

```
src/engine/server/server.cpp:1585:64: runtime error: signed integer overflow: 24185120014282423 * 1000 cannot be represented in type 'long int'
    0 0x55c165f220aa in CServer::ProcessClientPacket(CNetChunk*) src/engine/server/server.cpp:1579
    1 0x55c165f3a8d3 in CServer::PumpNetwork(bool) src/engine/server/server.cpp:2383
    2 0x55c165f51166 in CServer::Run() src/engine/server/server.cpp:2821
    3 0x55c165eb37d0 in main src/engine/server/main.cpp:191
    4 0x7f99e4c3ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    5 0x7f99e4c3ae3f in __libc_start_main_impl ../csu/libc-start.c:392
    6 0x55c165e7ab64 in _start (build-asan/DDNet-Server+0xd7ab64)
```
2023-01-03 14:10:58 +01:00
Robert Müller 706eb0d015 Remove unnecessary include in protocol, move definitions to cpp file
The include of `base/system.h` in `src/engine/shared/protocol.h` is not required and only used transitively in `teamscore.h` for `dbg_assert`.

To avoid adding back the include in `teamscore.h`, the function definitions are moved to the cpp file. Both definitions are moved for consistency.
2023-01-03 14:10:58 +01:00
Robert Müller e4b1db1b6d Fix spelling of NETMSG_AUTH_CHALLENGE constant 2023-01-03 14:10:57 +01:00
Robert Müller 25e01eb762 Add constants for minimum and maximum tick values 2023-01-03 14:10:57 +01:00
bors[bot] 29bf49ae31
Merge #6217
6217: Register application separately to specify its displayed name r=def- a=Robyt3

Follow-up from #6199.

Adding version information to the executable (#6203) doesn't result in the name being shown in the Windows settings. There is a separate registry key where applications can register a readable name.

See: https://learn.microsoft.com/en-us/windows/win32/shell/app-registration

## 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-01-02 21:55:37 +00:00
Chairn 8b3dfaf2d0 Add some more test to str_comp_filenames and restore old behavior 2023-01-02 21:20:49 +01:00
Robert Müller 179e3b1c4c Register application separately to specify its displayed name
The application itself must also be registered in a separate registry key, so its displayed name can be set.

See: https://learn.microsoft.com/en-us/windows/win32/shell/app-registration
2023-01-02 17:35:16 +01:00
Robert Müller 6e28ca6fe4 Extract method IStorage::GetBinaryPathAbsolute 2023-01-02 15:29:43 +01:00
Robert Müller a0df1ebfc0 Fix updated not being set correctly when deleting shell class 2023-01-02 15:29:43 +01:00
Robert Müller f3eeddf8bd Fix some registry keys not being closed if values are unchanged 2023-01-02 15:29:42 +01:00
bors[bot] 5282c8e2e5
Merge #6216
6216: Follow-up fix to scoreboard showing wrong best time r=Zwelf a=def-

Forgot the call in constructor in https://github.com/ddnet/ddnet/pull/6213/

Thus best time was not displayed initially. Thanks to spur for report

<!-- 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: def <dennis@felsin9.de>
2023-01-02 13:24:07 +00:00
bors[bot] b252f2e344
Merge #6199
6199: Register protocol and file extensions on client launch on Windows r=def- a=Robyt3

When launching the client on Windows, associate the protocol `ddnet` and the file extensions `.map` and `.demo` with the client executable.

See #6072.

## 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-01-02 12:58:15 +00:00
bors[bot] 5b13379d94
Merge #6202
6202: Add tool to manually ping the mastersrv r=def- a=heinrich5991

Usage example: `masterping ipv6
https://master1.ddnet.org/ddnet/15/register`.

Returns 0 on success, nonzero on failure. Note that this might report failure occasionally as it doesn't retry, UDP packets are non-reliable so they might not arrive even though the mastersrv is up.

## 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>
2023-01-02 12:32:21 +00:00
def 2a48533aa5 Follow-up fix to scoreboard showing wrong best time
Forgot the call in constructor in https://github.com/ddnet/ddnet/pull/6213/

Thus best time was not displayed initially. Thanks to spur for report
2023-01-02 12:29:11 +01:00
def 39b34bf40c Don't count (connecting) players for voting 2023-01-02 11:25:13 +01:00
bors[bot] f0d2b9ab69
Merge #6213
6213: Fix scoreboard showing wrong best time r=Zwelf a=def-

by requesting the best time again when it initially failed. This is still not perfectly accurate since a player on another server can get a better time, which will not get updated when the current server had no database problems.

As reported by thekid36 on Discord:

> The best time shown on the scoreboard on the turkish server on a
> ddmax.Next map (mapname: 42) is 30min..while the best time should be 4
> min (it's correct on ger2 server)

So the way it works is that the best time is loaded from database when loading map. Additionally it gets updated when a new finish is done. If the initial load failed, but a finish with 30 min is done on the server, we get this result

<!-- 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: def <dennis@felsin9.de>
2023-01-01 14:36:38 +00:00
def 25e371fa8a Don't load best time when already in progress 2023-01-01 12:18:29 +01:00
def 8452d8d028 Don't duplicate type in same line 2022-12-31 13:04:21 +01:00
def 694b9cd67d Fix scoreboard showing wrong best time
by requesting the best time again when it initially failed. This is
still not perfectly accurate since a player on another server can get a
better time, which will not get updated when the current server had no
database problems.

As reported by thekid36 on Discord:

> The best time shown on the scoreboard on the turkish server on a
> ddmax.Next map (mapname: 42) is 30min..while the best time should be 4
> min (it's correct on ger2 server)

So the way it works is that the best time is loaded from database when
loading map. Additionally it gets updated when a new finish is done. If
the initial load failed, but a finish with 30 min is done on the server,
we get this result
2022-12-31 12:36:03 +01:00
Robert Müller 4118074768 Fix signed integer overflow when unpacking snapshot delta
```
src/engine/shared/snapshot.cpp:219:18: runtime error: signed integer overflow: -2011501152 + -1594687485 cannot be represented in type 'int'
    0 0x5593cbc3534c in CSnapshotDelta::UndiffItem(int const*, int*, int*, int, int*) src/engine/shared/snapshot.cpp:219
    1 0x5593cbc3852d in CSnapshotDelta::UnpackDelta(CSnapshot*, CSnapshot*, void const*, int) src/engine/shared/snapshot.cpp:442
    2 0x5593cbb881a6 in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:624
    3 0x5593cbb9a907 in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1016
    4 0x5593ca9f44da in CClient::Update() src/engine/client/client.cpp:2628
    5 0x5593caa199dd in CClient::Run() src/engine/client/client.cpp:3220
    6 0x5593caa970f3 in main src/engine/client/client.cpp:4717
    7 0x7fe086d04d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    8 0x7fe086d04e3f in __libc_start_main_impl ../csu/libc-start.c:392
    9 0x5593ca55e6f4 in _start (build-demofuzz/DDNet+0x24936f4)
```
2022-12-31 12:06:31 +01:00
Robert Müller d63a7a3c84 Fix left shift of negative value when unpacking snapshot delta
```
src/engine/shared/snapshot.cpp:693:28: runtime error: left shift of negative value -1
    0 0x55cae1608071 in CSnapshotBuilder::NewItem(int, int, int) src/engine/shared/snapshot.cpp:686
    1 0x55cae1603fe0 in CSnapshotDelta::UnpackDelta(CSnapshot*, CSnapshot*, void const*, int) src/engine/shared/snapshot.cpp:390
    2 0x55cae15544c6 in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:624
    3 0x55cae1566c27 in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1016
    4 0x55cae03c07fa in CClient::Update() src/engine/client/client.cpp:2628
    5 0x55cae03e5cfd in CClient::Run() src/engine/client/client.cpp:3220
    6 0x55cae0463413 in main src/engine/client/client.cpp:4717
    7 0x7fbc7d855d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    8 0x7fbc7d855e3f in __libc_start_main_impl ../csu/libc-start.c:392
    9 0x55cadff2aa14 in _start (build-demofuzz/DDNet+0x2493a14)
```
2022-12-31 12:06:31 +01:00
bors[bot] 21b3b3b098
Merge #6207
6207: Run C++ unit tests with sanitizers (fixes #6205) r=Chairn 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

- [ ] 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: def <dennis@felsin9.de>
2022-12-30 23:28:17 +00:00
def c6339055b7 Address comment from https://github.com/ddnet/ddnet/pull/6206/
@Chairn
2022-12-31 00:16:30 +01:00
def 6691be1d90 Run unit tests with sanitizers (fixes #6205)
Also fix memory leak in Net.Ipv4AndIpv6Work

Rust tests fail to link when building in san directory, works in source
directory.
2022-12-30 23:35:22 +01:00
bors[bot] beae6b8a6b
Merge #6206
6206: Remove possible overflow in str_comp_filenames (fixes #6204) r=def- a=Chairn


## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] 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: Chairn <chairn.nq@hotmail.fr>
2022-12-30 21:25:03 +00:00
Robert Müller 6800bd90a4 Fix edge cases where demo tick seeking did not work
Instead of using hardcoded tick offsets, use the current/previous/next tick values from the demo info.

This fixes seeking the next tick not working for demos where the difference between the current and the next tick was greater than 3.
2022-12-30 21:05:46 +01:00
Zwelf e3147ce53d Simplify ninja code
Reasoning this change is correct:

* `OldPos` is set to `m_Pos` in line 260
* `m_Pos` is not modified in between line 260 and 272 (only `m_Core.m_Pos` gets modified)
* Therefore line 269 `Dir = m_Pos - OldPos` is always `vec2(0.0, 0.0)`.
* And line 271 `Center = OldPos + Dir * 0.5 = OldPos`.

So we can pass `OldPos` to `FindEntities` in line 272. Using `OldPos` here instead of `m_Pos` makes it clear, that we use the position before the move, even though `m_Pos` also still holds the old value.
2022-12-30 18:23:26 +01:00
Robert Müller a3e48bef27 Prevent temporary demo file from being deleted multiple times
Each time the client disconnected or stopped a demo, it tried to delete the previous temporary replay file, which causes an error message "could not delete file" to be shown in the console.

This is prevented by clearing the current filename of the demo recorder after deleting the file.
2022-12-30 14:20:42 +01:00
Chairn 2847d0f6d0 Added some test cases that were failing under new version 2022-12-30 01:11:57 +01:00
Chairn ed58668931 Remove possible overflow in str_comp_filenames (fixes #6204) 2022-12-30 00:29:19 +01:00
Robert Müller a61eec8f1e Add DDNet settings button to unregister protocol and file extensions
Add a button to the Miscellaneous DDNet settings to manually unregister the protocol and file extension handlers.
2022-12-29 18:03:08 +01:00
Robert Müller db3d1f19a9 Register protocol and file extensions on client launch on Windows
When launching the client on Windows, associate the protocol `ddnet` and the file extensions `.map` and `.demo` with the client executable.
2022-12-29 18:03:08 +01:00
Robert Müller 3b73107100 Add shell_unregister to delete protocol/file extension handlers
This function removes the registry keys that are created with `shell_register_protocol` and `shell_register_extension`.

According to the Microsoft documentation, only the keys for the program IDs should be deleted.
The keys that associate the file extensions with the program IDs should be kept, as Windows will automatically ignore the value if the program ID does not exist.

See: https://learn.microsoft.com/en-us/windows/win32/shell/fa-file-types#deleting-registry-information-during-uninstallation
2022-12-29 18:03:08 +01:00
Robert Müller 8a3a8974d0 Add shell_update to notify system to update shell
The `shell_update` function notifies the system when the shell needs to be updated due to a changed protocol or file association.

An output parameter is added to the `shell_register_protocol` and `shell_register_extension` functions, to determine whether the shell needs to be updated after calling the functions.
We only check whether the application path and program association were changed, instead of checking whether any key or value was changed, as this reduces the amount of necessary checks and we assume that the other values are not externally changed.

Because updating the shell is a potentially expensive operation, this should only be done when necessary and only once after registering all protocols and extensions.
2022-12-29 18:02:48 +01:00
Robert Müller 4e130a29e4 Add shell_register_extension to register file extension on Windows
This function register a file extension on Windows by creating the necessary registry keys and values.

The file extension is only registered for the current user in the registry key `HKEY_CURRENT_USER\SOFTWARE\Classes`, so admin privileges are not required.

Windows does not allow changing the default file extension handler programatically. When the user opens a file for which a new file extension handler exists, a dialog is shown that allows the user to change the default handler.
2022-12-29 18:01:42 +01:00
Robert Müller 7294ce5cf6 Add shell_register_protocol to register protocol handler on Windows
This function registers a protocol handler on Windows by creating the necessary registry keys and values.

The handler is only registered for the current user in the registry key `HKEY_CURRENT_USER\SOFTWARE\Classes`, so admin privileges are not required.
2022-12-29 18:01:40 +01:00
heinrich5991 93f0b278f9 Add tool to manually ping the mastersrv
Usage example: `masterping ipv6
https://master1.ddnet.org/ddnet/15/register`.

Returns 0 on success, nonzero on failure. Note that this might report
failure occasionally as it doesn't retry, UDP packets are non-reliable
so they might not arrive even though the mastersrv is up.
2022-12-29 12:50:24 +01:00
bors[bot] f230ad0bdc
Merge #6191
6191: Use own defines of format specifiers for MinGW (fixes #6187) r=Jupeyy a=Chairn

Counter proposition to #6188. Redefines our own specifiers

## 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: Chairn <chairn.nq@hotmail.fr>
2022-12-28 20:59:17 +00:00
bors[bot] 9631468a32
Merge #6198
6198: Log more errors in sql code r=def- a=Zwelf

Log whether deleting ranks from _backup tables fails due to locking issues in sqlite.

## 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: Zwelf <zwelf@strct.cc>
2022-12-26 16:50:21 +00:00
bors[bot] 46209376ad
Merge #6164
6164: Automatically register ddnet:// url handler on macOS r=Robyt3 a=def-

Should work automatically on first time running client.

See https://hublog.hubmed.org/archives/001154

<!-- 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>
2022-12-26 15:53:33 +00:00
Zwelf fb9e430f78 Log more errors in sql code
Log whether deleting ranks from _backup tables fails due to locking issues in sqlite.
2022-12-26 12:27:29 +01:00
Zwelf bc194a577d Fix teamranks not getting removed or moved out of _backup table 2022-12-26 11:57:03 +01:00
bors[bot] 50f83a6de6
Merge #6195
6195: Add more debug info to teamrace to figure out how duplicate ranks occur r=def- a=Zwelf

Should help with #6194. I don't have my mysql setup with me right now, so I can't check if I can find out what is going wrong. I'll see if I can do that tomorrow :)

## 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: Zwelf <zwelf@strct.cc>
2022-12-26 08:45:48 +00:00
bors[bot] 667d588e55
Merge #6179
6179: Ignore connecting players in search terms when "Filter connecting players" is on r=heinrich5991 a=def-

Thanks to bencie for reporting

<!-- 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>
2022-12-26 01:27:13 +00:00
Zwelf f5dc372d79 Add more debug info to teamrace to figure out how duplicate ranks occur 2022-12-26 01:52:43 +01:00
bors[bot] 4f02f6da97
Merge #6192
6192: Allow translations to reorder string substitutions r=Robyt3 a=heinrich5991

This is supported on Windows
(https://docs.microsoft.com/en-us/cpp/c-runtime-library/printf-p-positional-parameters) and on POSIX, so basically everywhere.

Add some tests to verify that the target system does indeed support these positional parameters.

(cherry picked from commit ddd2b93190)

## 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: heinrich5991 <heinrich5991@gmail.com>
2022-12-25 22:03:08 +00:00
heinrich5991 042f892f40 Allow translations to reorder string substitutions
This is supported on Windows
(https://docs.microsoft.com/en-us/cpp/c-runtime-library/printf-p-positional-parameters)
and on POSIX, so basically everywhere.

Add some tests to verify that the target system does indeed support
these positional parameters.

(cherry picked from commit ddd2b93190)
2022-12-25 21:45:26 +01:00
Chairn 3132c96a80 Use own defines of format specifiers for MinGW (fixes #6187) 2022-12-25 21:18:05 +01:00
def c3909d7cdb Just quiet curl warnings for now 2022-12-25 19:34:19 +01:00
Robert Müller 92567ced7b Fix issues when closing multiple editor popups at the same time
When using `UiClosePopupMenus` in a popup handler, the number of popups was first set to `0` and then decremented to `-1` due to the popup itself being closed, which causes the next popup to not open correctly and may also cause a crash due to an out-of-bounds access.

The `UiClosePopupMenus` function is adjusted so the number of open popups never goes below `0`.

Another check is added to ensure that `UI()->SetActiveItem(nullptr)` is only called when a popup is open, so the currently active item is not reset if no popup is open.

Duplicate code in `UiDoPopupMenu` is reduced by calling the `UiClosePopupMenus` function to only close the top-most popup.

This also fixes the same issue when a popup is closed by the popup handler and the escape key in the same frame, by only handling the escape key for closing the top-most popup when the popup was not already closed by the handler.

Lastly, the explicit escape key handling is removed from the event popup, as this also caused the above issue and is not necessary, as the escape key is already handled implicitly for all popups.
2022-12-24 11:57:06 +01:00
Dennis Felsing 779b44fde5 Support .demo and .map files being dragged into client
Only tested on macOS, but should work everywhere
2022-12-24 01:06:06 +01:00
Dennis Felsing bfe4ced662 Automatically register ddnet:// url handler on macOS
Works automatically on first time running client. Whenever you click on
a URL it is automatically opened in the current client, same as writing
"connect ip:port" into F1.

See https://hublog.hubmed.org/archives/001154 and
https://wiki.libsdl.org/SDL2/SDL_DropEvent
2022-12-24 00:26:35 +01:00
Dennis Felsing 68625dd370 Implement exact matches in search and exclude strings
Thanks to bencie for discussion
2022-12-23 23:25:11 +01:00
Dennis Felsing f65f2bd1d1 Ignore connecting players in search terms when "Filter connecting players" is on
Thanks to bencie for reporting
2022-12-23 15:59:46 +01:00
bors[bot] 50d0ecfda8
Merge #6177
6177: Deactivate editor hotkeys while dialog or editbox is active, fix other minor issues r=def- 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>
2022-12-23 09:22:15 +00:00
Robert Müller 4439cbd7a1 Persist AFK state of players on map change
Store AFK state of players in `CPersistentClientData` and restore it when a client is connected.

In order for this to work, `m_LastPlaytime` must be adjusted as well to ensure that the AFK state is not reset again automatically by the `AfkTimer` function.

The AFK state is encapsulated using `IsAfk` and `GetAfk`.

Closes #1966.
2022-12-23 00:13:10 +01:00
Robert Müller 6723910d38 Fix players always being considered AFK with sv_max_afk_time 0
The value `0` should disable the AFK feature, but players are initially considered as AFK, so their AFK state was never updated correctly.
2022-12-23 00:03:12 +01:00
Robert Müller b032324b55 Deactivate editor hotkeys while dialog or editbox is active
Prevent most global editor hotkeys from being used while the file dialog is open or an editbox is active, to prevent the hotkeys from interfering with the text input.

Closes #6176.
2022-12-22 23:25:53 +01:00
Robert Müller 0e476dfd70 When GUI inactive, unlock mouse and don't render popup menus
When the GUI is deactivated by pressing Tab, the popup menus were still rendered, which they shouldn't be, because they belong to the GUI.

The mouse needs to be unlocked when deactivating the GUI, because it can otherwise not be moved while the GUI is inactive.
2022-12-22 23:13:15 +01:00
Robert Müller ac592b2a54 Close editor popups when opening file dialog
As the popups would render above the file dialog, they should be closed before opening it.
2022-12-22 22:30:59 +01:00
Robert Müller 1eb600f7e0 Render bar below server browser to show loading progression
Render a slim bar below the server browser listbox to show the loading progression, instead of showing a percentage on the Refresh button, as suggested in https://github.com/ddnet/ddnet/pull/5878#issuecomment-1257227947.

The margin around the bottom status elements is removed to make more space and improve the alignment of the elements with the rest of the server browser.
2022-12-21 21:47:31 +01:00
bors[bot] 5831e761b8
Merge #6173
6173: Add README.md for the mastersrv, briefly explaining the setup r=def- a=heinrich5991

## 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: heinrich5991 <heinrich5991@gmail.com>
2022-12-21 14:15:48 +00:00
heinrich5991 7bacbb0ba7 Add README.md for the mastersrv, briefly explaining the setup 2022-12-21 13:11:57 +01:00
bors[bot] 327f7de09b
Merge #5886
5886: Send laser objects as DDNetLaser with type (fixes #5885) r=heinrich5991 a=fokkonaut

This pull request will make the server send the correct lasertype directly. The type determining based on EntitiyEx for that got removed on the clientside as it is not needed anymore when using DDNetLaser.
Also, I fixed the NetObject to accept -1 (no owner). That is important in order to be able to render the laser at full opacity for everyone.

This does not only make the color determining more consistent as before (compared to entities using EntitiyEx and shotgun/laser using DDNetLaser), but it does also make it entirely more mod-friendly. As an example in my mod I dont use EntitiyEx to save objects in the snapshot, as we still dont have an extended snapshot system, and like this we can still have colors without doubling the amount of objects.

Also, this will color the dragger beam aswell as the plasma bullets being shot by the freeze/unfreeze/explosive laser gun correctly.

This PR should get applied for the next minor update on client & server.

## 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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
2022-12-21 00:36:35 +00:00
bors[bot] c557e61dc2
Merge #6171
6171: Remove unused variable m_Force in CProjectile r=def- a=Zwelf

Simplifies the code a bit.

## 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: Zwelf <zwelf@strct.cc>
2022-12-20 10:44:07 +00:00
Zwelf de552c71ca Remove unused variable m_Force in CProjectile 2022-12-20 11:36:47 +01:00
Patiga be8f6217ce Make tileflag names consistent with automappers
Follow-up to commit a4867d29c6

- `TILEFLAG_FLIP_HORIZONTAL` -> `TILEFLAG_XFLIP`
- `TILEFLAG_FLIP_VERTICAL` -> `TILEFLAG_YFLIP`

In the previous commit, I pretty much just switched `V` and `H` and
changed the naming a little more to break further uses.
The reason was that the two flags were called counter-intuitively.
Since then, I realized that the auto mapper syntax also already faced
this issue and is already using `XFLIP` and `YFLIP`.
For more consistency and to reduce the amount of names for these flips,
these flags should also be called like that.

It also turned out that more things are connected to `V` and `H`.
Those letters are shown in the `Info` mode in the editor, and are used
extensively by the automapper community.
Switching to `X` and `Y` allows keeping backwards compatibility while
introducing more intuitive names.
2022-12-19 18:39:36 +01:00
bors[bot] 648b025906
Merge #6163
6163: Add tooltips for the buttons that open directories and files r=Jupeyy a=Robyt3

Closes #5653.

## 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>
2022-12-19 10:23:36 +00:00
Robert Müller 3780c74add Add tooltips for the buttons that open directories and files
Closes #5653.
2022-12-18 21:58:25 +01:00
Robert Müller 32ce5be301 Fix smooth zooming overshooting the target zoom level
Ensure that the zoom level with smooth zooming does not exceed the target zoom level.

Closes #3747.
2022-12-18 20:58:29 +01:00
Robert Müller 51e99b99cb Pass SDL event structure directly to handler functions
Instead of passing the generic `SDL_Event` to the handler functions and getting the specific structure inside the functions, pass the specific structure directly to the functions.
2022-12-18 12:41:54 +01:00
Robert Müller 2579f0be2f Add support for hot-plugging gamecontrollers
Handle the appropriate SDL events to open new joysticks when they are connected and remove joysticks when they are disconnected.

If the active joystick gets disconnected, then the first joystick in the list will be activated as a fallback.
If the previously activated joystick gets reconnected, it will be activated again automatically, as it is identified by the GUID stored in the configuration.
The stored joystick GUID is only updated when the user manually selects a new joystick in the controls settings or with the console.

Closes #6152.
2022-12-18 12:41:17 +01:00
fokkonaut 6e683dd210 Add F-DDrace gametype color 2022-12-18 09:44:05 +01:00
def bd815a0507 Swap times should be per player, not per team (fixes #6155) 2022-12-18 00:01:04 +01:00
Robert Müller 1eaa88b236 Handle ordinal joystick hat keys as combined cardinal hat keys
Instead of considering diagonal hat inputs (e.g. up-left) as separate keys, consider them as inputs for both cardinal directions (e.g. up and left) at the same time.

This improves input with gamecontrollers that map the D-Pad to a joystick hat, as it was impossible with the previous handling to move with hat-left/right and jump with hat-up at the same time.

This means that diagonal hat buttons can no longer be used in binds, because they are no longer considered distinct buttons. It's unlikely that they would ever be useful in this game, as real joystick POV hats would not be used anyway.

Closes #6120.
2022-12-17 17:18:01 +01:00
Robert Müller ab91aefad4 Use different variables for tiles indices
Make the code more readable and less error-prone, by using different variables for the tile indices instead of reusing the same variable.
2022-12-17 12:17:59 +01:00
Robert Müller 39217e10a9 Use const pointers and static_cast for tile data 2022-12-17 12:17:59 +01:00
Robert Müller b82ec33921 Pass x and y to OnEntity instead Pos
Calculate `Pos` in `OnEntity` based on `x` and `y` instead of passing `Pos` and calculating `x` and `y` from that.
This removes duplicate code and makes it easier to understand.
2022-12-17 12:17:58 +01:00
Robert Müller 843b6c5bff Replace return value with assertion
All calls to `OnEntity` already ensure that `Index` will not be negative.
2022-12-17 12:17:58 +01:00
Robert Müller 1fffd9f8c6 Recreate all entities when restarting round
When restarting a round (i.e. with the `restart` command, with the `sv_warmup` option, and after a round ends) some entities where permanently destroyed and others were kept around.

This is changed so all entities are destroyed and then recreated, so rounds can be properly restarted.

Closes #6128.
2022-12-17 12:17:58 +01:00
Robert Müller 13b181c03a Fix server crash on maps with more than 64 spawn points of same type
Using more than 64 spawn points of the same type causes out-of-bounds accesses, as the number of spawn points is not checked before adding a spawn point and the existing check that limits the number of spawn points after adding one contains an off-by-one error.

For neutral and red spawn points this caused the last spawn point to be added for the following team instead. For blue spawn points this caused a server crash.

This is fixed by allowing an arbitrary number of spawn points of all types, by using an `std::vector` instead of an array.
2022-12-17 12:17:58 +01:00
Robert Müller d8f0678958 Use bool instead of int 2022-12-17 11:36:29 +01:00
Robert Müller 4aeccff6f4 Move variable declarations closer to usages 2022-12-17 11:36:29 +01:00
Robert Müller 6d3baed69d Remove dead code 2022-12-17 11:36:29 +01:00
Dennis Felsing a59613e56f Use %zu formatter for size_t, not PRIu64 (which is for uint64_t) 2022-12-16 16:40:10 +01:00
bors[bot] 3f73b816d9
Merge #6143
6143: Add separate `ed_limit_max_zoom_level` for editor, fix editor smooth zooming when joining/reloading game  r=def- 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>
2022-12-15 18:19:54 +00:00
bors[bot] 2d57e0455a
Merge #6142
6142: Adjust no weak prediction to updated server code r=def- a=Jupeyy

Tho i didnt see a wrong prediction with hook which probably makes sense, it probs only affects weapons, as thats the main part the server code was updated for

## 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>
2022-12-15 17:45:50 +00:00
Jupeyy 19928aabd2 Adjust no weak prediction to updated server code 2022-12-15 18:36:29 +01:00
Robert Müller a0553f2d40 Fix editor smooth zooming when joining/reloading game
Using `IClient::LocalTime` for smooth zooming in the editor causes the zoom to behave incorrectly when joining a game, as the local time is reset when joining a game.
This is fixed by adding a separate `IClient::GlobalTime` which is only set once when the client launches and never resets.
2022-12-15 18:18:06 +01:00
Robert Müller 612ef8358c Add separate ed_limit_max_zoom_level for editor
To completely separate zoom settings between ingame and editor.
2022-12-15 17:59:46 +01:00
bors[bot] 75d07350f6
Merge #6133
6133: Remove spammy log (thanks Skeith) r=Chairn 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

- [ ] 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>
2022-12-14 16:51:51 +00:00
Dennis Felsing d5cf3630ae Remove spammy log (thanks Skeith) 2022-12-14 17:39:18 +01:00
Patiga a4867d29c6 Make tileflag names consistent and intuitive
- `TILEFLAG_VFLIP` -> `TILEFLAG_FLIP_HORIZONTAL`
- `TILEFLAG_HFLIP` -> `TILEFLAG_FLIP_VERTICAL`

According to the native editor, the "Tiled" editor and image search, a
horizontal flip should be associated with switching left and right, modifying
the x coordinate.

I did not just switch the letters `H` and `V` to create compiler errors
where the original constants are used.

Whenever I was working with tileflags, the naming caused me to have no
idea what I was doing. I mostly had to resort to opening the resulting
map in the editor to see what the code does. This change aims to make
the naming intuitive and also consistent with the map editor.
2022-12-14 13:54:11 +01:00
Jupeyy 5341fc37fd Minimal changes to default to Vulkan 2022-12-13 19:37:03 +01:00
Jupeyy 870ea8566e Improve error handling in vulkan
so it doesn't assert & shows a message box with the error and some tips
2022-12-13 18:11:26 +01:00
Jupeyy dff876d58c Add Localizable hint 2022-12-13 17:53:32 +01:00
Dennis Felsing 412a9461c0 Fix conflict resolution between #6013 and #5948
Thanks @Robyt3 for noticing
2022-12-12 14:13:32 +01:00
Dennis Felsing fe4a8441bf Version 16.6 2022-12-11 23:05:33 +01:00
bors[bot] c96310464e
Merge #6119
6119: Fix client attempting to delete user directory when stopping replay demo r=Chairn a=Robyt3

When the client stops a replay demo and tries to remove the temporary file when being disconnected, it's not checked whether a recording of a replay demo has ever been started. In this case the filename is empty, which leads to the client trying to delete the user's directory, which will fail with an error message, as it's a folder and cannot be deleted with the function designed for deleting files.

This is fixed by calling the function `DemoRecorder_Stop` to delete the temporary demo file, as this function already makes sure that the filename is not empty.

## 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>
2022-12-11 14:43:51 +00:00
Robert Müller 144a69266c Fix client attempting to delete user directory when stopping replay demo
When the client stops a replay demo and tries to remove the temporary file when being disconnected, it's not checked whether a recording of a replay demo has ever been started.
In this case the filename is empty, which leads to the client trying to delete the user's directory, which will fail with an error message, as it's a folder and cannot be deleted with the function designed for deleting files.

This is fixed by calling the function `DemoRecorder_Stop` to delete the temporary demo file, as this function already makes sure that the filename is not empty.
2022-12-11 15:05:31 +01:00
bors[bot] 4695a6b0f1
Merge #6118
6118: Copy the demo timeline markers when slicing a demo r=def- a=Robyt3

When slicing a demo, also copy the demo markers that are within the sliced segment to the new demo.

This also fixes timeline markers not being added to replay demos, as the replay demos are always created by slicing.

Closes #6116.

## 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>
2022-12-11 13:55:50 +00:00
Robert Müller 7958b999a3 Copy the demo timeline markers when slicing a demo
When slicing a demo, also copy the demo markers that are within the sliced segment to the new demo.

This also fixes timeline markers not being added to replay demos, as the replay demos are always created by slicing.

Closes #6116.
2022-12-11 14:34:21 +01:00
Robert Müller 71139f33f0 Add separate option for smooth zooming in editor
Add `ed_smooth_zoom_time` option for smooth zooming in editor separate from the `cl_smooth_zoom_time` that's used for smooth zooming ingame, as some mappers seem to prefer unsmooth zooming in the editor but smooth zooming ingame.
2022-12-11 13:14:55 +01:00
bors[bot] 63187f565f
Merge #6111
6111: Fix updating teamranks r=def- a=Zwelf

Fixes #6107

## 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: Zwelf <zwelf@strct.cc>
2022-12-10 12:59:27 +00:00
Zwelf b7205f5ef5 Fix updating teamranks 2022-12-10 00:51:16 +01:00
bors[bot] 5290193f1f
Merge #6110
6110: Remove successful queries from write backup r=def- a=Zwelf

Fixes #6106

Seems like I didn't tested before whether the rank got removed in the successful path.

## 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: Zwelf <zwelf@strct.cc>
2022-12-09 23:22:44 +00:00
bors[bot] f8330950ef
Merge #6109
6109: Add button that tells you how to save power r=heinrich5991 a=def-

![Screenshot 2022-12-08 at 23 09 20](https://user-images.githubusercontent.com/2335377/206578008-d4e9be56-4aab-40eb-bb55-6b087f930888.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
- [ ] 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>
2022-12-09 22:47:30 +00:00
bors[bot] ebe9024a66
Merge #6051
6051: Null-terminate string returned by mysql r=Zwelf a=def-

Found in #6050 that a 16 byte long name would be written, filling up the string entirely, no terminating '\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)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-12-09 21:58:45 +00:00
Zwelf 9f1bbbe63b Remove successful queries from write backup 2022-12-09 20:06:14 +01:00
Dennis Felsing 7c46b5190b Add button that tells you how to save power 2022-12-08 23:10:02 +01:00
NouaaTW 0bc4e7601e Colorify BW gamemode 2022-12-07 19:29:40 +01:00
bors[bot] 3438e272af
Merge #6101
6101: Remove check for `pResponseToken`, which isn't used on this code path r=def- a=Robyt3

Closes #6100.

## 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>
2022-12-06 20:01:41 +00:00
Robert Müller 9bc0028b94 Remove check for pResponseToken, which isn't used on this code path
Closes #6100.
2022-12-06 20:37:59 +01:00
Robert Müller 0b3dad8dcd Reduce duplicate code by extracting CEditor::SnapToGrid 2022-12-06 20:18:08 +01:00
Robert Müller 7e1fc0344e Reduce duplicate code by extracting CNetBan::CBanPool::InsertUsed 2022-12-06 20:18:08 +01:00
Dennis Felsing b04cdacaeb Bump friends limit from 1024 to 4096 (fixes #6096) 2022-12-06 10:31:43 +01:00
Robert Müller 57d5c5a3d5 Use for-each loop instead of for-loop 2022-12-05 23:15:35 +01:00
Robert Müller 6d8fad775d Encapsulate m_ResortServerBrowser inside CServerBrowser
The variable `m_ResortServerBrowser` was only used in the client to pass it to the server browser. For better separation of concerns, this variable is moved inside `CServerBrowser` and the function `RequestResort` should be called to set it to `true`.

The existing variable `m_SortOnNextUpdate` is replaced with this, as it served the same purpose already. The variable name from upstream is used to reduce conflicts.
2022-12-05 23:15:35 +01:00
Robert Müller d0635246c8 Remove unused m_NeedRefresh variable 2022-12-05 23:13:06 +01:00
Robert Müller a6e0e37c4a Use consistent system name serverbrowser for log messages 2022-12-05 23:13:06 +01:00
Robert Müller 0c8aac6f05 Remove unnecessary MatchFound variable
This variable is always `1` when `m_ppServerlist[i]->m_Info.m_QuickSearchHit` is not `0`.
2022-12-05 23:13:02 +01:00
Robert Müller cbf08b0025 Change type of Filtered from int to bool 2022-12-05 23:12:28 +01:00
Robert Müller 1051a935a0 Use nullptr, '\0' and false instead of 0 2022-12-05 22:28:23 +01:00
Robert Müller c72861fb6d Rename class SortWrap to CSortWrap 2022-12-05 22:27:28 +01:00