5218: do not snap dragger beam, if the target is out of reach r=def- a=C0D3D3V

fixes #5216

## 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
- [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>
This commit is contained in:
bors[bot] 2022-05-25 15:08:27 +00:00 committed by GitHub
commit ac15943e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,7 @@ void CDraggerBeam::Snap(int SnappingClient)
}
// Only players with the dragger beam in their field of view or who want to see everything will receive the snap
vec2 TargetPos = vec2(pTarget->m_Pos.x, pTarget->m_Pos.y);
if(NetworkClippedLine(SnappingClient, m_Pos, TargetPos))
if(distance(pTarget->m_Pos, m_Pos) >= g_Config.m_SvDraggerRange || NetworkClippedLine(SnappingClient, m_Pos, TargetPos))
{
return;
}