Commit graph

12391 commits

Author SHA1 Message Date
Robert Müller b67a1f5ce5 Add fs_is_file to check if a given path is file 2023-01-22 17:22:11 +01:00
Robert Müller 7e9129cb44 Use doxygen style for all fs_* functions 2023-01-22 17:14:04 +01:00
Robert Müller 29b61fc438 Refactor CEditor:::PopupLayer, remove CEditor::IsSpecialLayer
- Use `pCurrentLayer` instead of `pEditor->GetSelectedLayer(0)` everywhere.
- Remove unnecessary null-checks of `pCurrentLayer`.
- Use `CLayer::IsEntitiesLayer` instead of `CEditor::IsSpecialLayer` and remove the latter function.
- Restructure UI layout code and variables.
2023-01-22 11:58:37 +01:00
Robert Müller c7819841f8 Remove dead code, update documentation for LAYERTYPE_GAME
This layer type was never used when saving maps.
Game layers were always identified by their flags.
In any case the check in the popup handler is unnecessary, as the group property cannot be changed for game layers, so this code is never used.
2023-01-22 11:58:37 +01:00
Robert Müller 50ecfb178f Add CLayer::IsEntitiesLayer to reduce duplicate code 2023-01-22 11:58:30 +01:00
bors[bot] cd13871053
Merge #6215
6215: Don't count (connecting) players for voting r=Robyt3 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>
2023-01-21 12:41:02 +00: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
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