5147: Use `check_cxx_compiler_flag` instead of `check_c_compiler_flag` r=def- a=heinrich5991
We only have C++ source files left, take advantage of this and check
whether the C++ compiler supports the flags, not the C compiler. GCC for
example warns about `-Wsuggest-override` in C mode, but supports it in
C++ mode.
## 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: heinrich5991 <heinrich5991@gmail.com>
5001: Ellipsis at end in scoreboard and hud r=heinrich5991 a=def-
Looks nicer to have consistent length in HUD, more clear that something is cut off with the ellipsis.
![screenshot_2022-04-18_12-57-22](https://user-images.githubusercontent.com/2335377/163799128-89788d67-cf3e-4215-b716-7ee0a348f1b2.png)
Thoughts on kill message?
## 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>
We only have C++ source files left, take advantage of this and check
whether the C++ compiler supports the flags, not the C compiler. GCC for
example warns about `-Wsuggest-override` in C mode, but supports it in
C++ mode.
5146: Add override in mysql code too (fixes#5139) r=heinrich5991 a=def-
<!-- 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>
5075: Switch to nanoseconds r=def- a=Jupeyy
Modern hardware is too fast, updates sometimes take less than a few microseconds.
It's easier in the long run if we use a bigger range to avoid calculation problems.
possibly f i x e s #5051 (needs testing from bencie for the main bug, but fixes what `@sjrc6` found)
Also took the moment to use more chrono so we can at some point switch to a typesafe time.
Hopefully I didnt miss any value ^^
## 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>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
5145: Put assert for text containers after printing all non empty text cont… r=def- a=Jupeyy
…ainers
No idea how to reproduce this, gerdoe also has this and send me his config, but no chance
Tho since the text container index is so high, i kinda assume its not the only non cleared text container.
Maybe estimating the character count based on the quads used can also help, since then i can see what text is potentially the cause
## 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: Jupeyy <jupjopjap@gmail.com>
5119: Use STUN to determine UDP connectivity and show diagnostics r=def- a=heinrich5991
These diagnostics are supposed to guide the user to problem resolution.
They're displayed if no packet is received from the server within one
second of connecting.
No message if we don't have STUN servers.
"Trying to determine UDP connectivity..." if no answer has been received
from the STUN server yet and it hasn't timed out yet.
"UDP seems to be filtered." if the STUN request has timed out.
"UDP and TCP IP addresses seem to be different. Try disabling VPN,
proxy or network accelerators." if the STUN request has returned an IP
address different from the one obtained via HTTP from info2.ddnet.tw.
"No answer from server yet." otherwise, if the STUN request has returned
no interesting data, indicating that it's likely the game server's
fault.
## 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: heinrich5991 <heinrich5991@gmail.com>
These diagnostics are supposed to guide the user to problem resolution.
They're displayed if no packet is received from the server within one
second of connecting.
No message if we don't have STUN servers.
"Trying to determine UDP connectivity..." if no answer has been received
from the STUN server yet and it hasn't timed out yet.
"UDP seems to be filtered." if the STUN request has timed out.
"UDP and TCP IP addresses seem to be different. Try disabling VPN,
proxy or network accelerators." if the STUN request has returned an IP
address different from the one obtained via HTTP from info2.ddnet.tw.
"No answer from server yet." otherwise, if the STUN request has returned
no interesting data, indicating that it's likely the game server's
fault.
5133: Fix IPO build problems r=heinrich5991 a=def-
`@Kaffeine`
Windows x86-64 with MinGW worked, previously:
```
-rwxr-xr-x 1 deen deen 755K May 15 11:38 config_retrieve.exe*
-rwxr-xr-x 1 deen deen 756K May 15 11:38 config_store.exe*
-rwxr-xr-x 1 deen deen 2.8M May 15 11:38 DDNet.exe*
-rwxr-xr-x 1 deen deen 2.1M May 15 11:38 DDNet-Server.exe*
-rwxr-xr-x 1 deen deen 761K May 15 11:38 dilate.exe*
-rwxr-xr-x 1 deen deen 763K May 15 11:38 map_convert_07.exe*
-rwxr-xr-x 1 deen deen 756K May 15 11:38 map_diff.exe*
-rwxr-xr-x 1 deen deen 761K May 15 11:38 map_extract.exe*
```
Now:
```
-rwxr-xr-x 1 deen deen 256K May 16 00:26 config_retrieve.exe*
-rwxr-xr-x 1 deen deen 282K May 16 00:26 config_store.exe*
-rwxr-xr-x 1 deen deen 2.8M May 16 00:26 DDNet.exe*
-rwxr-xr-x 1 deen deen 2.0M May 16 00:26 DDNet-Server.exe*
-rwxr-xr-x 1 deen deen 271K May 16 00:26 dilate.exe*
-rwxr-xr-x 1 deen deen 289K May 16 00:26 map_convert_07.exe*
-rwxr-xr-x 1 deen deen 261K May 16 00:26 map_diff.exe*
-rwxr-xr-x 1 deen deen 278K May 16 00:26 map_extract.exe*
```
## 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)
5138: No gold preference (fixes#5136) r=heinrich5991 a=def-
`@Kaffeine` lld is used on some systems, we also have instructions for mold in readme, both are faster than gold.
## 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>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
5140: Enable clang-tidy's modernize-use-override (fixes#5139) r=heinrich5991 a=def-
<!-- 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>
Co-authored-by: Chairn <chairn.nq@hotmail.fr>
5142: Handle file/pipe stdout and add fallback on Windows r=def- a=Robyt3
The `CWindowsConsoleLogger` uses `WriteConsoleW` which only works when the standard output handle is a console (`GetFileType` returns `FILE_TYPE_CHAR`).
When redirecting output into a file, `GetFileType` returns `FILE_TYPE_DISK`. For this case a `CWindowsFileLogger` is added that uses `WriteFile` instead. This works on raw bytes, so the UTF-8 encoded lines are written directly.
When pipeing output or when using custom terminals like Git Bash, `GetFileType` returns `FILE_TYPE_PIPE`. I can't find any documentation how to correctly interact with a pipe stdout handle. So in this case, `WriteFile` is also used, because it works for me with cmd, PowerShell and Git Bash.
Lastly, if the output device is unknown, the default `CLoggerAsync` without ANSI colors is used as fallback.
This fixes output not working in Git Bash. Closes#4422. It also fixes output redirected with Git Bash containing additional line breaks.
For consistency, the `CWindowsConsoleLogger` now writes windows line endings also.
## 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>
src/engine/client/backend_sdl.cpp:580:3: warning: Value stored to 'RetBackendType' is never read [clang-analyzer-deadcode.DeadStores]
RetBackendType = BACKEND_TYPE_OPENGL_ES;
^ ~~~~
5085: New DDRace HUD r=def- a=C0D3D3V
If you want to test this PR, you have to test it on a Server that includes this PR too.
Textures are made by Ravie
Here a showcase video with most parts shown: https://youtu.be/gPTVj-s3pgc
Added to the new HUD
- A display of the weapons available to the player
- The weapon the player is carrying is highlighted
- Indicators for the special abilities of the player (Endless Hook, Endless Jumps, Jetpack, Teleport Weapons)
- Indicators for abilities taken away from the player (Deep/Life Freeze, No Hook, No Weapons collision, No Collision)
- Control indicators for dummy controls (dummy hammer, dummy copy) (bottom right)
- Jump indicator (max 10 jumps ar displayed, and greyed out as soon as a jump is used)
- Ninja status bar that indicates how long a player is capable of using ninja (next to the ninja sword)
- Freeze status bar that indicates the thawing time of a player (below player)
- Movement Information can be displayed in a clean way above the mini score HUD (Position, Speed, Target Angle)
- Indicator if you are in practice mode
The complete HUD also works for players you spectate
I Added a new NetObj since the predicted values are not perfect and would make the display of the information a lot less good: DDNetCharacterDisplayInfo that contains the following information
```
NetIntRange("m_JumpedTotal", -2, 255),
NetTick("m_NinjaActivationTick"),
NetTick("m_FreezeTick"),
NetBool("m_IsInFreeze"),
NetBool("m_IsInPracticeMode"),
NetIntAny("m_TargetX"), # used for the Movement Information display
NetIntAny("m_TargetY"),
NetIntAny("m_RampValue"),
```
So if someone has an idea what data we could also need in the client for making the display more nice, now is the right moment to add more data to this network object.
A few screenshots:
Assets Tab:
![grafik](https://user-images.githubusercontent.com/14315968/167703792-f0fa86be-159d-4e11-baf4-9539cee38aae.png)
HUD Settings:
![grafik](https://user-images.githubusercontent.com/14315968/167704336-dc7a314e-5603-40a2-98b4-9c03377906dd.png)
Mini Debug HUD:
![grafik](https://user-images.githubusercontent.com/14315968/168302791-c377d93e-33a2-4eb2-9d8d-b78f0808a009.png)
Speed.X is calculated using the players ramp vaule
## 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
- [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>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
/usr/lib/gcc/i686-w64-mingw32/11.2.0/../../../../i686-w64-mingw32/bin/ld: /usr/lib/gcc/i686-w64-mingw32/11.2.0/../../../../i686-w64-mingw32/bin/ld: DWARF error: could not find variable specification at offset 378
/usr/lib/gcc/i686-w64-mingw32/11.2.0/../../../../i686-w64-mingw32/lib/../lib/libstdc++.a(string-inst.o): in function `ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag':
/build/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/include/bits/basic_string.tcc:206: multiple definition of `void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)';
glsl_shader_compiler.cpp.obj (symbol from plugin):(.gnu.linkonce.t._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag+0x0): first defined here
...
Fails on Linux x86 with IPO:
In member function '_ZN10CMapLayers17STileLayerVisuals4InitEjj.part.18',
inlined from 'OnMapLoad' at /ddnet-source-steam/src/game/client/components/maplayers.cpp:301:6:
/ddnet-source-steam/src/game/client/components/maplayers.cpp:312:74: warning: argument 1 value '4294967295'
exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]
m_pBorderTop = new CMapLayers::STileLayerVisuals::STileVisual[Width - 2];
^
5132: Refactoring: Use std::swap in editor r=heinrich5991 a=Robyt3
<!-- 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: Robert Müller <robytemueller@gmail.com>
5131: Remove base/tl/base.h r=heinrich5991 a=Robyt3
## 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>
5130: Fix memory leaks in auto stat CSV output, fix stringop-overflow warnings r=def- a=Robyt3
The memory allocated in and returned by `ReplaceCommata` was never freed.
Likewise `m_pCSVstr` allocated in `FormatStats` was never freed.
This also fixes a stringop-overflow warning and that the allocated memory size was missing one byte for the zero terminator.
The `ReplaceCommata` method is now also used for the gametype and map. Although unlikely, commata can be used in gametype and map names, so this prevents invalid CSVs for those cases.
Refactoring: remove unnecessary copy of `pStr` into `aBuf`.
## 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>
5129: update french translations r=def- a=NouaaTW
<!-- 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: Noa <75568768+NouaaTW@users.noreply.github.com>
Co-authored-by: def <dennis@felsin9.de>
And fix stringop-overflow warning:
In function 'str_copy',
inlined from 'FormatStats' at src\game\client\components\statboard.cpp:541:10:
src\base\system.cpp:2524:16: warning: 'strncat' specified bound depends on the length of the source argument [-Wstringop-overflow=]
2524 | strncat(dst, src, dst_size - 1);
| ^
src\game\client\components\statboard.cpp: In member function 'FormatStats':
src\base\system.cpp:2557:27: note: length computed here
2557 | return (int)strlen(str);
| ^
5128: Update Korean translations by CHaBek r=def- a=cwh7435
<!-- 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: CHaBek <44938972+cwh7435@users.noreply.github.com>