* master: (87 commits)
Remove base/tl/string.h
Replace remaining usage of base/tl/string with std::string
Remove unused includes of base/tl/string.h
Store localized strings in a CHeap instead of using tl/string.h
Mark methods as const
Add CHeap::StoreString method
Rules are chat responses too
Add margins to demo slice popup, decrease error font size, UI scaling
Remove redundant parameters which are overridden later
Use Margin instead of both VMargin and HMargin
Move variable declaration
Only output messages intended for chat to the user of a chat command
Remove unused chat response variables
Don't print the first "Waiting for score threads to complete"
fix usage of undefined behavior for default eyes
remove duplicate HOOK_RETRACTED assignment
do not send swap request notification to complete team 0
make swap messages more personal
Move ninja shield to other position (fixes#5047)
do not release the hooks if you swap
...
5073: Replace base/tl/string.h with CHeap for localization and std::string for other usages r=def- a=Robyt3
Cherry-pick changes from upstream (https://github.com/teeworlds/teeworlds/pull/3116).
Replace remaining usages of `string` from `base/tl/string.h` with `std::string`.
## 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>
5070: Rules are chat responses too r=heinrich5991 a=def-
Thanks to bencie for report
<!-- 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>
5060: Only output messages intended for chat to the user of a chat command r=def- a=heinrich5991
Fixes#5052.
The problem seems to be that there are two different concepts tangled up
in console/logging. One is actual logging as in other programs. The
other is "responses to the user of the command that was just entered",
like for rcon or chat commands. This issue isn't fixed by this commit.
## 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: heinrich5991 <heinrich5991@gmail.com>
5061: Improve demo slice popup, minor refactoring of UI/menus r=def- a=Robyt3
Improve demo slice popup:
- add more margins
- decrease font size of error message slightly
- correct handling of all allowed UI scale values:
- fix overlapping elements on some UI scales by laying out all CUIRects (except the buttons) from top to bottom
- make `New name:` label scaled
Refactoring:
- Use `CUI::Margin` instead of both `HMargin` and `VMargin`, when the margin value is identical.
- Pass 0 instead of CUIRect pointer in some cases where the value is never used, i.e. never read and overridden in the next line.
Before:
![screenshot_2022-05-01_00-18-26](https://user-images.githubusercontent.com/23437060/166140703-1050b122-bb8f-49a4-b398-f7b0b6e677a7.png)
After:
![screenshot_2022-05-01_12-05-00](https://user-images.githubusercontent.com/23437060/166141455-50876142-13f9-4563-af0f-9f78a519ed60.png)
Tested with `ui_scale 50/90/100/110/150`.
## 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 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>
5037: Add logging macros `log_{error,warn,info,debug,trace}` r=def- a=heinrich5991
This makes it almost as short to log as with `dbg_msg` (one to two more
characters), and much shorter than
`Console()->Print(IConsole::OUTPUT_LEVEL_{STANDARD,ADDINFO,DEBUG})`.
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
5059: Don't print the first "Waiting for score threads to complete" r=def- a=heinrich5991
Looks nicer IMO if you don't show the message if there's no actual
waiting.
## 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: heinrich5991 <heinrich5991@gmail.com>
Fixes#5052.
The problem seems to be that there are two different concepts tangled up
in console/logging. One is actual logging as in other programs. The
other is "responses to the user of the command that was just entered",
like for rcon or chat commands. This issue isn't fixed by this commit.
5058: Fix undefined behavior in default eyes string formating r=heinrich5991 a=sjrc6
https://github.com/ddnet/ddnet/issues/5056
stop using the same buffer as dest and source.
<!-- 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: Tater <Mr.Potatooh@gmail.com>
5049: do not release the hooks if you swap r=C0D3D3V a=C0D3D3V
Needs more testing, but first test looks good
https://streamable.com/ypra11
## 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
- [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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
5050: Move ninja shield to other position (fixes#5047) r=C0D3D3V a=def-
Quick fix for now, until c0d3d3v's new HUD is done, then could be moved
to a new graphics file entirely.
![screenshot_2022-04-30_11-43-36](https://user-images.githubusercontent.com/2335377/166100515-f9d40104-32a9-41b2-b480-cda18326ac60.png)
<!-- What is the motivation for the changes of this pull request -->
## 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: def <dennis@felsin9.de>
5048: fix tooltips rendering when they shouldn't, fixes#5035 r=def- a=edg-l
<!-- What is the motivation for the changes of this pull request -->
fixes#5035
## 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: Edgar Luque <git@edgarluque.com>
5046: Revert "Get rid of optional, not available on Debian9 build" r=edg-l a=def-
This reverts commit 4e3d5c5626.
Should work again with clang++-7 and libc++-7. See
2534d627ac
So I discovered that clang 7 is available on Debian 9, and it claims to have full C++17 support.
<!-- 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>
5042: Fix flashing colors in console when scrolling up continuously r=def- a=Robyt3
When going beyond the last page it was previously redrawn in a hacky way, which was also not updated to use the correct console colors, so the colors would flash white when holding the page up key.
The underlying fix is the same as on upstream https://github.com/teeworlds/teeworlds/pull/3063. The rendered page will only be changed after the log has already been rendered, to ensure that the page can be clamped correctly.
Closes#5040.
## 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>
5013: Unify logging infrastructure between `IConsole` and `dbg_msg` r=def- a=heinrich5991
This makes the "black console window" less important on Windows (or
anywhere else, for that matter), lets you see logs from other threads in
the f1 console, and removes the distinction between `IConsole::Print`
and `dbg_msg`.
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
5038: Fix wrong quad offset for (not caused by transparent) flushes r=def- a=Jupeyy
Fixes the issue from cheeser0613 in discord, that showed a quad that shouldnt exists.
The quadoffset is only +1 if the current quad is fully transparent(this was added a while ago to improve performance of the firework background).
This affects OpenGL 3.3 & Vulkan and was introduced with the Vulkan change.
## 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: Jupeyy <jupjopjap@gmail.com>
This makes it almost as short to log as with `dbg_msg` (one to two more
characters), and much shorter than
`Console()->Print(IConsole::OUTPUT_LEVEL_{STANDARD,ADDINFO,DEBUG})`.
This makes the "black console window" less important on Windows (or
anywhere else, for that matter), lets you see logs from other threads in
the f1 console, and removes the distinction between `IConsole::Print`
and `dbg_msg`.
5034: Ignore non-zero offset to null pointer in json.c (fixes#5031) r=heinrich5991 a=def-
Since we have no control over this library
<!-- 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>
4732: start documenting system.h with doxygen r=def- a=edg-l
work in progress
Co-authored-by: Edgar Luque <git@edgarluque.com>
Co-authored-by: Edgar <git@edgarluque.com>