Zoom: Correctly verify client passed zoom at the server (#7526)
authorlhofhansl <lhofhansl@yahoo.com>
Mon, 2 Jul 2018 23:16:17 +0000 (16:16 -0700)
committerParamat <paramat@users.noreply.github.com>
Mon, 2 Jul 2018 23:16:17 +0000 (00:16 +0100)
Fixes generation of distant world when not zooming in creative mode
(in creative mode zoom FOV is 15 degrees).

src/clientiface.cpp

index cc52d1fbc57e61d82f96caeb44083c76a83ccfdc..ba24af61fab4ec82abba36a6cef6639078a52e8b 100644 (file)
@@ -199,7 +199,10 @@ void RemoteClient::GetNextBlocks (
        // Distrust client-sent FOV and get server-set player object property
        // zoom FOV (degrees) as a check to avoid hacked clients using FOV to load
        // distant world.
-       float prop_zoom_fov = sao->getZoomFOV() * core::DEGTORAD;
+       // (zoom is disabled by value 0)
+       float prop_zoom_fov = sao->getZoomFOV() < 0.001f ?
+               0.0f :
+               std::max(camera_fov, sao->getZoomFOV() * core::DEGTORAD);
 
        const s16 full_d_max = std::min(adjustDist(m_max_send_distance, prop_zoom_fov),
                wanted_range);