Commit graph

12011 commits

Author SHA1 Message Date
Robert Müller 130275a7b2 Refactor editor automapper config list using CScrollRegion
- Fix the currently selected item not being highlighted after opening the dialog.
- Remove static limit of 255 automapper rules, after which the editor previously caused out-of-bounds accesses, by using the address of the automapper config name as button ID.
2022-09-03 16:41:31 +02:00
Robert Müller 1c23a17ee4 Fix hotkeys (scroll regions) not working in editor 2022-09-02 23:16:37 +02:00
bors[bot] cc7fbe275c
Merge #5798
5798: Remove all references to memset r=def- a=heinrich5991

`memset` only worked with `CServer::CClient::STATE_EMPTY` by chance
because it is defined as 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: heinrich5991 <heinrich5991@gmail.com>
2022-09-02 12:57:54 +00:00
heinrich5991 887b24d8f5 Remove all references to memset
`memset` only worked with `CServer::CClient::STATE_EMPTY` by chance
because it is defined as 0.
2022-09-02 14:32:39 +02:00
bors[bot] cbb61814df
Merge #5722
5722: First send message to team, then kill team (fixes #5721) r=heinrich5991 a=def-

![Screenshot 2022-08-10 at 15 54 13](https://user-images.githubusercontent.com/2335377/183919209-a5fb95e6-d578-4376-9fb6-a72d0381001c.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-09-02 11:14:42 +00:00
Robert Müller e7c3ce186f Port CUI::ConsumeHotkey from upstream
Move hotkey/input handling from `CMenus` to `CUI`.

Using the `ConsumeHotkey` method ensures that each hotkey is only handled once.

By also handling the mouse scroll wheel as hotkeys, this fixes the scroll keys activating scroll regions while the controls binder is active.
2022-08-31 21:43:57 +02:00
bors[bot] 59db32e9c2
Merge #5763
5763: Fix png error handling by setting jmpbuf r=def- a=Jupeyy

else libpng will kill the thread on an error bcs it's a fatal error.

broken skin can be found in discord bugs channel weeb_okayu

## 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-08-31 08:57:02 +00:00
Robert Müller fe38caa7b4 Handle path/link arguments using the console argument parser
Add `IConsole::SetUnknownCommandCallback` to set a callback for unknown commands. The callback is used to handle connect links, .demo and .map files when parsing command line arguments.

This will allow paths/links to be passed at any argument position instead of only the first one.

And this fixes the command `play xyz.demo` not working due to `play ` being considered part of the path.
2022-08-30 22:17:04 +02:00
Robert Müller 13961db6a8 Allow demo/map arguments to be relative paths, allow using play
When passing .demo or .map paths as command line arguments, first check if the path can be found in the storage and then try resolving an absolute path.

Also delay execution of the `play` command until the client is ready so the command can be used from the command line. Although it doesn't work if there is only one argument, as this interferes with the .demo file handling.
2022-08-30 21:51:34 +02:00
def 91bc21c489 No need for lengthy semaphore names on macOS, pointer address is enough
Also check on init failure and at least log, same as on UNIX
2022-08-30 10:09:35 +02:00
def c479230d71 Use new ddnet.org domain 2022-08-30 10:09:06 +02:00
bors[bot] 3478146ea5
Merge #5784
5784: Suppress more events while skipping in demos, reset specifics components before long skips in demo r=def- a=Robyt3

Closes #5779.

## 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-08-29 21:47:28 +00:00
Jupeyy d2295ff94e refind skins after reload 2022-08-29 18:28:59 +02:00
bors[bot] 3e42d3df5a
Merge #5787
5787: Allow spectator mode to be changed while demo is paused r=def- a=Robyt3

By updating and rendering the current tick again when changing the spectator mode while the demo playback is paused. Closes #1843.

Refactoring: Extract `IDemoPlayer::ETickOffset`, `IDemoPlayer::SeekTick` and `CMenus::DemoSeekTick`.

## 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-08-28 18:01:55 +00:00
Robert Müller c6cc45471a Allow spectator mode to be changed while demo is paused
By updating and rendering the current tick again when changing the spectator mode while the demo playback is paused.

Refactoring: Extract `IDemoPlayer::ETickOffset`, `IDemoPlayer::SeekTick` and `CMenus::DemoSeekTick`.
2022-08-28 17:52:49 +02:00
Zwelf 6382f5b5d5 Clarify save message on team member in '/spec' mode 2022-08-28 17:37:23 +02:00
Robert Müller c0472b3177 Reset specific components before long skips in demo
Only reset what has to be reset instead of using `CGameClient::OnReset`, which would reset a lot more and cause other issues (client freezing while skipping) that would first need to be solved.
2022-08-28 15:39:30 +02:00
Robert Müller b2fbfac4d1 Suppress more events while skipping in demos:
- chat messages
- kill messages
- sounds
- stats
- air jump effects
2022-08-28 15:20:50 +02:00
Robert Müller 1da597ff1a Fix automatic demo rewind not working when menu is not active 2022-08-28 12:26:20 +02:00
Robert Müller 3dc577f24e Fix demo seeking not working anymore when menu is not active 2022-08-28 12:23:03 +02:00
Robert Müller 7cbca53d48 Deactivate "Follow" spectator mode in global server demos
As there is no spectator to follow, the follow mode does not work in global server demos.

Player server demos are unaffected and support the follow mode.
2022-08-27 17:48:04 +02:00
Robert Müller 939b3e5538 Fix free-view button state when following a free-view spectator
When following a spectator that is using free-view mode, the free-view button was active at the same time as the follow button.
2022-08-27 17:45:56 +02:00
bors[bot] 8ac260a3a9
Merge #5777
5777: Add period/comma hotkeys to skip one tick forward/backward, various other improvements to demo skipping r=Jupeyy a=Robyt3

Mostly from upstream https://github.com/teeworlds/teeworlds/pull/2904, with some more fixes and refactorings.

## 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: Robert Müller <robytemueller@gmail.com>
2022-08-27 12:40:09 +00:00
bors[bot] b42627f807
Merge #5748
5748: Remove the need for sprite icon images; update Icons file r=Jupeyy a=VoxelDoesCode

It felt like that it was very unoptimized to have two images for the demo buttons. Initially, I wanted to merge it into one image, but it was a much better choice to have it so that we use the Icons font file for the sprites instead. Turns out, considering how the typeface is rendered, it looks much smoother and crisper. The contrast between the squares and the symbols is much clearer alongside!

Before the change:
![unknown](https://user-images.githubusercontent.com/95713843/185066728-45b6c5d7-00c5-4e03-9f89-4dfc89df6ec1.png)
After the change:
![unknown](https://user-images.githubusercontent.com/95713843/185066759-bd5f8169-7e9e-488d-9af7-0ab34bff9d54.png)

Note that there is a few compromises that had to be made with the limited symbol choices. As of publishing this there is not a symbol for a crossed out keyboard, but I hope the eye works just fine for now.


## 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
- [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: VoxelDoesCode <bluheadcat@gmail.com>
2022-08-27 12:24:36 +00:00
Robert Müller a24ac108ce Always suppress events and update envelopes when skipping 2022-08-27 13:23:06 +02:00
Robert Müller bf16875a6f Add period/comma hotkeys to skip one tick forward/backward 2022-08-27 12:49:32 +02:00
Robert Müller 76cefa1c85 Faster and more precise demo skipping
- Approximate index of wanted keyframe to decrease linear search time.
- Only apply the magic `-5` to the Keyframe calculation, to make seeking with the mouse more accurate.
- After the method returns, the specified tick will be the _next_ tick being played instead of being the current tick.
2022-08-27 12:49:32 +02:00
Robert Müller 334bdad922 Fix demo intratick times not being updated when paused 2022-08-27 12:49:32 +02:00
Robert Müller 3ec4075ddb Move variable declarations closer to usages 2022-08-27 12:49:32 +02:00
Robert Müller d6628fe028 Rename variable LastSpeedChange to s_LastSpeedChange 2022-08-27 12:49:32 +02:00
Robert Müller 091f3b3e34 Rename variable PrevAmount to s_PrevAmount 2022-08-27 12:49:32 +02:00
Robert Müller 6f101f54af Rename method CDemoPlayer::time to Time 2022-08-27 12:49:32 +02:00
Robert Müller 64f326d626 Remove unused CDemoPlayer::NextFrame method 2022-08-27 11:39:03 +02:00
VoxelDoesCode 20e70b3172 Demo Tooltips, in courtesy of Chairn 2022-08-26 02:07:58 -04:00
VoxelDoesCode 0392f6655d Added an icon for Parent Directories 2022-08-25 18:44:27 -04:00
Robert Müller d369a5b693 Write messages to all active demo recorders 2022-08-25 17:57:04 +02:00
Robert Müller 63d0c8e170 Improve error message when map for demo cannot be found
Previously the playback did not start and no error messages was shown, when the map file cannot be found and no map data is embedded in the demo file.

Minor refactoring: Replace instances of `return pError` with semantically identical `return nullptr` to improve readability.
2022-08-25 17:57:04 +02:00
Robert Müller 3f1b702b90 Fix demos recorded without mapdata not being loadable
As the demo player skips the map data when loading the demo, the size of the map specified in the demo must be zero when no map data is embedded.
2022-08-25 17:57:04 +02:00
Robert Müller 5c2f162da2 Remove unused DemoRecorder_IsRecording method 2022-08-25 17:57:03 +02:00
Robert Müller 8d3351f046 Also record tunings for player demos 2022-08-25 17:57:03 +02:00
Robert Müller c7ddb0ac47 Pad player demo filename with zeros instead of spaces 2022-08-25 17:57:03 +02:00
Dennis Felsing 2ccca3a50a Fix memset compilation
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp: In function ‘int InsertPixelArtQuads(CQuad*, int&, const CImageInfo&, const int*, const int*, const bool*)’:
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:110:9: error: ‘memset’ was not declared in this scope
  110 |         memset(aVisitedPixels, 0, sizeof(bool) * Img.m_Height * Img.m_Width);
      |         ^~~~~~
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:8:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    7 | #include <game/mapitems.h>
  +++ |+#include <cstring>
    8 |
2022-08-25 14:07:49 +02:00
VoxelDoesCode 216d4421ce Clang Format 2022-08-24 16:17:04 -04:00
“sctt” ff2c513ddc removed debug 2022-08-23 19:42:29 +02:00
“sctt” f066cca33a CICD fixes 2 for map_create_pixelart 2022-08-23 19:40:13 +02:00
“sctt” cb9680eaff Merge branch 'master' of https://github.com/sctt/ddnet 2022-08-23 19:17:19 +02:00
“sctt” 4013c0f68a CICD fixes for map_create_pixelart 2022-08-23 19:14:42 +02:00
sctt 9101a4f5ce
Merge branch 'ddnet:master' into master 2022-08-23 18:13:50 +02:00
“sctt” 0f14d76a69 Added map_create_pixelart tool 2022-08-23 18:12:15 +02:00
Robert Müller 638559b648 Refactor scrollable controls settings using CScrollRegion
Replace hacky usage of `UiDoListboxStart` with `CScrollRegion`.
2022-08-23 10:08:46 +02:00
Robert Müller 7c496dd5b4 Make ingame server info MOTD scrollable using CScrollRegion 2022-08-23 10:08:46 +02:00
Robert Müller 713b6584f0 Add str_countchr to count occurrences of a char in a string 2022-08-23 10:08:46 +02:00
Robert Müller 359beffff3 Refactor editor sound list using CScrollRegion 2022-08-23 10:08:46 +02:00
Robert Müller 5dc6c90a50 Refactor editor image list using CScrollRegion, split method 2022-08-23 10:08:45 +02:00
Robert Müller 9f01c6fe66 Refactor editor layer list using CScrollRegion 2022-08-23 10:08:45 +02:00
Robert Müller ad8f49fe79 Remove unnecessary indentation/scope 2022-08-23 10:08:42 +02:00
Robert Müller 4cdd36aed3 Remove redundant m_GuiActive checks
This condition is already checked before calling the methods.
2022-08-23 10:01:29 +02:00
Robert Müller 7b80ad1982 Refactor editor layer image selection popup using CScrollRegion
The width of the popup and list are also slightly increased to better support images with longer names.
2022-08-23 10:01:28 +02:00
Robert Müller f451a33361 Port CScrollRegion from upstream with some minor refactorings
Co-authored-by: LordSk <lordskelethom@gmail.com>
2022-08-23 10:01:28 +02:00
Robert Müller 9cbca642ea Rename CUIElement::Get to Rect
This makes it clear that the method is a getter for the rects.
2022-08-23 10:01:27 +02:00
Robert Müller 991b045a11 Remove unused CUIElement::m_ElementTime 2022-08-23 10:01:26 +02:00
bors[bot] 49bed71932
Merge #5696
5696: Add option for parallax-aware zoom r=def- a=Fireball-Teeworlds

## How this works

Currently we have parallax X and Y parameters that control how far away a layer feels. Currently it's only taken into account for camera moving sideways.

This pull request makes zoom behave as if the camera was moving closer or further away, taking into account the distance to the layer.

In order to provide flexibility, this behaviour is using a separate parallax value, similar to how we have separate values for X and Y. Para Zoom will default to the minimum of parallax X, Y, clamped to be between 0 and 100. This seems to look well on most maps.

This pull request also introduces two new features to the Editor:
* Controls for configuring per-group Para Zoom value. If Custom Zoom is set to No, Para Zoom will automatically keep following to the default value described above, so that people new to the feature don't have to figure out how it works.
* Zoom button that previews the zoom behavior (next to Proof at the top).

## Editor Screenshots

### Para Zoom controls

![screenshot_2022-08-22_21-38-04](https://user-images.githubusercontent.com/68162181/186014490-f7b91245-460f-405f-8d5c-3f91db2a1b9a.png)

![screenshot_2022-08-22_21-37-58](https://user-images.githubusercontent.com/68162181/186014522-03b6e814-4dd9-4d07-9af9-7db5fb434a56.png)

### Zoom Button

![screenshot_2022-08-22_21-40-46](https://user-images.githubusercontent.com/68162181/186014856-2d1d499d-9011-439c-b217-536957e0c1e3.png)

![screenshot_2022-08-22_21-40-50](https://user-images.githubusercontent.com/68162181/186014874-6d2939d3-00ff-4327-a790-414b5151ba31.png)

## In-Game Screenshots

Video: https://youtu.be/W7eXQN0gRFI

This is an older version of the pull request that had an option to disable the new behaviour. The current version can only be disabled in map editor for a particular map.

### Springlobe 3

With new feature:
![screenshot_2022-08-02_04-28-19](https://user-images.githubusercontent.com/68162181/182286371-b67cee1c-73d8-4a24-a9c3-1b28340a3b42.png)

Without:
![screenshot_2022-08-02_04-28-25](https://user-images.githubusercontent.com/68162181/182286367-24555381-1700-4ff1-80c7-39e5dce63820.png)

### Beyond Dreams

With new feature:
![screenshot_2022-08-02_04-28-59](https://user-images.githubusercontent.com/68162181/182286322-114ecb90-0860-462c-9012-bb2f3ff848fb.png)

Without:
![screenshot_2022-08-02_04-28-55](https://user-images.githubusercontent.com/68162181/182286654-f34da72b-7991-4f42-89ad-679279fcb83e.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [X] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [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: Fireball <fireball.teeworlds@gmail.com>
2022-08-22 21:15:41 +00:00
Jupeyy dfaf3591c2 Fix png error handling by setting jmpbuf, else libpng will kill the thread 2022-08-22 17:47:28 +02:00
Dennis Felsing 83d26ff48c Version 16.3.1 2022-08-22 15:42:34 +02:00
bors[bot] 7765171559
Merge #5733
5733: Added map_find_env tool r=def- a=sctt


a simple tool which given an envelope id returns a list of all quads associated with that envelope, screenshot attached below.
![Screenshot from 2022-08-13 18-48-41](https://user-images.githubusercontent.com/3328841/184503762-521ff3c7-2c0f-47df-a0e6-e4b30f2826ec.png)

p.s.
deen told me its not a problem to commit these kind of map tools to ddnet

Co-authored-by: sctt <scottistefano91@gmail.com>
2022-08-22 09:07:40 +00:00
bors[bot] d2523d9053
Merge #5761
5761: Replace `POPUP_PURE` with generic `PopupMessage` r=def- a=Robyt3

Minor refactoring, as the popup just shows generic text with an Ok-button.

## 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-08-21 15:02:55 +00:00
def 13cc5d08d9 Version 16.3 2022-08-21 17:00:23 +02:00
Robert Müller d3c9311156 Replace POPUP_PURE with generic PopupMessage 2022-08-21 13:25:06 +02:00
bors[bot] f355a3467f
Merge #5760
5760: Fix variable shadow warnings with MinGW r=def- a=Robyt3

```
ddnet/src/base/system.cpp: In function 'int byteval(const char*, unsigned char*)':
ddnet/src/base/system.cpp:3044:32: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3044 | static int byteval(const char *byte, unsigned char *dst)
      |                    ~~~~~~~~~~~~^~~~
In file included from msys64/mingw64/include/objbase.h:8,
                 from ddnet/src/base/system.cpp:68:
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'unsigned char str_byte_next(const char**)':
ddnet/src/base/system.cpp:3557:23: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3557 |         unsigned char byte = **ptr;
      |                       ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'int str_utf8_decode(const char**)':
ddnet/src/base/system.cpp:3577:31: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3577 |                 unsigned char byte = str_byte_next(ptr);
      |                               ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
```

<!-- What is the motivation for the changes of this 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: Robert Müller <robytemueller@gmail.com>
2022-08-21 09:08:57 +00:00
Robert Müller 64042d29df Fix variable shadow warnings with MinGW
```
ddnet/src/base/system.cpp: In function 'int byteval(const char*, unsigned char*)':
ddnet/src/base/system.cpp:3044:32: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3044 | static int byteval(const char *byte, unsigned char *dst)
      |                    ~~~~~~~~~~~~^~~~
In file included from msys64/mingw64/include/objbase.h:8,
                 from ddnet/src/base/system.cpp:68:
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'unsigned char str_byte_next(const char**)':
ddnet/src/base/system.cpp:3557:23: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3557 |         unsigned char byte = **ptr;
      |                       ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'int str_utf8_decode(const char**)':
ddnet/src/base/system.cpp:3577:31: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3577 |                 unsigned char byte = str_byte_next(ptr);
      |                               ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
```
2022-08-21 10:44:08 +02:00
Robert Müller 37cadc5c09 Add CWindowsComLifecycle RAII wrapper for Windows COM library 2022-08-21 10:34:37 +02:00
bors[bot] 4fc6a5b924
Merge #5754 #5757
5754: Auto refresh skins when changing related settings r=def- a=Jupeyy

motivation: downloaded skins aren't resettet, e.g. if they failed before. config change -> resets everything

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


5757: Make file link absolute, add `fs_is_relative_path` r=def- a=Robyt3

This fixes links not opening for relative paths, as links like `file://temp/skins` cannot be resolved by the shell.

Closes #5746.

## Checklist

- [X] Tested the change ingame (only on Windows)
- [ ] 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>
Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-08-20 20:34:45 +00:00
Corantin H d81f15181e Use int for coordinates 2022-08-20 22:30:32 +02:00
Robert Müller 21fe945ca7 Make file link absolute, add fs_is_relative_path
This fixes links not opening for relative paths, as links like `file://temp/skins` cannot be resolved by the shell.
2022-08-20 20:56:46 +02:00
Corantin H ae8b9914aa Editor: added a goto button 2022-08-20 20:47:46 +02:00
Robert Müller ec55212c52 Fix symlink handling of fs_listdir
On Windows, the check was incorrectly using logical or instead of bitwise or. Checking for the flag `FILE_ATTRIBUTE_REPARSE_POINT` is not necessary, as the `FILE_ATTRIBUTE_DIRECTORY` will correctly be set when the target of a symbolic link is a directory. This otherwise causes symbolic links to files to be incorrectly handled as directories.

On Linux, the minor performance optimization of using `entry->d_type` is reverted and `fs_is_dir` is used instead. This internally uses `stat`, which correctly returns the attributes for the symbolic link targets.
2022-08-20 15:57:43 +02:00
Jupeyy 6e5c5cba8f Filter vanilla only skins at loading already 2022-08-20 14:39:25 +02:00
Jupeyy d1b8d53619 Auto refresh skins when changing related settings 2022-08-20 13:42:28 +02:00
bors[bot] 6a5d99daf1
Merge #5749
5749: Editor: added the possibility to duplicate layers r=def- a=archimede67

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

Suggested by Pulsar a few years ago, I finally had the motivation to do it. We can now duplicate any non-special layer (tiles, quads and sounds) thanks to a button just above the delete button.

![image](https://user-images.githubusercontent.com/13364635/185260070-cd5b4c8f-5827-457c-b505-176751003dbc.png)

For each duplicated layers, all the necessary properties are duplicated, for example name, color, flags, etc.
For a tile layer, all the placed tiles are copied. Same goes for a sound layer, all sources are copied. And for the quads layer, all the quads are duplicated.

## Checklist

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


Co-authored-by: Corantin H <archi0670@gmail.com>
2022-08-19 13:25:44 +00:00
Corantin H 29a3baaa75 Editor: added the possibility to duplicate layers 2022-08-19 13:20:50 +02:00
VoxelDoesCode fa98ad1e36 Remove the need for file_icons.png 2022-08-19 01:05:02 -04:00
bors[bot] ecc5ca5602
Merge #5750
5750: List symlinks in list_dir r=def- a=Patiga

This functionality was lost in 082e26d5b
In my case I have a lot of symlinks in the maps folder (Downloads, ddnet-maps, map_archive)

On windows, I have neither tested this behavior before nor after this patch. Could someone maybe try it out there?

<!-- What is the motivation for the changes of this 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: Patiga <dev@patiga.eu>
2022-08-18 12:08:31 +00:00
Patiga b580b83d31 List symlinks in list_dir
This functionality was lost in 082e26d5b
In my case I have a lot of symlinks in the maps folder (Downloads,
ddnet-maps, map_archive)
2022-08-18 12:51:22 +02:00
VoxelDoesCode 1807bb7b1e Update icons and clean up 2022-08-17 20:28:24 -04:00
VoxelDoesCode 470ee65db9 DoButton_Sprite > DoButtonFontIcon 2022-08-17 04:28:09 -04:00
VoxelDoesCode a1617dcf56 Replace all images with unicode chars 2022-08-17 03:58:13 -04:00
Robert Müller f0b0d4c163 Improve "couldn't open..." error messages by listing target 2022-08-16 17:35:47 +02:00
Robert Müller f0c74f72ba Smooth console completion scrolling 2022-08-15 23:20:37 +02:00
Alexander Akulich 670f284194 Use GAME_NAME definition for engine initialization 2022-08-15 16:07:27 +03:00
Alexander Akulich 8ac84948c5 Extract server main() to its own file
Also extract CServerLogger to own files.
2022-08-15 16:07:27 +03:00
Alexander Akulich ec16daa4b4 CCharacter: Drop non-const IsAlive() getter 2022-08-15 15:05:59 +03:00
Alexander Akulich 301355d588 engine/server.h: Remove outdated comment 2022-08-15 15:05:59 +03:00
bors[bot] 4826eb1df0
Merge #5730
5730: Move `CUIRect` to separate file, move `CRenderTools::DrawUIRect/4` to `CUIRect::Draw/4`, merge `CUIEx` into `CUI` r=def- a=Robyt3

Adopt UI refactorings from upstream:
- move `CUIRect` into a separate file
  - this allows some includes of `ui.h` to be removed, most importantly in `render.h`
- move `CRenderTools::DrawUIRect/4` to `CUIRect::Draw/4`
  - this object orientied calling style makes it easier to write the code

The `CUIEx` class is merged into the `CUI` class, as there is no need for two different UI classes anymore.

## 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-08-14 11:55:24 +00:00
bors[bot] cebcc885ab
Merge #5735
5735: Minor refactoring of editor IO r=def- a=Robyt3

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

## Checklist

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


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-08-14 11:24:15 +00:00
Robert Müller 813522f1fc Add/use temporary variables to improve readability 2022-08-14 13:12:21 +02:00
Robert Müller 45a20ff277 Only load and unload normal tile layer data if necessary 2022-08-14 13:12:21 +02:00
sctt eab5fb10e3
Fixed index typo map_find_env 2022-08-13 21:54:56 +02:00
sctt 77fa0acbb1
Fixed index typo map_find_env 2022-08-13 21:49:53 +02:00
sctt 71622eabb4
Fix map_find_env style 2022-08-13 19:29:16 +02:00
sctt e21ade4294
Rename map_find_env to map_find_env.cpp 2022-08-13 19:10:03 +02:00
sctt c8b4b3f631
Added map_find_env tool 2022-08-13 18:53:56 +02:00
c0d3d3v 780c4db7dd
do an int check for m_FreezeEnd instad of float, becuase it is int 2022-08-13 15:43:38 +02:00
c0d3d3v 0aa46b54ea
small fix for #5729 2022-08-12 22:38:13 +02:00
Robert Müller 51fb3e9a22 Merge CUIEx class into CUI
There is no need to separate the UI in two classes anymore, as the dependency on `CRenderTools` has been removed.
2022-08-12 19:59:19 +02:00
Robert Müller 95550fd6a9 Move CRenderTools::DrawUIRect/4 to CUIRect::Draw/4
Use `ColorRGBA` instead of `vec4` for `Draw4`.
2022-08-12 19:37:08 +02:00
Robert Müller 7b390808bc Replace ui.h include with ui_rect.h, organize other includes 2022-08-12 19:37:08 +02:00
Robert Müller 680dd052d7 Add documentation for CUIRect::Inside 2022-08-12 19:37:07 +02:00
Robert Müller 49164dfcdf Improve argument names of CUIRect::Inside 2022-08-12 19:37:07 +02:00
Robert Müller b50309dd5c Move CUIRect class into its own files 2022-08-12 19:37:07 +02:00
Robert Müller 4005b82743 Move CRenderTools::DrawUIElRect to CUIElement::SUIElementRect::Draw
This method draws a particular UI element rectangle so it should be a member method.
2022-08-12 17:42:05 +02:00
Robert Müller 3b1ef5642b Refactor DrawRect* methods:
- use `CORNER_*` constants and add missing constants
- fix array variable names
- use `size_t`
- extract duplicate computation into constant
- use `ColorRGBA` instead of `vec4`
2022-08-12 17:42:05 +02:00
Robert Müller 2a21cd6eab Move all DrawRect* methods from CRenderTools to IGraphics
As the methods do not depend on any game components they are moved to the engine graphics interface.
2022-08-12 17:42:05 +02:00
Robert Müller 7b20009980 Move CUI::CORNER_* enum to IGraphics::CORNER_*
Entirely automatic replacement in preparation for moving rect drawing methods from `CRenderTools` to `IGraphics`.
2022-08-12 17:42:04 +02:00
Robert Müller 9ad097da4d Refactor DrawCircle:
- improve argument names
- remove duplicate computation by adding `SegmentsAngle`
- rename variable `Array` to `aItems`
- use `std::size` and `size_t`
- remove unnecessary temporary variables
2022-08-12 17:42:03 +02:00
Robert Müller 237fdc76db Move CRenderTools::DrawCircle to IGraphics::DrawCircle
As this method does not depend on any game components it is be moved to the engine graphics interface.
2022-08-12 17:42:03 +02:00
Robert Müller 967c92f5d6 Encapsulate CGraph member variables
Make the member variables private and add `SetMin` to replace a usage of the member variables in `CDebugHud`. For completeness/symmetry, `SetMax` is also added.
2022-08-12 16:13:23 +02:00
Robert Müller 8c88005a42 Rename variables Array to aLineItems / aColorVertices 2022-08-12 16:13:03 +02:00
Robert Müller 11e60d32f0 Reuse CGraph::InsertAt in Add to reduce duplicate code 2022-08-12 16:13:03 +02:00
Robert Müller 44ca1f0d7b Use size_t for indices, replace unused return value with assert
The return value of `CGraph::InsertAt` was not checked. All uses of the function pass a correct index, so the return value is replaced with an assertion.
2022-08-12 16:13:03 +02:00
Robert Müller 3daa177830 Remove restriction for CGraph::MAX_VALUES to be a power of two
By using `% MAX_VALUES` instead of `& (MAX_VALUES - 1)` to wrap the index. Both work the same, but the latter only does for powers of two.
2022-08-12 16:13:03 +02:00
Robert Müller b314db5454 Use CGraph::MAX_VALUES instead of magic value in debughud 2022-08-12 16:13:02 +02:00
Robert Müller 8e0a935d5c Combine CGraph::ScaleMin and ScaleMax into Scale
As the methods are always called at the same time, they can be combined. This also improves the performance, as the array only needs to be iterated once.
2022-08-12 16:12:55 +02:00
Robert Müller e99f7ab106 Extract StrCopyUntilSpace and use existing str_* functions
Minor refactoring to reduce duplicate code. Eventually this method could be extended to handle completion for other arguments except the first one.
2022-08-11 19:30:54 +02:00
Robert Müller 33bb576202 Show completion options for tune params in console
Currently supports `tune`, `tune_reset` and `toggle_tune`.

For `tune_zone` the tune name is the second argument, so this is more difficult to handle.
2022-08-11 10:11:03 +02:00
Robert Müller 6af8f46526 Add CTuningParams::PossibleTunings to find tune params by name 2022-08-11 10:11:00 +02:00
Robert Müller 047c88d797 Refactor console completion input handling according to upstream 2022-08-11 10:08:59 +02:00
Robert Müller f3eb93b83a Extend IConsole::PossibleCommands, add index to callback
`PossibleCommands` now passes the item index to the callback and returns the total number of items.

Add `EmptyPossibleCommandCallback` as default parameter.
2022-08-11 10:08:06 +02:00
Robert Müller 680abb6405 Encapsulate CTuningParams::ms_apNames with CTuningParams::Name 2022-08-11 10:07:45 +02:00
Robert Müller 85a41f46dc Allow tune command to list current tuning parameter value
Extend `tune` so the current value of a given tuning variable is printed if no new value is given, so it works like commands in the console. For example `tune player_collision` will print the current value of the variable, whereas `tune player_collision 0` will change the value like before.
2022-08-11 10:04:52 +02:00
Robert Müller 56d6290734 Print the actual tuning value after setting it
Get the actual tuning value after setting it, as the value that was applied may differ due to overflow or rounding errors.
2022-08-11 10:04:36 +02:00
Robert Müller e3bb8bc370 Allow tune_reset to reset a single tune
Extend `tune_reset` so a single tuning value can be reset to default. For example `tune_reset player_collision` will reset just the `player_collision` tuning, whereas `tune_reset` will reset all to defaults like before.
2022-08-11 10:00:26 +02:00
Robert Müller 46ec2e0a24 Print incorrect tuning parameter name on error 2022-08-11 10:00:21 +02:00
Robert Müller 54aff02286 Add success/error message to dump_(local|remote)_console commands 2022-08-11 09:52:19 +02:00
Robert Müller 43fdeb8468 Rename tune_dump to tunes, improve descriptions 2022-08-11 09:48:41 +02:00
Robert Müller ca31b495a9 Rename dump_binds command to binds, fix typo in description 2022-08-11 09:48:34 +02:00
Dennis Felsing d003cc6ee2 Use current backlog page instead of old (fixes #5719)
Better fix by Robyt3
2022-08-10 17:27:24 +02:00
Dennis Felsing 89558d6f23 First send message to team, then kill team (fixes #5721) 2022-08-10 15:53:56 +02:00
Fireball 5d886d80f8 Parallax Zoom: use CMapItemGroupEx to store parallax value 2022-08-10 03:05:23 +01:00
Robert Müller a8e3ac1184 Minor refactoring: use int64_t instead of long long 2022-08-09 18:48:06 +02:00
Robert Müller 1e10cd3c7d Optimize conditional expression 2022-08-09 18:48:05 +02:00
Robert Müller 62445ac006 Remove unused HermiteBasis1 function 2022-08-09 18:48:05 +02:00
Robert Müller 05af632524 Rename variables v to Value 2022-08-09 18:48:05 +02:00
Robert Müller 1e6fd63204 Rename variables id to KeyID 2022-08-09 18:48:04 +02:00
bors[bot] 57849a128c
Merge #5717
5717: Check fully transparent quads with negative alpha r=def- a=Jupeyy

fixes #5716

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2022-08-09 15:49:32 +00:00
Jupeyy bc865ab087
Check transparency even for negative alpha 2022-08-09 17:44:09 +02:00
bors[bot] f8fca99e62
Merge #5642
5642: Option to remove weak hook & bounce r=def- a=Jupeyy

Fixes #5641 
server side only

## 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-08-09 13:59:21 +00:00
bors[bot] dbe6d8cb29
Merge #5715
5715: Use djb2 for snapshot item hashlist r=def- a=Robyt3

The previous hash function was heavily biased towards the hash buckets 64-79, making those buckets overflow faster, which results in snapshot CRC errors and lags.

Using the djb2 hash yields an almost even distribution over the entire range of values.

Source for djb2: http://www.cse.yorku.ca/~oz/hash.html
(we incidentally use the same implementation for `str_quickhash`)

Sample which compares the usage of hash buckets in the test map from #5454 with the old and new hash function: [SnapshotHash.csv](https://github.com/ddnet/ddnet/files/9285148/SnapshotHash.csv) (this table also differentiates between the source and target of the snapshot delta)

Closes #4379.

## 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-08-08 22:38:22 +00:00
Robert Müller 243ab7c2f0 Use djb2 for snapshot item hashlist
The previous hash function was heavily biased towards the hash buckets 64-79, making those buckets overflow faster, which results in snapshot CRC errors and lags.

Using the djb2 hash yields an almost even distribution over the entire range of values.

http://www.cse.yorku.ca/~oz/hash.html
2022-08-08 23:21:45 +02:00
Robert Müller 573aedc323 Extract magic constant 64 into HASHLIST_BUCKET_SIZE 2022-08-08 22:34:47 +02:00
Robert Müller b99b861e1c Extract common expression into CalcHashID function 2022-08-08 22:30:14 +02:00
Dennis Felsing 614a5b35bc Easter egg 2022-08-08 16:37:17 +02:00
Dennis Felsing 526861f924 Update language files, remove half-translated graphics warning
Thanks to cheeser0613 for report
2022-08-08 16:10:48 +02:00
Fireball 4ed997f304 Parallax Zoom: fix QuadEnvPoint scaling (and other UI distances) 2022-08-06 16:45:03 +01:00
bors[bot] aeca43fbdb
Merge #5706
5706: Fix shift-leftclick-drag with empty selection to delete (fixes #5705) r=C0D3D3V a=def-

<!-- What is the motivation for the changes of this 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-08-06 10:54:33 +00:00
Fireball 54f7a9817d Parallax Zoom: Zoom preview button in Editor
Known issue: Quad Env Points are scaled incorrectly for Groups with
ParallaxZoom != 100 (in Zoom mode).
2022-08-06 02:30:37 +01:00
Fireball 5bf7f60bf6 Parallax Zoom: Add default zoom option to the editor
Safe defaults for map editing: unless opted-in, Parallax Zoom
will default to maximum(parallax{x,y}).
2022-08-06 01:31:42 +01:00
Dennis Felsing a41f1c1def Fix shift-leftclick-drag with empty selection to delete (fixes #5705) 2022-08-06 02:09:15 +02:00
Fireball a90c86e9a5 Parallax-aware zoom
How this works: parallax values configure perceived distance from camera
when it's moving along x and y axes. Assume that zoom is moving the
camera away and scale layers accordingly, with background layers
(furtherst away) changing the least.

New per-ItemGroup (LayerGroup) setting allows to set the new parallax
value independently from the other two. This can be used to do tricks
like on Time Shop zoom correctly or make it feel like the camera is
changing the field of view at the same time as moving in space.
2022-08-05 00:40:58 +01:00
Robert Müller b1e4d60fae Fix buffer-overflow in editor on shift-clicking brush
1. Open any map, including an empty one.
2. Select a brush, e.g. size 2x2.
3. Shift click to repeat the brush over a larger area, e.g. 10x10.
4. This causes a buffer-overflow / crash with ASAN:

```
=================================================================
==4826==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000f5040 at pc 0x55db7d0aa743 bp 0x7fffe4e191f0 sp 0x7fffe4e191e0
READ of size 4 at 0x6060000f5040 thread T0
    0 0x55db7d0aa742 in CLayerTiles::GetTile(int, int) src/game/editor/layer_tiles.cpp:50
    1 0x55db7d0d23e1 in CLayerTiles::FillSelection(bool, CLayer*, CUIRect) src/game/editor/layer_tiles.cpp:437
    2 0x55db7cf196e9 in CEditor::DoMapEditor(CUIRect) src/game/editor/editor.cpp:2641
    3 0x55db7cfa7755 in CEditor::Render() src/game/editor/editor.cpp:5747
    4 0x55db7cfd2a56 in CEditor::OnRender() src/game/editor/editor.cpp:6437
    5 0x55db7c23e02d in CClient::Run() src/engine/client/client.cpp:3374
    6 0x55db7c2a9f7b in main src/engine/client/client.cpp:4762

0x6060000f5040 is located 0 bytes to the right of 64-byte region [0x6060000f5000,0x6060000f5040)
allocated by thread T0 here:
    0 0x7f9b21db5787 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:107
    1 0x55db7d0a9a86 in CLayerTiles::CLayerTiles(int, int) src/game/editor/layer_tiles.cpp:39
    2 0x55db7d0cf0ed in CLayerTiles::BrushGrab(CLayerGroup*, CUIRect) src/game/editor/layer_tiles.cpp:387
    3 0x55db7cf18191 in CEditor::DoMapEditor(CUIRect) src/game/editor/editor.cpp:2612
    4 0x55db7cfa7755 in CEditor::Render() src/game/editor/editor.cpp:5747
    5 0x55db7cfd2a56 in CEditor::OnRender() src/game/editor/editor.cpp:6437
    6 0x55db7c23e02d in CClient::Run() src/engine/client/client.cpp:3374

SUMMARY: AddressSanitizer: heap-buffer-overflow src/game/editor/layer_tiles.cpp:50 in CLayerTiles::GetTile(int, int)
Shadow bytes around the buggy address:
  0x0c0c800169b0: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 fa
  0x0c0c800169c0: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c800169d0: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c800169e0: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c800169f0: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
=>0x0c0c80016a00: 00 00 00 00 00 00 00 00[fa]fa fa fa fd fd fd fd
  0x0c0c80016a10: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c80016a20: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c0c80016a30: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x0c0c80016a40: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fa
  0x0c0c80016a50: fa fa fa fa fd fd fd fd fd fd fd fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==4826==ABORTING
```
2022-08-04 23:39:40 +02:00
Robert Müller c696d93e41 Add documentation for IServer::GetClientVersion 2022-08-03 23:28:51 +02:00
bors[bot] b4914d5d27
Merge #5692
5692: Refactor `GetClientVersion`, remove many `version.h` includes, fix potential use of undefined value r=def- a=Robyt3

Some refactoring to reduce duplicate code and to remove includes.

## 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-08-01 21:21:18 +00:00
Robert Müller ee339ebe30 Minor refactoring of GetClientInfo and SetClientDDNetVersion 2022-07-31 23:37:56 +02:00
Robert Müller 24b30434da Handle CServer::GetClientInfo return to fix use of undefined value
```
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:790:2: error: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn,-warnings-as-errors]
        return Info.m_DDNetVersion;
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:785:5: note: Assuming 'ClientID' is not equal to SERVER_DEMO_CLIENT
        if(ClientID == SERVER_DEMO_CLIENT)
           ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:785:2: note: Taking false branch
        if(ClientID == SERVER_DEMO_CLIENT)
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:789:2: note: Calling 'CServer::GetClientInfo'
        GetClientInfo(ClientID, &Info);
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:646:13: note: Assuming 'ClientID' is >= 0
        dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid");
                   ^
/home/runner/work/ddnet/ddnet/src/base/tl/../system.h:58:38: note: expanded from macro 'dbg_assert'
#define dbg_assert(test, msg) assert(test)
                                     ^
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:646:13: note: Left side of '&&' is true
        dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid");
                   ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:646:30: note: Assuming 'ClientID' is < MAX_CLIENTS
        dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid");
                                    ^
/home/runner/work/ddnet/ddnet/src/base/tl/../system.h:58:38: note: expanded from macro 'dbg_assert'
#define dbg_assert(test, msg) assert(test)
                                     ^
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:646:2: note: '?' condition is true
        dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid");
        ^
/home/runner/work/ddnet/ddnet/src/base/tl/../system.h:58:31: note: expanded from macro 'dbg_assert'
#define dbg_assert(test, msg) assert(test)
                              ^
/usr/include/assert.h:93:7: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
      ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:647:13: note: 'pInfo' is not equal to null
        dbg_assert(pInfo != 0, "info can not be null");
                   ^
/home/runner/work/ddnet/ddnet/src/base/tl/../system.h:58:38: note: expanded from macro 'dbg_assert'
#define dbg_assert(test, msg) assert(test)
                                     ^
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:647:2: note: '?' condition is true
        dbg_assert(pInfo != 0, "info can not be null");
        ^
/home/runner/work/ddnet/ddnet/src/base/tl/../system.h:58:31: note: expanded from macro 'dbg_assert'
#define dbg_assert(test, msg) assert(test)
                              ^
/usr/include/assert.h:93:7: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
      ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:649:5: note: Assuming field 'm_State' is not equal to STATE_INGAME
        if(m_aClients[ClientID].m_State == CClient::STATE_INGAME)
           ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:649:2: note: Taking false branch
        if(m_aClients[ClientID].m_State == CClient::STATE_INGAME)
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:667:2: note: Returning without writing to 'pInfo->m_DDNetVersion'
        return 0;
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:789:2: note: Returning from 'CServer::GetClientInfo'
        GetClientInfo(ClientID, &Info);
        ^
/home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:790:2: note: Undefined or garbage value returned to caller
        return Info.m_DDNetVersion;
        ^
```
2022-07-31 23:37:28 +02:00
Robert Müller 9a012312b8 Move and extend GetClientVersion to remove many version.h includes
The `CServer::GetClientVersion` method needs the `version.h` include, so it's moved from the header to the source file, so the include can be removed from the header.

The `GetClientVersion` method is often called with the same `Client != SERVER_DEMO_CLIENT ? GetClientVersion(Client) : CLIENT_VERSIONNR` expression, which also needs the `version.h` include. This expression is moved inside the method, so the include can be removed from all the server entities' and player code.

The `CGameContext::GetClientVersion` method is made a delegate to reduce duplicate code.

The includes of the server entities are also organized further.
2022-07-31 23:21:10 +02:00
bors[bot] 1110d0e40e
Merge #5686
5686: Fix editor image delete r=def- a=Jupeyy

fixes #5675

## 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>
2022-07-31 21:11:15 +00:00
Chairn c651936f38 Use copy assignment rather than copy variable one by one 2022-07-31 22:43:43 +02:00
bors[bot] 730c54a603
Merge #5678
5678: Reset selected quads when switching layers (fixes #5673) r=Jupeyy a=def-

<!-- What is the motivation for the changes of this 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>
2022-07-31 20:03:31 +00:00
Jupeyy 982139922c Fix editor image delete 2022-07-31 21:39:18 +02:00
Robert Müller 1d6dca8c24 Fix accesses to vector with index -1 by adding static button IDs 2022-07-31 13:13:53 +02:00
Robert Müller 344e50f76f Remove dead code 2022-07-31 13:10:03 +02:00
def 76e3db9725 Reset selected quads when switching layers (fixes #5673) 2022-07-31 09:45:06 +02:00
def b33cbdde0a Remove unused backend_opengles.h 2022-07-31 09:44:50 +02:00
def fc5cfb6f6c Remove CFlag dead code (fixes #5677) 2022-07-31 09:44:50 +02:00
def 734790a4aa Fix deprecation warning in ffmpeg 5.1 (fixes #5681) 2022-07-31 00:58:15 +02:00
Robert Müller 7f1a7795ee Fix tab and F10 keys working inconsistently in editor
By moving the calls to `KeyPress` from `CEditor::OnUpdate` to `OnRender`.
2022-07-30 13:31:00 +02:00
Dennis Felsing d520fe6177 Fix rotating plasma by Robyt3 (fixes #5666) 2022-07-28 15:42:11 +02:00
bors[bot] 9a3f526cb6
Merge #5614
5614: Fix clang-tidy 14 mingw issues (fixes #5612) r=heinrich5991 a=def-

Strangely I didn't get all of the errors.

## 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-07-27 10:45:54 +00:00
Dennis Felsing 9d6ccbe838 Version 16.2.2 2022-07-27 12:22:43 +02:00
def c94de9b764 Further clang-tidy 14 issues (fixes #5612) 2022-07-27 09:07:47 +02:00
def 1944bc7052 Ignore Stack address escape clang-tidy warnings
/media/ddnet/src/engine/server.h:135:3: error: Address of stack memory associated with local variable 'aBuf' is still referred to by the stack variable 'tmp' upon returning to the caller.  This will be a dangling reference [clang-analyzer-core.StackAddressEscape,-warnings-as-errors]
                return SendPackMsgOne(pMsg, Flags, ClientID);
                ^
/media/ddnet/src/game/server/gamecontext.cpp:4084:5: note: Assuming the condition is false
        if(pFilter[0])
           ^~~~~~~~~~
/media/ddnet/src/game/server/gamecontext.cpp:4084:2: note: Taking false branch
        if(pFilter[0])
        ^
/media/ddnet/src/game/server/gamecontext.cpp:4088:2: note: Calling 'CGameContext::SendChatTarget'
        SendChatTarget(ClientID, aBuf);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/game/server/gamecontext.cpp:401:5: note: Assuming field 'm_SvDemoChat' is not equal to 0
        if(g_Config.m_SvDemoChat)
           ^~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/game/server/gamecontext.cpp:401:2: note: Taking true branch
        if(g_Config.m_SvDemoChat)
        ^
/media/ddnet/src/game/server/gamecontext.cpp:402:3: note: Calling 'IServer::SendPackMsg'
                Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NOSEND, -1);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:71:3: note: Taking true branch
                if(ClientID == -1)
                ^
/media/ddnet/src/engine/server.h:73:19: note: Assuming the condition is true
                        for(int i = 0; i < MaxClients(); i++)
                                       ^~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:73:4: note: Loop condition is true.  Entering loop body
                        for(int i = 0; i < MaxClients(); i++)
                        ^
/media/ddnet/src/engine/server.h:74:8: note: Assuming the condition is true
                                if(ClientIngame(i))
                                   ^~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:74:5: note: Taking true branch
                                if(ClientIngame(i))
                                ^
/media/ddnet/src/engine/server.h:77:15: note: Calling 'IServer::SendPackMsgTranslate'
                                        Result = SendPackMsgTranslate(&tmp, Flags, i);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:118:6: note: Assuming field 'm_ClientID' is >= 0
                if(pMsg->m_ClientID >= 0 && !Translate(pMsg->m_ClientID, ClientID))
                   ^~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:118:6: note: Left side of '&&' is true
/media/ddnet/src/engine/server.h:118:31: note: Assuming the condition is true
                if(pMsg->m_ClientID >= 0 && !Translate(pMsg->m_ClientID, ClientID))
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:118:3: note: Taking true branch
                if(pMsg->m_ClientID >= 0 && !Translate(pMsg->m_ClientID, ClientID))
                ^
/media/ddnet/src/engine/server.h:125:6: note: Assuming the condition is false
                if(IsSixup(ClientID))
                   ^~~~~~~~~~~~~~~~~
/media/ddnet/src/engine/server.h:125:3: note: Taking false branch
                if(IsSixup(ClientID))
                ^
/media/ddnet/src/engine/server.h:135:3: note: Address of stack memory associated with local variable 'aBuf' is still referred to by the stack variable 'tmp' upon returning to the caller.  This will be a dangling reference
                return SendPackMsgOne(pMsg, Flags, ClientID);
                ^
2022-07-27 09:07:20 +02:00
def 6fc2296a6e Ignore openssl deprecation warning for now (fixes #5597) 2022-07-27 09:06:57 +02:00
bors[bot] 53e9fd3599
Merge #5627
5627: Fix shift + left click in editor (fixes #5626) r=heinrich5991 a=def-

<!-- What is the motivation for the changes of this 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-07-26 19:11:24 +00:00
bors[bot] e8667b6075
Merge #5658
5658: Fix game freezing up on duplicate snapshot r=def- a=Fireball-Teeworlds

If a duplicate snapshot is received (for the same tick), we add both to the SnapshotStorage and end up with the same snapshot as both Cur and Prev. This results in GameInfraTick returning "inf" and results in "NaN" downstream in a few places, getting the CollLine logic stuck.

Some debug info (tcpdump, gdb, perf): https://gist.github.com/Fireball-Teeworlds/ad0016d2551a2e4d4cb5691023493856

Apparently this doesn't really happen in the wild, unless you have a buggy network stack. In which case it happens frequently enough to pinpoint the issue :D

 (fixes #5657)

## 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
- [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: Fireball <fireball.teeworlds@gmail.com>
2022-07-26 13:46:40 +00:00
Fireball 9689301410 Fix game freezing up on duplicate snapshot
If a duplicate snapshot is received (for the same tick), we add both to the SnapshotStorage and end up with the same snapshot as both Cur and Prev. This results in GameInfraTick returning "inf" and results in "NaN" downstream in a few places, getting the CollLine logic stuck.

Apparently this doesn't really happen in the wild, unless you have a buggy network stack. In which case it happens frequently enough to pinpoint the issue :D
2022-07-24 21:57:05 +01:00
Robert Müller 1398936f54 Minor refactoring of CDemoPlayer::DoTick:
- Decrease variable scopes
- Use `bool` instead of `int`
2022-07-24 19:01:45 +02:00
Robert Müller 4c397e479a Refactor CSnapshotBuilder::Finish using TotalSize and OffsetSize 2022-07-24 18:04:48 +02:00
Robert Müller 3863d41623 Validate snapshot size and member variables and demo snapshots
Add `CSnapshot::IsValid` to check if a snapshot unpacked from a snapshot delta or demo is valid:
- ensure number of items and data size are not negative
- ensure that the actual size of the snapshot matches the size derived from its member variables
- ensure item offsets are within the valid range
- ensure item sizes are not negative

Add `CSnapshot::TotalSize` and `CSnapshot::OffsetSize` utility functions.

Minor improvements to related error messages.

Fixes buffer overflow:

```
==47744==ERROR: AddressSanitizer: global-buffer-overflow on address 0x558618e3767f at pc 0x558614b9bdfb bp 0x7ffe58a32cd0 sp 0x7ffe58a32cc0
READ of size 4 at 0x558618e3767f thread T0
    0x558614b9bdfa in CSnapshotItem::Type() const src/engine/shared/snapshot.h:16
    0x558615c3c911 in CSnapshot::GetItemType(int) const src/engine/shared/snapshot.cpp:29
    0x558614aebaba in CClient::UnpackAndValidateSnapshot(CSnapshot*, CSnapshot*) src/engine/client/client.cpp:2264
    0x558614af87cb in CClient::OnDemoPlayerSnapshot(void*, int) src/engine/client/client.cpp:2598
    0x558615b9db1a in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:659
    0x558615babd3f in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1007
    0x558614afb08b in CClient::Update() src/engine/client/client.cpp:2686
    0x558614b1d9eb in CClient::Run() src/engine/client/client.cpp:3296
    0x558614b8e64f in main src/engine/client/client.cpp:4761
```

And fixes a buffer overflow that manifests itself as an internal ASan error:

```
=================================================================
==4755==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_descriptions.cc:79 "((0 && "Address is not in memory and not in shadow?")) != (0)" (0x0, 0x0)
    0x7f0bf5f368be in AsanCheckFailed ../../../../src/libsanitizer/asan/asan_rtl.cc:72
    0x7f0bf5f54eee in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cc:77
    0x7f0bf5e4cb6f in GetShadowKind ../../../../src/libsanitizer/asan/asan_descriptions.cc:79
    0x7f0bf5e4cb6f in __asan::GetShadowAddressInformation(unsigned long, __asan::ShadowAddressDescription*) ../../../../src/libsanitizer/asan/asan_descriptions.cc:95
    0x7f0bf5e4cb6f in __asan::GetShadowAddressInformation(unsigned long, __asan::ShadowAddressDescription*) ../../../../src/libsanitizer/asan/asan_descriptions.cc:92
    0x7f0bf5e4e386 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cc:440
    0x7f0bf5e50e94 in __asan::ErrorGeneric::ErrorGeneric(unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long) ../../../../src/libsanitizer/asan/asan_errors.cc:380
    0x7f0bf5f35f4d in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ../../../../src/libsanitizer/asan/asan_report.cc:460
    0x7f0bf5e86f5e in __interceptor_memset ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:762
    0x558234873f1d in mem_zero src/base/system.cpp:213
    0x55823481fc27 in CSnapshotBuilder::NewItem(int, int, int) src/engine/shared/snapshot.cpp:675
    0x55823481be65 in CSnapshotDelta::UnpackDelta(CSnapshot*, CSnapshot*, void const*, int) src/engine/shared/snapshot.cpp:380
    0x558234776641 in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:631
    0x5582347861a9 in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1007
    0x5582336d4c7d in CClient::Update() src/engine/client/client.cpp:2695
    0x5582336f75dd in CClient::Run() src/engine/client/client.cpp:3305
    0x558233768241 in main src/engine/client/client.cpp:4770
```
2022-07-24 18:00:39 +02:00
Robert Müller 1b32e47173 Fix shift with negative exponent in TeamMask
```
src/game/server/teams.cpp:484:35: runtime error: shift exponent -1 is negative
    0x55d065b241c4 in CGameTeams::TeamMask(int, int, int) src/game/server/teams.cpp:484
    0x55d0657f92ed in CCharacter::TickDefered() src/game/server/entities/character.cpp:821
    0x55d065a5d04c in CGameWorld::Tick() src/game/server/gameworld.cpp:283
    0x55d0659327e6 in CGameContext::OnTick() src/game/server/gamecontext.cpp:852
    0x55d0656e6a88 in CServer::Run() src/engine/server/server.cpp:2807
    0x55d0657164f1 in main src/engine/server/server.cpp:3904
```
2022-07-22 16:42:56 +02:00
Jupeyy 88c4b69301 Add an option to remove weak hook & bounce 2022-07-21 17:04:16 +02:00
Robert Müller 95636da6d9 Fix out of bounds access with highlighted messages in server demos
```
src/game/client/components/chat.cpp:795:89: runtime error: index -1 out of bounds for type 'CClientData [64]'
    #0 0x55c133fd047a in CChat::AddLine(int, int, char const*) src/game/client/components/chat.cpp:795
    #1 0x55c133fc80b5 in CChat::OnMessage(int, void*) src/game/client/components/chat.cpp:570
    #2 0x55c134677688 in CGameClient::OnMessage(int, CUnpacker*, int, bool) src/game/client/gameclient.cpp:770
    #3 0x55c133c282d2 in CClient::OnDemoPlayerMessage(void*, int) src/engine/client/client.cpp:2627
    #4 0x55c134ccdcba in CDemoPlayer::DoTick() src/engine/shared/demo.cpp:679
    #5 0x55c134cdac81 in CDemoPlayer::Update(bool) src/engine/shared/demo.cpp:1007
    #6 0x55c133c2a08b in CClient::Update() src/engine/client/client.cpp:2686
    #7 0x55c133c4c9eb in CClient::Run() src/engine/client/client.cpp:3296
    #8 0x55c133cbd64f in main src/engine/client/client.cpp:4761
```
2022-07-21 15:32:11 +02:00
Robert Müller b4eee122dd Fix null pointer access in maplayers when the snapshot has no game info
```
src/game/client/components/maplayers.cpp:98:112: runtime error: member access within null pointer of type 'const struct CNetObj_GameInfo'
    #0 0x55d84eea9e1e in CMapLayers::EnvelopeEval(int, int, ColorRGBA&, void*) src/game/client/components/maplayers.cpp:98
    #1 0x55d84f518082 in CRenderTools::ForceRenderQuads(CQuad*, int, int, void (*)(int, int, ColorRGBA&, void*), void*, float) src/game/client/render_map.cpp:112
    #2 0x55d84f517ac7 in CRenderTools::RenderQuads(CQuad*, int, int, void (*)(int, int, ColorRGBA&, void*), void*) src/game/client/render_map.cpp:98
    #3 0x55d84eee10b0 in CMapLayers::OnRender() src/game/client/components/maplayers.cpp:1839
    #4 0x55d84f34b915 in CGameClient::OnRender() src/game/client/gameclient.cpp:640
    #5 0x55d84e8d44c2 in CClient::Render() src/engine/client/client.cpp:1222
    #6 0x55d84e92d1a0 in CClient::Run() src/engine/client/client.cpp:3370
    #7 0x55d84e99964f in main src/engine/client/client.cpp:4761
```
2022-07-21 15:28:31 +02:00
Jupeyy 2240ad2966 Fix spelling 2022-07-19 18:22:44 +02:00
Robert Müller c6cf0004a9 Fix names of static variables in settings menus 2022-07-18 21:51:46 +02:00
Robert Müller 687fd91414 Rename variable m_aEntries to m_vEntries 2022-07-18 21:43:59 +02:00
bors[bot] a9bc4ae113
Merge #5634
5634: Fix clang tidy accessing data pointer r=def- a=ChillerDragon

ddnet/src/engine/client/favorites.cpp:229:23: error: 'data' should be
used for accessing the data pointer instead of taking the address of the
0-th element [readability-container-data-pointer,-warnings-as-errors]
        int Index = pEntry - &m_aEntries[0];
                             ^~~~~~~~~~~~~~
                             (m_aEntries).data()

<!-- What is the motivation for the changes of this 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: ChillerDragon <ChillerDragon@gmail.com>
2022-07-18 14:28:43 +00:00
bors[bot] 650800ea1e
Merge #5633
5633: Adapt upstreams CButtonContainer r=def- a=ChillerDragon

Introduce ``CButtonContainer`` which is used for fading text in teeworlds. There is no fading text in ddnet yet.
This change allows introducing such fading buttons but the main motivation for this change is easier copy & pasting code from ddnet to teeworlds code base and vice versa.

## 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: ChillerDragon <ChillerDragon@gmail.com>
2022-07-18 14:07:11 +00:00
ChillerDragon 1347860b2c Adapt upstreams CButtonContainer 2022-07-18 10:23:03 +02:00
Robert Müller b594a323a6 Change return type of CNetBase::IsSeqInBackroom from int to bool 2022-07-17 20:51:48 +02:00
Robert Müller 5f7d19d2e0 Use sizeof instead of hardcoded value 2022-07-17 20:51:11 +02:00
Robert Müller 4970a615d8 Remove dead code
The condition `Size < 1` is never true because the previous condition `Size < NET_PACKETHEADERSIZE` (`Size < 3`) already covers it.
2022-07-17 20:34:29 +02:00