Commit graph

8755 commits

Author SHA1 Message Date
Patiga be8f6217ce Make tileflag names consistent with automappers
Follow-up to commit a4867d29c6

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

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

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

Closes #5653.

## Checklist

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


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

Closes #3747.
2022-12-18 20:58:29 +01:00
Robert Müller 2579f0be2f Add support for hot-plugging gamecontrollers
Handle the appropriate SDL events to open new joysticks when they are connected and remove joysticks when they are disconnected.

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

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

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

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

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

This is fixed by allowing an arbitrary number of spawn points of all types, by using an `std::vector` instead of an array.
2022-12-17 12:17:58 +01:00
Robert Müller d8f0678958 Use bool instead of int 2022-12-17 11:36:29 +01:00
Robert Müller 4aeccff6f4 Move variable declarations closer to usages 2022-12-17 11:36:29 +01:00
Robert Müller 6d3baed69d Remove dead code 2022-12-17 11:36:29 +01:00
bors[bot] 3f73b816d9
Merge #6143
6143: Add separate `ed_limit_max_zoom_level` for editor, fix editor smooth zooming when joining/reloading game  r=def- a=Robyt3



## Checklist

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


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-12-15 18:19:54 +00:00
bors[bot] 2d57e0455a
Merge #6142
6142: Adjust no weak prediction to updated server code r=def- a=Jupeyy

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

## Checklist

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


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

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

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

## Checklist

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


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-12-14 16:51:51 +00:00
Dennis Felsing d5cf3630ae Remove spammy log (thanks Skeith) 2022-12-14 17:39:18 +01:00
Patiga a4867d29c6 Make tileflag names consistent and intuitive
- `TILEFLAG_VFLIP` -> `TILEFLAG_FLIP_HORIZONTAL`
- `TILEFLAG_HFLIP` -> `TILEFLAG_FLIP_VERTICAL`

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

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

Whenever I was working with tileflags, the naming caused me to have no
idea what I was doing. I mostly had to resort to opening the resulting
map in the editor to see what the code does. This change aims to make
the naming intuitive and also consistent with the map editor.
2022-12-14 13:54:11 +01:00
Jupeyy 5341fc37fd Minimal changes to default to Vulkan 2022-12-13 19:37:03 +01:00
Jupeyy 870ea8566e Improve error handling in vulkan
so it doesn't assert & shows a message box with the error and some tips
2022-12-13 18:11:26 +01:00
Jupeyy dff876d58c Add Localizable hint 2022-12-13 17:53:32 +01:00
Dennis Felsing fe4a8441bf Version 16.6 2022-12-11 23:05:33 +01:00
Robert Müller 71139f33f0 Add separate option for smooth zooming in editor
Add `ed_smooth_zoom_time` option for smooth zooming in editor separate from the `cl_smooth_zoom_time` that's used for smooth zooming ingame, as some mappers seem to prefer unsmooth zooming in the editor but smooth zooming ingame.
2022-12-11 13:14:55 +01:00
bors[bot] 63187f565f
Merge #6111
6111: Fix updating teamranks r=def- a=Zwelf

Fixes #6107

## Checklist

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


Co-authored-by: Zwelf <zwelf@strct.cc>
2022-12-10 12:59:27 +00:00
Zwelf b7205f5ef5 Fix updating teamranks 2022-12-10 00:51:16 +01:00
Dennis Felsing 7c46b5190b Add button that tells you how to save power 2022-12-08 23:10:02 +01:00
NouaaTW 0bc4e7601e Colorify BW gamemode 2022-12-07 19:29:40 +01:00
Robert Müller 0b3dad8dcd Reduce duplicate code by extracting CEditor::SnapToGrid 2022-12-06 20:18:08 +01:00
bors[bot] cf6e89c319
Merge #6035
6035: Fix various issues reported by cppcheck static analyser r=def- a=Robyt3

After generating `compile_commands.json` with cmake, I ran [cppcheck](https://cppcheck.sourceforge.io/) like this:

```
cppcheck --project=compile_commands.json -DWIN64 --suppressions-list=cppcheck.supp --enable=all 2>cppcheck.log
```

With these suppressions in `cppcheck.supp`:

```
cstyleCast
useStlAlgorithm
unusedFunction
variableScope
noExplicitConstructor
useInitializationList
noConstructor
uninitMemberVar
uninitMemberVarPrivate
uninitDerivedMemberVar
uninitStructMember
uninitvar
shadowFunction
memleakOnRealloc
internalAstError
virtualCallInConstructor
unknownMacro
noOperatorEq
noCopyConstructor
```

Many of these occur too often or are false positives. 

Here is a list of all remaining non-suppressed issues reported by cppcheck: [cppcheck.log](https://github.com/ddnet/ddnet/files/9997663/cppcheck.log)

And here is a list of all remaining issues including the suppressed ones: [cppcheck_all.log](https://github.com/ddnet/ddnet/files/9997662/cppcheck_all.log)

I couldn't get cppcheck's command line argument to ignore the external folders to work correctly, so I manually removed those entries from the files.

## 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-12-05 20:00:07 +00:00
bors[bot] 2dcef1685b
Merge #6094
6094: Check if ghost is really used bcs IntsToStr returns weird stuff for 0… r=def- a=Jupeyy

… integers

--- ignore whitespaces

## Checklist

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


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2022-12-05 19:34:43 +00:00
Jupeyy bf9e8a4309 Check if ghost is really used bcs IntsToStr returns weird stuff for 0 integers 2022-12-05 20:11:20 +01:00
Dennis Felsing f9c7cc7475 Add credits 2022-12-05 19:21:36 +01:00
bors[bot] be7242e010
Merge #6071 #6077 #6085 #6088 #6090
6071: Add logs for moderators (fixes #5433) r=def- a=Vy0x2

<!-- What is the motivation for the changes of this pull request? -->
issue #5433 
Moderators can access the last x minutes of the chat activity.
Every entry beside server messages will show the player name, player ip and client who wrote the message / who disconnected so moderators can get the players ip after something happened in case he left already.

The current implementation has a 4 minute time slot, messages older than 4 minutes are not shown.
To limit the memory usage its limited atm to 256 log-entries. In case of more messages than 256 in 4 minutes (unlikely), the oldest messages are overwritten.

I keep this as a draft for a while, because its my first pr and I am sure there is some improvement i did not see (or to improve the wording)
<!-- 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
- [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)


6077: Add "Tools > Remove unused envelopes" to editor r=def- a=Robyt3

Add a new menu "Tools" next to the "File" menu, with a button to "Remove unused envelopes".

Clicking the button opens a confirmation popup to confirm the operation.

![editor-tools-menu](https://user-images.githubusercontent.com/23437060/205157109-62d53601-502a-4401-8c6f-f06c7e57e174.png)

Closes #2576.

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


6085: Fix cmake args in workspace r=def- a=Jupeyy

current is completely wrong, since it overwrites the cmake internal settings. and e.g. prevent `-g`
Now it should in worst case only overwrite custom settings by the user. but dunno how often u actually do that anyway inside a IDE

but if someone knows better I'm glad to hear it

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


6088: Pr fix uninit r=def- 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)


6090: FIX: parse & colorify gametype Gores correctly r=heinrich5991 a=Avolicious

`@def-` The correct PR now :) Correct coloring the gamemode "Gores"
![193410660-5e757fd4-449f-4d0a-a719-4a0cc1e5a01e](https://user-images.githubusercontent.com/105295486/205684472-36cc6daa-bda4-4af1-a838-b7fe25a55dec.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
- [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: Vy0x2 <denispaul43@gmail.com>
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
Co-authored-by: Avolicious <avolicious@kog.tw>
2022-12-05 16:12:05 +00:00
Avolicious 59db9ce54b FIX: parse & colorify gametype Gores correctly 2022-12-05 17:03:43 +01:00
Zwelf a4b7c9d08a Store ranks in sqlite first to not loose them if server shuts down during stuck mysql transaction 2022-12-05 16:50:25 +01:00
Zwelf f847215fd0 Notify about possible save codes right away 2022-12-05 16:48:10 +01:00
Robert Müller 5425708b27 Reduce duplicate code by moving it outside of branches 2022-12-04 13:45:27 +01:00
Robert Müller d35975c9b9 Adjust quad point position and texture U/V relatively
When multiple quad points are selected, adjust the points' positions and texture U/V coordinates relatively instead of setting all points to the same value.

Closes #3359.
2022-12-04 13:45:26 +01:00
Robert Müller b852dad9a2 Fix demo name not being shown in demo player
And slightly increase space for the speed label.
2022-12-04 12:37:09 +01:00
Robert Müller 061f8625f4 Use HandleDemoSeeking for demo skipping
To ensure that components are reset when skipping and that envelopes are updated immediately.
2022-12-04 12:34:17 +01:00
bors[bot] acfc7f8c06
Merge #6060
6060: Add buttons+increased length on demo viewbar r=def- a=l-ouis

Aimed to add some more controls on the demo view bar:

Added tick step buttons and jump to next/prev marker buttons
Increased width of demo controls panel so it wasn't as cluttered
changed export cut icon to a common export icon instead of the camcorder icon
Centered the time multiplier between the buttons it was between

![image](https://user-images.githubusercontent.com/69405348/202874985-9d983959-9188-4d96-9a2d-633621e6f489.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
- [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: louis <louisaltgeer@gmail.com>
2022-12-04 11:09:39 +00:00
Zwelf 2268c08e05 Fix heap-buffer-overflow in DDNetLaser prediction code
Found while playing the Exit when doing the part at x:35 y:219.
Verified that with the fix applied the crash doesn't happen anymore.

asan output:

```
=================================================================
==10996==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62000001de20 at pc 0x5555575208d0 bp 0x7fffffff4710 sp 0x7fffffff4708
READ of size 4 at 0x62000001de20 thread T0
[Detaching after fork from child process 11277]
    #0 0x5555575208cf in ExtractLaserInfoDDNet(CNetObj_DDNetLaser const*, CGameWorld*) /home/user/.local/bin/ddnet/src/src/game/client/laser_data.cpp:36:27
    #1 0x5555575af9c8 in CGameWorld::NetObjAdd(int, int, void const*, CNetObj_EntityEx const*) /home/user/.local/bin/ddnet/src/src/game/client/prediction/gameworld.cpp:493:11
    #2 0x5555574bf201 in CGameClient::UpdatePrediction() /home/user/.local/bin/ddnet/src/src/game/client/gameclient.cpp:2452:15
    #3 0x5555574aad89 in CGameClient::OnNewSnapshot() /home/user/.local/bin/ddnet/src/src/game/client/gameclient.cpp:1729:3
    #4 0x5555569562c7 in CClient::Update() /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:2751:22
    #5 0x55555696e4bd in CClient::Run() /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:3260:4
    #6 0x5555569caa8b in main /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:4753:11
    #7 0x7ffff4ea9d09 in __libc_start_main csu/../csu/libc-start.c:308:16
    #8 0x5555560f55c9 in _start (/home/user/.local/bin/ddnet/build-fast/DDNet+0xba15c9) (BuildId: 6d1b5aed4fc199ba75cdc083de5ada540ca4612b)

0x62000001de20 is located 0 bytes after 3488-byte region [0x62000001d080,0x62000001de20)
allocated by thread T0 here:
    #0 0x55555618e36e in __interceptor_malloc (/home/user/.local/bin/ddnet/build-fast/DDNet+0xc3a36e) (BuildId: 6d1b5aed4fc199ba75cdc083de5ada540ca4612b)
    #1 0x555556382591 in CSnapshotStorage::Add(int, long, int, void*, int, void*) /home/user/.local/bin/ddnet/src/src/engine/shared/snapshot.cpp:518:32
    #2 0x55555693aa6e in CClient::ProcessServerPacket(CNetChunk*, int, bool) /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:2088:31
    #3 0x55555694b48c in CClient::PumpNetwork() /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:2556:4
    #4 0x55555695ca61 in CClient::Update() /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:2868:2
    #5 0x55555696e4bd in CClient::Run() /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:3260:4
    #6 0x5555569caa8b in main /home/user/.local/bin/ddnet/src/src/engine/client/client.cpp:4753:11
    #7 0x7ffff4ea9d09 in __libc_start_main csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/user/.local/bin/ddnet/src/src/game/client/laser_data.cpp:36:27 in ExtractLaserInfoDDNet(CNetObj_DDNetLaser const*, CGameWorld*)
Shadow bytes around the buggy address:
  0x62000001db80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x62000001dc00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x62000001dc80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x62000001dd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x62000001dd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x62000001de00: 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa
  0x62000001de80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x62000001df00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x62000001df80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x62000001e000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x62000001e080: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
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
==10996==ABORTING
```
2022-12-04 10:19:35 +01:00
louis b5eef1b64b added offset, fix my git issues
added demomarker offset

Revert "why is this here"

This reverts commit a8c74b612300d6563b28a2bea733a0d3a7dd7f90.

fix
2022-12-03 23:41:50 -06:00
bors[bot] 8d17670c67
Merge #6082
6082: Fix incorrect cursor position after exiting pause/spec r=def- a=Robyt3

The cursor position was not correctly restored when exiting pause or spec, when the mouse was on the left side of the tee (x being negative).

This is caused by a calculation introduced in #1637 and #1830 that tries to ensure that the mouse can still be moved if it ends up inside the minimum mouse distance (`cl_mouse_min_distance` and `cl_dyncam_min_distance`). However, this did not consider that the x position can become negative, so the x position was also incorrectly changed when exiting pause.

This is fixed by reverting the changes, as this code has become obsolete and has been superseded by #2009 and #3884. The `CControls::ClampMousePos` function, which is called directly after restoring the position, already ensures that mouse is not stuck within the minimum mouse distance.

Closes #2591.

## Checklist

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


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-12-03 22:39:20 +00:00
Robert Müller c3286ff263 Fix incorrect cursor position after exiting pause/spec
The cursor position was not correctly restored when exiting pause or spec, when the mouse was on the left side of the tee (x being negative).

This is caused by a calculation introduced in #1637 and #1830 that tries to ensure that the mouse can still be moved if it ends up inside the minimum mouse distance (`cl_mouse_min_distance` and `cl_dyncam_min_distance`).
However, this did not consider that the x position can become negative, so the x position was also incorrectly changed when exiting pause.

This is fixed by reverting the changes, as this code has become obsolete and has been superseded by #2009 and #3884. The `CControls::ClampMousePos` function, which is called directly after restoring the position, already ensures that mouse is not stuck within the minimum mouse distance.

Closes #2591.
2022-12-03 22:20:53 +01:00
Robert Müller 5903c25799 Add cancel button to country popup, confirm with list item activation
Add "Cancel" button to country/region picker popup. It's already possible to cancel with the Escape key, so there should also be a button, which keeps the current selection.

Delegate the listbox activation (enter / double click on item) to the popup to confirm it. Enter was previously working but then broken by the logic that ensures that every hotkey is only consumed once. Now both enter and double click confirm the popup.

From teeworlds/teeworlds#2961.
2022-12-03 13:52:23 +01:00