Commit graph

16026 commits

Author SHA1 Message Date
c0d3d3v c579e2637f
let lasers bounce with zero energy for one tick 2022-06-10 15:16:41 +02:00
Dennis Felsing 79fb7b1f81 Update readme about ddnet-libs (fixes #5377) 2022-06-10 15:08:55 +02:00
bors[bot] 37780cbe6f
Merge #5106
5106: Fix dummy intended tick sent to server r=def- a=sjrc6

fixes https://github.com/ddnet/ddnet/issues/5044

Currently the dummy gives the server the wrong IntendedTick aka PredTick which (I think) makes it impossible for the server to correctly order inputs if they come early (i.e. if you're playing with high prediction margin).

Currently with dummy copy if you switch dummy with high prediction margin it will almost always desync, with this change it doesn't desync. 

The only reason dummy works at all is because it relies on this code in the server to change the tick that was sent to be the current game tick, if you remove it then dummy hammer and dummy copy breaks but normal players are unaffected.

e9b59e72ff/src/engine/server/server.cpp (L1632-L1633) 

I marked this PR as draft because it seems to cause some unexpected side effects:

with this change if you use dummy copy in solo part your dummy will be visually delayed, this doesn't change anything but it's different from how it was before and I don't understand why. 

the sound effects from hooking with dummy copy are also not as synced as they are with the wrong tick being sent (not sure why) 

I also didn't test all dummy mechanics or any advanced dummy binds which might somehow rely on the broken behavior. 


With wrong tick sent to server:

https://user-images.githubusercontent.com/22122579/168413464-92a3a44b-3b75-4894-8fb0-54e64ff421fa.mp4

With correct tick:

https://user-images.githubusercontent.com/22122579/168413459-eb6f299c-260a-4ddb-9972-3dea504aef41.mp4






## 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 if it works standalone, system.c especially
- [ ] 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: Tater <Mr.Potatooh@gmail.com>
2022-06-09 21:52:19 +00:00
bors[bot] 52c78e9fd2
Merge #5376
5376: Minor improvement for pagination r=heinrich5991 a=def-

I thought I had committed this for #5375, but forgot

<!-- 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 if it works standalone, system.c especially
- [ ] 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-06-09 09:27:19 +00:00
Dennis Felsing d6e6599c8f Minor improvement for pagination
I thought I had committed this for #5375, but forgot
2022-06-09 11:24:19 +02:00
bors[bot] 16b8806302
Merge #5375
5375: Paginate bans (partially fixes #3691) r=Learath2 a=def-

20 elements per page, we have too many bot bans
![Screenshot 2022-06-08 at 23 53 16](https://user-images.githubusercontent.com/2335377/172724048-70d99f57-4e3c-451a-ada3-96affdf7cd6c.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 if it works standalone, system.c especially
- [ ] 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-06-09 09:03:16 +00:00
bors[bot] d9a6175e30
Merge #5372
5372: Get best Time Checkpoints back if map has one, add /timecp, remove sv_checkpoint_save r=heinrich5991 a=def-

Even if you made a better finish without time cps before. Can happen now
that we add Time CPs to existing maps:
https://docs.google.com/spreadsheets/d/1yMMBLSbS2cOSYsbIMkDZpMLaV6k930mXj5yVZF0Uuaw/edit#gid=0

As suggested by snail

<!-- 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
- [x] Written a unit test if it works standalone, system.c especially
- [ ] 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-06-09 08:34:20 +00:00
Dennis Felsing 2fceb1aa27 Paginate bans (partially fixes #3691)
20 elements per page, we have too many bot bans
2022-06-08 23:48:32 +02:00
Dennis Felsing 1e94d1fa79 Remove sv_checkpoint_save 2022-06-08 21:10:40 +02:00
Dennis Felsing 7686dcc921 Add /timecp command to get another players time checkpoints
Useful to compare your performance against another player. Currently can
only be done by renaming yourself to the player's name
2022-06-08 21:10:36 +02:00
Dennis Felsing a2cd441d1c Get best Time Checkpoints back if map has one
Even if you made a better finish without time cps before. Can happen now
that we add Time CPs to existing maps:
https://docs.google.com/spreadsheets/d/1yMMBLSbS2cOSYsbIMkDZpMLaV6k930mXj5yVZF0Uuaw/edit#gid=0
2022-06-08 15:37:50 +02:00
def 5768e52a13 Minor fixes 2022-06-07 00:33:01 +02:00
bors[bot] b8d3deef33
Merge #5369
5369: Refactor engine input in preparation for joystick support r=def- a=Robyt3

Almost done porting joystick support 🥁

## 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 if it works standalone, system.c especially
- [ ] 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-06-06 21:12:45 +00:00
Robert Müller f500ced16e Port scripts/gen_keys.py to Python 3, add missing NOLINT comment 2022-06-06 22:14:05 +02:00
Robert Müller 86e2d6791f Fix memory leak of CInput clipboard text 2022-06-06 22:14:05 +02:00
Robert Müller ec84e81e17 Replace Android-specific member variables with static variables 2022-06-06 22:14:05 +02:00
Robert Müller ff43b32257 Extract UpdateMouseState function 2022-06-06 22:06:56 +02:00
Robert Müller 9a17617a28 Let IInput::MouseRelative return true if mouse was moved 2022-06-06 22:06:56 +02:00
Robert Müller 92503fccec Add comments, order functions, fix parameter names in engine input 2022-06-06 22:06:55 +02:00
def 442ae7dc13 Make it easier to run integration tests
Entire worflow is now:

mkdir san
cd san
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" CFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ..
ninja run_integration_tests
2022-06-06 18:53:59 +02:00
bors[bot] 3ddc4d500b
Merge #5361
5361: Refactoring: Extract CLayerTiles::ShiftImpl, BrushFlipXImpl and BrushFlipYImpl to reduce duplicate code r=heinrich5991 a=Robyt3

There is still more duplicate code but it's tricky to extract.

## 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 if it works standalone, system.c especially
- [ ] 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-06-06 12:00:09 +00:00
bors[bot] 171ac2007b
Merge #5363
5363: Extract CCmdlineFix to call cmdline_fix and cmdline_free automatically r=def- a=Robyt3

Use `CCmdlineFix` RAII wrapper to encapsulate `cmdline_fix` and `cmdline_free` handling. This fixes memory leaks when client/server/tools exit early, as `cmdline_free` was only called on the happy code path.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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-06-06 11:39:17 +00:00
Robert Müller de199d08c0 Fix doxygen comments 2022-06-06 12:50:08 +02:00
Robert Müller e6bd84d4fd Extract CCmdlineFix to call cmdline_fix and cmdline_free automatically 2022-06-06 12:46:58 +02:00
Robert Müller e0e1f49530 Extract BrushFlipXImpl and BrushFlipYImpl 2022-06-06 11:29:52 +02:00
Robert Müller 19e97829ce Extract CLayerTiles::ShiftImpl 2022-06-06 10:59:36 +02:00
bors[bot] d49b7b1561
Merge #5351
5351: Refactoring: Use MultiByteToWideChar instead of str_utf16le_encode r=heinrich5991 a=Robyt3



## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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-06-06 08:41:14 +00:00
Robert Müller fca867702e Add error messages when log message encoding cannot be converted 2022-06-06 10:28:47 +02:00
bors[bot] 62c13f2504
Merge #5360
5360: Don't write null byte r=heinrich5991 a=def-

Thanks to heinrich5991 for noticing: https://github.com/ddnet/ddnet/pull/5341#pullrequestreview-996061345

<!-- 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 if it works standalone, system.c especially
- [ ] 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-06-06 08:22:34 +00:00
bors[bot] ae8e82e138
Merge #5359
5359: Fix input getter for dummy r=def- a=trml

Bug reported on discord by Broso56 that dummy is wrongly predicted with deepfly (and when standing still).

Looked at it and found that it was caused by GetInput not returning the dummy input as intended. (Before my last pr a different getter was used, which didn't have that problem)

## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: trml <trml@users.noreply.github.com>
2022-06-06 07:48:41 +00:00
def 8623381529 Don't write null byte
Thanks to heinrich5991 for noticing
2022-06-06 09:47:12 +02:00
trml 2b48c376d6 Fix input getter for dummy 2022-06-06 04:17:55 +02:00
bors[bot] ef5501c4da
Merge #5332
5332: Pass output parameter to WriteFile that is required on Windows 7 r=heinrich5991 a=Robyt3

Maybe closes #5322. I can't reproduce the crash. Can you try if this fixes it, `@Chairn?`

Looks like Windows 7 needs this parameter.

Alternative to #5331.

## 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 if it works standalone, system.c especially
- [ ] 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-06-05 20:52:42 +00:00
bors[bot] eb92852adf
Merge #5344
5344: Log rcon messages (fixes #5342) 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 if it works standalone, system.c especially
- [ ] 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-06-05 20:32:12 +00:00
def de55d49c72 Fix motd undef behavior
Conditional jump or move depends on uninitialised value(s)
   at 0x2158DA: int IServer::SendPackMsg<CNetMsg_Sv_Motd, 0>(CNetMsg_Sv_Motd*, int, int) (server.h:73)
   by 0x1FE02F: CGameContext::SendMotd(int) (gamecontext.cpp:538)
   by 0x20A874: CGameContext::ConchainSpecialMotdupdate(IConsole::IResult*, void*, void (*)(IConsole::IResult*, void*), void*) (gamecontext.cpp:3124)
   by 0x145A23: CConsole::Con_Chain(IConsole::IResult*, void*) (console.cpp:1202)
   by 0x132086: CConsole::ExecuteLineStroked(int, char const*, int, bool) (console.cpp:528)
   by 0x1323A7: CConsole::ExecuteLine(char const*, int, bool) (console.cpp:582)
   by 0x1326B1: CConsole::ExecuteFile(char const*, int, bool, int) (console.cpp:625)
   by 0x1C60E9: main (server.cpp:3874)
 Uninitialised value was created by a heap allocation
   at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x1C5900: CreateServer() (server.cpp:3755)
   by 0x1C5C4C: main (server.cpp:3818)
2022-06-05 20:52:04 +02:00
Robert Müller 3dd2df285a Use MultiByteToWideChar instead of str_utf16le_encode 2022-06-05 20:51:56 +02:00
def 735b0bdf4a fifo: read() doesn't null-terminate!
valgrind found this with ChillerDragon's integration script extension
2022-06-05 20:15:55 +02:00
def 9a89e58a16 Add lsan.supp for opengl leak (fixes #5296)
See also Jupeyy's explanation in
https://github.com/ddnet/ddnet/issues/4294 for why we want to ignore
this:

> sadly components have no OnDestruct on anything like that
> so aslong it doesn't actually leak it's just non destructed memory

So it's something we allocate once for the entire client lifetime from
my understanding.

=================================================================
==421461==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 411760 byte(s) in 10 object(s) allocated from:
    #0 0x55eaf0c08a29 in malloc (/media/ddnet/integration_test/DDNet+0x736a29)
    #1 0x55eaf0de9f72 in CCommandProcessorFragment_OpenGL2::Cmd_CreateBufferObject(CCommandBuffer::SCommand_CreateBufferObject const*) /media/ddnet/src/engine/client/backend/opengl/backend_opengl.cpp:1898:25
    #2 0x55eaf0dd82f5 in CCommandProcessorFragment_OpenGL::RunCommand(CCommandBuffer::SCommand const*) /media/ddnet/src/engine/client/backend/opengl/backend_opengl.cpp
    #3 0x55eaf0f73229 in CCommandProcessor_SDL_GL::RunBuffer(CCommandBuffer*) /media/ddnet/src/engine/client/backend_sdl.cpp:246:20
    #4 0x55eaf0f70568 in CGraphicsBackend_Threaded::ThreadFunc(void*) /media/ddnet/src/engine/client/backend_sdl.cpp:75:25
    #5 0x55eaf0d679d7 in thread_run(void*) /media/ddnet/src/base/system.cpp:686:2
    #6 0x7f08b788c54c  (/usr/lib/libc.so.6+0x8c54c)

SUMMARY: AddressSanitizer: 411760 byte(s) leaked in 10 allocation(s).
2022-06-05 20:01:02 +02:00
ChillerDragon 44a79d5783 Add chat and rcon to integration test 2022-06-05 19:26:39 +02:00
def 1db79fb493 Log rcon messages (fixes #5342) 2022-06-05 19:26:39 +02:00
ChillerDragon eebabaaf82 Fix indent 2022-06-05 19:26:22 +02:00
bors[bot] 152ee93e16
Merge #5347
5347: Fix deleting envelopes not updating sounds r=def- a=C0D3D3V

Original fix by Ravie... updated to latest code

I do not really know how to trigger the bug, but for me adding and deleting sounds to the map, worked.... Since it is only the updated version from Ravie I think it works
`@HiRavie` maybe you can test it again

## 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 if it works standalone, system.c especially
- [ ] 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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
2022-06-05 15:20:58 +00:00
c0d3d3v 52b717f848
Fix deleting envelopes not updating sounds 2022-06-05 15:21:00 +02:00
bors[bot] 94c5f0df32
Merge #5341
5341: Don't write aAnsi when it's not filled (fixes #5340) 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 if it works standalone, system.c especially
- [ ] 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-06-05 11:51:00 +00:00
def 47b9512212 Add Integration test to pr template 2022-06-05 12:51:34 +02:00
def af3b1bb0e7 Log rcon messages (fixes #5342) 2022-06-05 12:44:15 +02:00
def ea5999d1da Don't write aAnsi when it's not filled (fixe #5340) 2022-06-05 11:30:54 +02:00
bors[bot] b554039740
Merge #5320
5320: Fix prediction input timing r=def- a=trml

Fixes #5307 by updating the prediction to use the new input handling from #5032, and also removed some now no longer used code.

## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: trml <trml@users.noreply.github.com>
2022-06-04 22:37:03 +00:00
bors[bot] 54359326cf
Merge #5337
5337: Refactor tools r=def- a=Robyt3

- Fix/improve variable names.
- Move variable declarations.
- ~~Use `class` instead of `struct` (https://github.com/ddnet/ddnet/issues/5297#issuecomment-1144250491).~~
- Use `nullptr` instead of `0`.
- Pass `nullptr` to `GetItem` when output value is unused.
- Add null-checks for storage.
- Add missing checks for layer type in `map_diff` tool.

## 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 if it works standalone, system.c especially
- [ ] 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-06-04 17:26:04 +00:00
Robert Müller fda98a3ef4 Rename variables and use class in crapnet tool 2022-06-04 17:21:27 +02:00