From 60772071e9b63c24a939078c706b713f46bf3279 Mon Sep 17 00:00:00 2001 From: Rogier-5 Date: Sun, 11 Dec 2016 19:49:49 +0100 Subject: Fix computation of viewing range (in blocks) sent to server (#4882) Fixes #4878 Also remove an artificial viewing range reduction that (presumably) was added to compensate for miscomputed viewing ranges, and that doesn't seem to be needed any more (thanks to lhofhansl). --- src/client.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index e9d273c69..7e88e5562 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include #include "threading/mutex_auto_lock.h" #include "util/auth.h" @@ -939,7 +940,7 @@ void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket * u32 keyPressed = myplayer->keyPressed; // scaled by 80, so that pi can fit into a u8 u8 fov = clientMap->getCameraFov() * 80; - u8 wanted_range = clientMap->getControl().wanted_range / MAP_BLOCKSIZE; + u8 wanted_range = std::ceil(clientMap->getControl().wanted_range / MAP_BLOCKSIZE); v3s32 position(pf.X, pf.Y, pf.Z); v3s32 speed(sf.X, sf.Y, sf.Z); @@ -952,7 +953,7 @@ void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket * [12+12+4] s32 yaw*100 [12+12+4+4] u32 keyPressed [12+12+4+4+4] u8 fov*80 - [12+12+4+4+4+1] u8 wanted_range / MAP_BLOCKSIZE + [12+12+4+4+4+1] u8 ceil(wanted_range / MAP_BLOCKSIZE) */ *pkt << position << speed << pitch << yaw << keyPressed; *pkt << fov << wanted_range; -- cgit v1.2.3