6592: Minor refactoring of map and datafile r=def- 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 (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>
6593: Fix uninitialized field causing assertion error with MSVC r=def- a=Robyt3
The modified time was uninitialized for the editor file browser entry corresponding to the downloadedmaps-link. The time is never rendered for links, but the uninitialized time value was still passed to `str_timestamp_ex`, which results in an assertion error due to an incorrect time value being used when compiling with MSVC.
This is fixed by properly initializing the field and also by only calling `str_timestamp_ex` when the time value will be rendered.
Closes#6579.
## 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>
The modified time was uninitialized for the editor file browser entry corresponding to the downloadedmaps-link. The time is never rendered for links, but the uninitialized time value was still passed to `str_timestamp_ex`, which results in an assertion error due to an incorrect time value being used when compiling with MSVC.
This is fixed by properly initializing the field and also by only calling `str_timestamp_ex` when the time value will be rendered.
Closes#6579.
6591: add unit test for updating teamranks r=def- a=edg-l
add unit test for updating teamranks
fixes#6113
## 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 (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: Edgar Luque <git@edgarluque.com>
6590: Make text containers bit safer r=Robyt3 a=Jupeyy
From reading the code I couldn't understand how https://github.com/ddnet/ddnet/issues/5143#issuecomment-1546735484 could happen
either (checked = not the case):
- [x] teini used an outdated client
- [ ] i am blind
- [ ] it was a name/clan -plate, scoreboard entry
- [ ] it leaked somewhere in text.cpp or similar impl
- [ ] it happened because of an outside write.
We don't really come further with this, so we should probably at least try it out?
`@Robyt3` your opinion? We can still always remove it again
## 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: Jupeyy <jupjopjap@gmail.com>
6588: Add default argument to `CDataFileReader/IMap::GetItem` r=def- a=Robyt3
Add default value `nullptr` for `int *pType` and `int *pID` output parameters of `GetItem` functions.
Use `nullptr` instead of `0`.
## 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)
6589: Fix heap-use-after-free when quitting/restarting r=def- a=Robyt3
Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.
Closes#6387 until further notice.
## 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>
6585: Add client_score_kind field to serverinfo (followup) r=Robyt3 a=edg-l
followup on #5960 (fixes conflicts)
It specifies whether the scores are to be interpreted as times (string value starting with "time") or as points (string value starting with "points").
## 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: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
6587: Fix check for changed `os_version_str` return value r=edg-l a=Robyt3
Missing from #6429.
## 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>
6565: Delay disconnecting until after render call r=def- a=Robyt3
When a client component (e.g. the menu or the console) disconnects the client, this immediately unloads the map data but the render call continues as normal. This causes all components rendered after this component to access invalid memory in place of the map, layers and collision data.
This is fixed by delaying the actual disconnecting until after the render call, to ensure that the map data can be safely unloaded.
Closes#6387. Closes#3179.
## 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)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6497: Fix client crash/hang when launching without data directory r=edg-l a=Robyt3
Closes#4638.
## 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)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6429: Minor refactoring of `os_version_str` r=edg-l 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>
6560: Replace EntityEx with new netobjs r=edg-l a=trml
This is a proposal for replacing EntityEx with new netobjects, like suggested in #5860.
- Adds a new DDNetPickup that includes switch number
- a new DDNetProjectile that replaces the old one (which is renamed to DDRaceProjectile)
- includes switch number, tunezone and velocity/speed (plus a flag that can be used to send velocitiy of player projectiles with full precision)
- switch number and subtype is added to DDNetLaser (to distinguish e.g. draggers with different strength)
The pr removes EntityEx from the server, but keeps compatibility in the client.
<!-- 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: trml <trml@users.noreply.github.com>
6584: Show ASan/UBSan logs in CI also for unit and integration tests r=def- a=Robyt3
The ASan/UBSan logs are currently only printed in the CI log when launching the client and server once.
Now the logs are also printed when the unit or integration tests fail due to a sanitizer crash.
A redundant definition of an environment variable is removed.
## 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>
The ASan/UBSan logs are currently only printed in the CI log when launching the client and server once.
Now the logs are also printed when the unit or integration tests fail due to a sanitizer crash.
A redundant definition of an environment variable is removed.
6582: Shutdown SDL after kernel and client r=edg-l a=Robyt3
Register SDL for cleanup before creating the kernel and client, so SDL is shutdown after kernel and client. Otherwise the client may crash when shutting down after SDL is already shutdown.
Closes#6581.
## 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>
Register SDL for cleanup before creating the kernel and client, so SDL is shutdown after kernel and client. Otherwise the client may crash when shutting down after SDL is already shutdown.
Closes#6581.
6580: Fix cl_show_others_alpha not used in places where it can be r=Robyt3 a=edg-l
There are some things like damage indicator, spawn particles, etc which we have no way to properly set alpha based on team/solo knowledge because they don't have any info about that. (to my knowledge)
Fixes#6520
## 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: Edgar <git@edgarluque.com>
Co-authored-by: Edgar Luque <git@edgarluque.com>
6577: Quit client when existing config file cannot be loaded, add `restart` command to client, properly uninitialize all client components 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
- [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)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Track stack of cleaner functions that destruct client components so exactly the correct cleanup is performed in the reverse order of initialization.
This allows performing the cleanup also in the early-return cases without introducing duplicate code.
When the configuration file exists but cannot be loaded, the client continues to launch. When closing, the client then saves the default config and overwrites the existing config that could not be loaded.
This is prevented by quitting the client with an error message popup when the config exists but cannot be loaded.
Closes#3843.
6576: add git mailmap r=def- a=edg-l
add git mailmap, mapping same author email/names to the prefered/most used name
Co-authored-by: Edgar Luque <git@edgarluque.com>
6575: Replace usages of `atan2f` and `atan2` with `std::atan2` r=def- a=Robyt3
Another leftover from #6372.
## 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>
6573: set SDL_MAC_OPENGL_ASYNC_DISPATCH sdl hint to fix macos resizing r=heinrich5991 a=edg-l
Fixes a issue where ddnet freezes on resize on macos
## 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: Edgar <git@edgarluque.com>
6551: Fix Y Alignment by respecting cursor height independent of character … r=Robyt3 a=Jupeyy
…height
since the cursor height is simply the font size, but obv not all characters use the full font size, it must additionally make sure that this size isn't ignored in the y offset calculation (since it makes the characters render at the offset of the cursor height), so basically:
0 + FontSize == Character start
CharacterHeight != FontSize
that moves the character down.
Also added back the render flags, i think it logically makes sense if they are there, since a character could have y bearing, even tho in this case it doesn't seem the case.
fixes#6538
I haven't extensively checked this, and maybe `@Robyt3` prefers to fix it differently, I'd be ok with this, it's just for showcase
## 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: Jupeyy <jupjopjap@gmail.com>