Commit graph

15168 commits

Author SHA1 Message Date
heinrich5991 7c984df17a Fix UDP connectivity check
The nonsensical index of `m_aNetClients` was introduced during my
rebasing of #5205.

Fixes #5618.
2022-07-11 20:48:28 +02:00
bors[bot] abc9929d35
Merge #5615
5615: Fix Text Alignments in Popups r=def- a=blueskyGH

Fixed the alignment issues in Popups.

Examples:
Before
 ![screenshot_2022-07-11_02-19-13](https://user-images.githubusercontent.com/108560485/178168210-071fbad9-dc59-4caf-94d9-b5ab0dea3f01.png)
![screenshot_2022-07-11_02-20-25](https://user-images.githubusercontent.com/108560485/178168199-4fabe057-69a5-4699-a8cf-858ac2d81811.png)

After
![screenshot_2022-07-11_02-36-26](https://user-images.githubusercontent.com/108560485/178168906-51f40cdf-3e1f-45e4-84a6-56e6056884f6.png)
![screenshot_2022-07-11_02-36-39](https://user-images.githubusercontent.com/108560485/178168909-f9825083-775d-487a-8704-2921e9b25a89.png)


Its my first PR for actual code. Please indulge me. :) 

We still need to get rid of the "ExtraAlign" variable and only use TextWidth().
But somehow TextWidth() doesn't work properly in this case. 
Hopefully a more experienced collaborator can have a look at these lines:
bbca48aa5b (diff-3aebb8cc835bb888d687b51e9dcfc0cda5326d89fd1c97ff83d85c00b82ed116L1656-R1657)

## 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 (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: blueskyGH <108560485+blueskyGH@users.noreply.github.com>
2022-07-11 16:11:57 +00:00
bors[bot] bc46465f55
Merge #5539
5539: Remove even more redundant variables to avoid inconsistent states. Fix another swap bug. r=edg-l a=C0D3D3V

See https://youtu.be/jghPB-Y2BsQ

Please review it carefully. 

## 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>
2022-07-11 14:45:30 +00:00
blueskyGH 381394cfff Fix Text Alignments in Popups 2022-07-11 15:47:48 +02:00
c0d3d3v e3fc71d051
Rename "NoSomething" to "SomethingDisabled" 2022-07-11 13:40:01 +02:00
c0d3d3v ebfc053809
Remove even more redundant variables to avoid inconsistent states. Fix another swap bug. 2022-07-11 13:39:52 +02:00
bors[bot] a3001f3bd1
Merge #5205
5205: Allow multiple addresses per server in the serverbrowser r=def- a=heinrich5991

Support is incomplete for `leak_ip_address_to_all_servers` (will only
ping the first address of each server) and for the `leak_ip` setting
(which will also only ping the first address of each server).

Fixes #5158.

## 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>
2022-07-10 23:31:21 +00:00
bors[bot] 9e1b6cd1e9
Merge #5613
5613: Search in $PATH for server executable (fixes #5594) 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 (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: def <dennis@felsin9.de>
2022-07-10 23:08:57 +00:00
def aa788e228c Search in $PATH for server executable (fixes #5594) 2022-07-10 23:59:28 +02:00
bors[bot] 60f44546e0
Merge #5611
5611: Fix minor clang-tidy 14 issues r=def- 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 (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>
2022-07-10 20:41:17 +00:00
Robert Müller a971a16ed5 Fix readability-duplicate-include 2022-07-10 21:57:13 +02:00
Robert Müller ec4175277e Fix readability-container-data-pointer 2022-07-10 21:42:57 +02:00
Robert Müller bf686342df Fix performance-unnecessary-value-param 2022-07-10 21:42:57 +02:00
Robert Müller 99d1fb726c Fix modernize-loop-convert in tests 2022-07-10 21:42:57 +02:00
Robert Müller ad0ca6090a Fix modernize-use-bool-literals 2022-07-10 21:00:40 +02:00
bors[bot] fdefb864a6
Merge #5609
5609: Refactor CRenderTools rectangle drawing r=def- a=Robyt3

Mostly removing duplicate code and making the rectangle drawing methods easier to use.

Eventually I want to move the basic rectangle and circle drawing methods to `IGraphics`, as they are independent from the game 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 (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>
2022-07-10 16:45:35 +00:00
Robert Müller 072b9ebaba Use DrawRoundRectExt instead of DrawRoundRect and remove the latter 2022-07-10 17:19:35 +02:00
Robert Müller cc0f64cc29 Use DrawRect instead of DrawRoundRect in CStatboard
To reduce duplicate code.
2022-07-10 17:19:34 +02:00
Robert Müller 992e5d0d07 Use DrawRect instead of DrawRoundRect in CMotd
To reduce duplicate code.
2022-07-10 17:19:34 +02:00
Robert Müller ab4a4aeb75 Use DrawRect instead of DrawRoundRect in CMenus
To reduce duplicate code.
2022-07-10 17:19:34 +02:00
Robert Müller 0c10b64ee5 Use DrawRect instead of DrawRoundRect in CConsole
To reduce duplicate code.
2022-07-10 17:19:33 +02:00
Robert Müller b571fdf93c Use DrawRect instead of DrawRoundRect/Ext in CScoreboard
To reduce duplicate code.
2022-07-10 17:19:33 +02:00
Robert Müller 76c9d86016 Use DrawRect instead of DrawRoundRect/Ext in CHud
To reduce duplicate code.
2022-07-10 17:19:33 +02:00
Robert Müller e042a22d1e Use DrawRect instead of DrawRoundRect/Ext in CSpectator
To reduce duplicate code.
2022-07-10 17:19:33 +02:00
Robert Müller a0ef36847b Add CRenderTools::DrawRect/4 and make DrawUIRect/4 delegates
So usages of `DrawRoundRect/Ext` can more easily be replaced with `DrawRect/4` and so the basic draw methods can be moved to the engine graphics without depending on the `CUIRect` class.
2022-07-10 17:19:32 +02:00
Robert Müller ebf6ce4d27 More efficient CreateRoundRectQuadContainer with CORNER_NONE
By adding an additional case that only creates a single quad when no corners / rounding are used, like in `DrawRoundRectExt4`.
2022-07-10 17:19:32 +02:00
Robert Müller a9787b15e3 Merge CRenderTools::DrawUIRect4NoRounding into DrawUIRect4
As this is a special case the methods can be merged to reduce the number of public methods.
2022-07-10 17:19:32 +02:00
heinrich5991 8996d152ab Allow multiple connect addresses
This allows the client to connect to servers that have both an IPv4 and
an IPv6 address, even if the client is only connected to one of the two.
The one faster to answer will be picked.

Timeout codes are now generated based on *all* of the server's
addresses.

Fixes #5158.
2022-07-10 16:57:10 +02:00
heinrich5991 89a4a0c5c6 Only compare with old STUN server address if we have any 2022-07-10 16:53:15 +02:00
heinrich5991 a9bf09f769 Move websocket address handling out of the client 2022-07-10 16:53:12 +02:00
heinrich5991 6600024f24 Allow multiple addresses per server in the serverbrowser
Support is incomplete for `leak_ip_address_to_all_servers` (will only
ping the first address of each server) and for the `leak_ip` setting
(which will also only ping the first address of each server).
2022-07-10 16:52:07 +02:00
heinrich5991 2e34cf4d4b Make NETADDR comparable and hashable 2022-07-10 16:39:29 +02:00
bors[bot] bf7dc6c555
Merge #5608
5608: Minor client refactorings 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 (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>
2022-07-10 14:02:28 +00:00
Robert Müller 0d29e6fe3f Rename variable HoverTime -> m_HoverTime 2022-07-10 15:40:17 +02:00
Robert Müller fb1919b9be Fix spaces around documentation comments in tooltip.h 2022-07-10 15:40:17 +02:00
Robert Müller 35483177e8 Use else-if instead of duplicating condition 2022-07-10 15:40:17 +02:00
bors[bot] 01175149e0
Merge #5604
5604: Add 2 changes to formatting-revs so git blame is usable r=heinrich5991 a=def-

With .git/config containing:
```
[blame]
  ignoreRevsFile = formatting-revs.txt
```
<!-- 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 (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: def <dennis@felsin9.de>
2022-07-10 12:11:01 +00:00
def 2aa3969912 Add 2 changes to formatting-revs so git blame is usable
With .git/config containing:
[blame]
  ignoreRevsFile = formatting-revs.txt
2022-07-10 10:15:12 +02:00
bors[bot] 444603faf6
Merge #5603
5603: Fix compilation in video.cpp r=heinrich5991 a=def-

```
/home/deen/isos/ddnet/ddnet-source/src/engine/client/video.cpp:829:9: error: ‘c’ was not declared in this s
cope
  829 |         c->thread_count = 1;
      |         ^
```
<!-- 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 (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: def <dennis@felsin9.de>
2022-07-09 23:11:50 +00:00
def eb14755501 Fix compilation in video.cpp
/home/deen/isos/ddnet/ddnet-source/src/engine/client/video.cpp:829:9: error: ‘c’ was not declared in this s
cope
  829 |         c->thread_count = 1;
      |         ^
2022-07-10 01:08:33 +02:00
bors[bot] e9f95dbefd
Merge #5598
5598: Fix the HUD bug I intoduced with  #5592 r=def- a=C0D3D3V

The bug was, if you spectate other players, the jump display and weapon display was broken.

Use for weapon and jump display now render information instead of the predicted data, so that these Displays are also correct if you spectate other players.
This is necessary since with https://github.com/ddnet/ddnet/pull/5592 this information is no longer present in the predicted character (if the character is not predicted)

## 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
- [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>
2022-07-09 22:13:18 +00:00
bors[bot] 61231ccbd5
Merge #5600
5600: system: Add str_copy() template for fixed array destinations, do some small refactor r=heinrich5991 a=Kaffeine

The commits are self-descriptional. The only note I need to say is that I didn't port whole codebase. It takes significant time to check `str_copy()` call arguments and doing all 500 cases in row would cost me eyes. The remaining parts are game/editor, game/server and tools.

I hope for a fast acceptance because the massive change can not be wrong: I'm removing the `dest size` argument from calls and if the dest size can not be figured out automatically then the code just won't compile.

## 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: Alexander Akulich <akulichalexander@gmail.com>
2022-07-09 16:57:25 +00:00
Alexander Akulich 6d9284adc1 Port some code to str_copy() template 2022-07-09 19:40:58 +03:00
Alexander Akulich c4f188a0e7 system: Add str_copy() template for fixed array destinations 2022-07-09 19:19:21 +03:00
Alexander Akulich 0d72b62daf Replace 3.14159265f with 'pi' from math.h 2022-07-09 19:19:21 +03:00
Alexander Akulich 9db49d9f74 variables.h: Add stub macros definitions to enable code highlight 2022-07-09 19:19:21 +03:00
Alexander Akulich 9faea2ff6e client/menus_ingame: Fix a warning about struct padding
Excessive padding in 'struct CColumn' (8 padding bytes, where 0 is optimal).
2022-07-09 19:16:46 +03:00
Alexander Akulich dd94d662ca client/settings: Use CUI::CORNER enum keys where appropriate 2022-07-09 19:16:46 +03:00
c0d3d3v 57995693ad
Use for weapon and jump display now render information instead of the
predicted data, so that these display are also correct if you spectate
other players.
This is necessery since with https://github.com/ddnet/ddnet/pull/5592
this information is no longer present in the predicted character (if the
chracter is not predicted)
2022-07-09 16:03:16 +02:00
bors[bot] e2f7f53bc8
Merge #5591
5591: (A bit) safer interface for text containers r=def- a=Jupeyy

For #5143
Maybe it helps identifying the problem earlier, maybe not^^

## 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: Jupeyy <jupjopjap@gmail.com>
2022-07-09 09:47:48 +00:00