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>
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>
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>
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>
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>
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>
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>
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)
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).
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>
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>
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>
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>
5335: Unfreeze character after teleporting in practice r=def- a=hus3h
From my experience and seeing others play, this would be more convenient. Currently teleporting (while being frozen) to retry a part that doesn't have much space or a platform to stand on is a bit hard, often requiring the player to teleport quickly to a position in air multiple times till the character is unfrozen or teleporting to a different part till the character is ready to be put in the original part again. This can also save some time when practicing in general, and will make /tp feel more like /r. This was added only for the /tp command so it shouldn't affect other teleportation methods.
Something to note is that the character teleported into freeze will have the 1 tick unfreeze to jump or so, but it's practice mode so doesn't seem like something to consider.
## 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: hus3h <39054982+hus3h@users.noreply.github.com>
5334: fix pixel porridge in freeze and ninja bar r=Jupeyy a=C0D3D3V
fixes#5319
## 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
- [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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
5330: Actually fix capital /WHISPER r=Jupeyy a=def-
As reported by kiwq
<!-- 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: Dennis Felsing <dennis@felsin9.de>