Commit graph

11534 commits

Author SHA1 Message Date
Jupeyy 3aef2ebfe0 Make closest_point_on_line safer
Does not change behaviour, all NaNs resulted in false checks
2020-10-17 20:22:13 +02:00
Jupeyy d52cd5c41a Check if distance is bigger than 0
Is safe, the first check even checks if Distance is > 0
The second check, checks if Distance is > something positive
2020-10-17 20:00:18 +02:00
Jupeyy 9f10dba7d1 Fix NaN in ninja muzzle 2020-10-17 19:58:17 +02:00
Jupeyy fa8b8b9324 More Target cleanup 2020-10-17 19:58:07 +02:00
Jupeyy 28ee13949b Fix NaN in gamecore move
Is safe, if the distance is zero and the NaN is created by 0 / 0.0
all values multiplied or checked stay NaN, so no new position is set
2020-10-17 18:45:59 +02:00
Jupeyy c9a1586dec Fix obvious division by zero 2020-10-17 18:24:34 +02:00
Jupeyy 6426e341f3 Fix NaNs created by bad initialization 2020-10-17 18:17:13 +02:00
Jupeyy 331249ed89 Fix NaN in LoadSkin 2020-10-17 17:59:18 +02:00
bors[bot] b93896b37c
Merge #3112
3112: Fix and change text cursor r=def- a=Jupeyy

Pls check if u like the new cusor and if it works now
fixes #3110

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-17 15:00:57 +00:00
Jupeyy 186206d40c Fix and change text cursor 2020-10-17 15:26:33 +02:00
bors[bot] 996270af18
Merge #3120
3120: Embed map sounds by default r=heinrich5991 a=Patiga

Not one ddnet map has a external map sound since there are none which would work that way

Co-authored-by: Patiga <dev@patiga.eu>
2020-10-17 13:16:55 +00:00
Patiga 17e531374c Embed sounds by default 2020-10-17 14:05:06 +02:00
def 28250897d3 Version 15.1.3 2020-10-15 18:59:17 +02:00
bors[bot] 5a8fe3d2b4
Merge #3105
3105: Optimize nameplate rendering. Fix #3103 r=def- a=Learath2

Removes the unnecessary `SnapFindItem` (which is a linear search, ew)

Co-authored-by: Learath <learath2@gmail.com>
2020-10-15 14:29:25 +00:00
Learath 85f385b37b Optimize nameplate rendering. Fix #3103 2020-10-15 15:35:25 +02:00
bors[bot] 9e060d78b0
Merge #3100
3100: Fix offline client that is not in menu r=heinrich5991 a=Jupeyy

E.g. popups like "ddnet-info.json" failed will cause weird NaN glitches, bcs the impl relys on ChangePosition to clean movetime and animation start

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-14 21:54:46 +00:00
bors[bot] 09549ebc85
Merge #3101
3101: Fix hookchains r=heinrich5991 a=Jupeyy

Its already increased by the for loop.
Might have made the hook shorter(for very very long hooks) the past 3 years xd

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-14 21:47:21 +00:00
bors[bot] 66248efa61
Merge #3102
3102: Update ddmax_freeze (by saltyElefant, fixes #3098) r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
2020-10-14 21:35:06 +00:00
bors[bot] 6ed79fff5f
Merge #3099
3099: Add missing UpdateRenderInfo call r=def- a=Jupeyy



Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-14 21:27:28 +00:00
bors[bot] 3fdfe7ea2d
Merge #3054
3054: Remove CRC in all possible places r=def- a=heinrich5991

Some places remain due to net/file format compatibility.

Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-10-14 21:20:53 +00:00
def 34c4166263 Update ddmax_freeze (by saltyElefant, fixes #3098) 2020-10-14 23:15:41 +02:00
Jupeyy ca645bf53e Fix hookchains 2020-10-14 23:03:14 +02:00
Jupeyy 6eb6fad867 Fix offline client that is not in menu 2020-10-14 22:10:48 +02:00
Jupeyy fd0848291d Add missing UpdateRenderInfo call 2020-10-14 19:00:39 +02:00
heinrich5991 a604d913ce Move ghost code to client
It's not used by the server, so there's no reason to put it into the
shared codebase.
2020-10-14 17:08:58 +02:00
heinrich5991 070504b5c8 Update ghost format to v6: Replace CRC with SHA256
To be friendly to other implementors of the format, the CRC field is now
zeroed out instead of completely gone.

Drop support for v2 and v3 of the ghost format, the ghost files should
have been automatically converted by the client already.
2020-10-14 17:08:58 +02:00
heinrich5991 6ff53358d3 Remove code for CRC in most places, except where needed for net compat
This should path the way to remove it altogether in the future.
2020-10-14 17:08:58 +02:00
bors[bot] 812c5c17b9
Merge #3076
3076: Add clang-tidy to CI and enable clang-analyzer checks (supersedes #3075, fixes #3071) r=heinrich5991 a=def-

> 470 warnings treated as errors

The actual work will be fixing those or at least NOLINT(clang-analyzer-optin.cplusplus.VirtualCall) them so we can enable this.

```
$ cmake -GNinja -DWEBSOCKETS=OFF -DMYSQL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVIDEORECORDER=ON -DAUTOUPDATE=OFF -DANTIBOT=OFF -DUPNP=OFF -DPREFER_BUNDLED_LIBS=OFF -DINFORM_UPDATE=OFF -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_C_CLANG_TIDY=clang-tidy .
$ ninja > out
$ grep clang-analyzer out | sed -e "s/.* \[/\[/" | sort | uniq -c | sort -n -r
    477 [clang-analyzer-optin.cplusplus.VirtualCall]
     37 [clang-analyzer-optin.cplusplus.UninitializedObject]
     25 [clang-analyzer-optin.performance.Padding]
     20 [clang-analyzer-deadcode.DeadStores]
      9 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
      7 [clang-analyzer-optin.portability.UnixAPI]
      6 [clang-analyzer-security.insecureAPI.strcpy]
      4 [clang-analyzer-core.CallAndMessage]
      4 [clang-analyzer-security.FloatLoopCounter]
      3 [clang-analyzer-core.UndefinedBinaryOperatorResult]
      2 [clang-analyzer-core.uninitialized.Assign]
      1 [clang-analyzer-unix.Malloc]
      1 [clang-analyzer-cplusplus.NewDeleteLeaks]
      1 [clang-analyzer-cplusplus.NewDelete]
      1 [clang-analyzer-core.NonNullParamChecker]
```

Co-authored-by: Edgar <git@edgarluque.com>
Co-authored-by: def <dennis@felsin9.de>
2020-10-14 14:07:28 +00:00
def 7f38bc0941 Fix clang-analyzer-core.uninitialized.Assign
/media/ddnet/src/engine/shared/dilate.cpp:32:22: warning: The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
2020-10-14 15:45:47 +02:00
def 87b06d307f Fix clang-analyzer-core.UndefinedBinaryOperatorResult
/media/ddnet/src/game/client/animstate.cpp:54:27: warning: The left operand of '*' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
        pSeq->m_X += pAdded->m_X * Amount;
                                 ^
2020-10-14 15:45:47 +02:00
def 6443e708b5 Fix clang-analyzer-core.CallAndMessage
/media/ddnet/src/game/editor/auto_map.cpp:94:17: warning: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage]
                                int RunID = pCurrentConf->m_aRuns.add(NewRun);
                                            ^
2020-10-14 15:45:47 +02:00
def 0867424749 Fix clang-analyzer-security.insecureAPI.strcpy
/media/ddnet/src/engine/server/sql_string_helpers.cpp:74:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
2020-10-14 15:45:47 +02:00
def 98d4baabed Fix clang-analyzer-core.NonNullParamChecker
/media/ddnet/src/game/server/entities/projectile.cpp:201:37: warning: Forming reference to null pointer [clang-analyzer-core.NonNullParamChecker]
                                        Found = GetNearestAirPosPlayer(pTargetChr->m_Pos, &PossiblePos);
                                                                       ^
2020-10-14 15:45:47 +02:00
def 5c1b8cd221 Fix clang-analyzer-deadcode.DeadStores
/media/ddnet/src/game/client/components/statboard.cpp:288:3: warning: Value stored to 'tw' is never read [clang-analyzer-deadcode.DeadStores]
2020-10-14 15:45:47 +02:00
def 7c86dd8e5c Fix external directory in .clang-tidy 2020-10-14 15:45:47 +02:00
def a4f13ed4a8 Fix clang-analyzer-optin.portability.UnixAPI
and mark some false positives

/media/ddnet/src/engine/client/backend_sdl.cpp:329:30: warning: Call to 'malloc' has an allocation size of 0 bytes [clang-analyzer-optin.portability.UnixAPI]
2020-10-14 15:45:43 +02:00
def 469888e156 array: Don't allocate size 0
/media/ddnet/src/game/editor/auto_map.h:30:9: warning: Use of zero-allocated memory [clang-analyzer-cplusplus.NewDelete]
        struct CIndexRule
               ^
2020-10-14 14:54:33 +02:00
def 911cb5cb9b CAutoMapper: Delete pUpdateLayer
/media/ddnet/src/game/editor/auto_map.cpp:433:1: warning: Potential leak of memory pointed to by 'pUpdateLayer' [clang-analyzer-cplusplus.NewDeleteLeaks]
}
^
2020-10-14 14:54:33 +02:00
def 476ac6951f Fix memory leak in lock_create
/media/ddnet/src/base/system.c:805:3: warning: Potential leak of memory pointed to by 'lock' [clang-analyzer-unix.Malloc]
2020-10-14 14:54:33 +02:00
def 7d476c3858 Fix clang-analyzer-security.FloatLoopCounter
[81/219] Building CXX object CMakeFiles/game-shared.dir/src/game/collision.cpp.o
/media/ddnet/src/game/collision.cpp:1197:2: warning: Variable 'f' with floating point type 'float' should not be used as a loop counter [clang-analyzer-security.FloatLoopCounter]
        for(float f = 0; f < d; f++)
        ^
2020-10-14 14:54:33 +02:00
Edgar baa8b93d2f Add clang-tidy to CI and enable clang-analyzer checks
The actual work will be fixing those or at least
NOLINT(clang-analyzer-optin.cplusplus.VirtualCall) them so we can enable
this. Disable checks that we don't want.

Exclude external directory from clang-tidy.
2020-10-14 14:54:33 +02:00
bors[bot] 1fb4f90191
Merge #3092
3092: Use pointer directly for tile layer building r=heinrich5991 a=Jupeyy

Huge maps like back in time 2, will always "only" upload 2MB of data at once, and then wait for the graphics thread to finish building/copying the VRAM, this might increase performance a bit

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-13 22:23:46 +00:00
bors[bot] fd90740982
Merge #3094
3094: check_style CI no longer needs git history r=def- a=heinrich5991



Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2020-10-13 21:40:11 +00:00
heinrich5991 bf576de5b6 check_style CI no longer needs git history 2020-10-13 23:33:51 +02:00
Jupeyy 8e9baedf9a Use pointer directly for tile layer building 2020-10-13 19:52:14 +02:00
bors[bot] 0689466002
Merge #3089
3089: Fix out of bounds access in snapshot delta handling r=heinrich5991 a=axblk

Same as 293209e722 + c87a7b438f in 0.7

Co-authored-by: Redix <redix@hotmail.de>
2020-10-13 17:15:40 +00:00
bors[bot] e11511fe8b
Merge #3086
3086: Fix 2 leaks in CServerBrowser r=def- a=Learath2

The only leaks reported by ASan that are allocated by us. There is one other by SDL and one by X11.

Co-authored-by: Learath2 <learath2@gmail.com>
2020-10-13 16:33:39 +00:00
Learath2 48548090be Fix 2 leaks in CServerBrowser 2020-10-13 18:05:59 +02:00
bors[bot] 6ee362fa0e
Merge #3083
3083: Make menu background camera impl more robust r=def- a=Jupeyy

The vanilla code isnt really robust against short distances, hope this fixes almost all edge cases

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2020-10-13 16:00:42 +00:00
bors[bot] b4450085ed
Merge #3085
3085: Don't waste bytes when we are already aligned r=Jupeyy a=Learath2

This fixes #3084, seems to be enough to make all the data fit in the buffer again.

Co-authored-by: Learath2 <learath2@gmail.com>
2020-10-13 15:53:56 +00:00