mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Fix cached wanted_range and camera_fov being written with out-of-range value
This commit is contained in:
parent
0e4de28988
commit
73e85b2ebb
@ -1034,9 +1034,9 @@ void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket *
|
||||
s32 yaw = myplayer->getYaw() * 100;
|
||||
u32 keyPressed = myplayer->control.getKeysPressed();
|
||||
// scaled by 80, so that pi can fit into a u8
|
||||
u8 fov = clientMap->getCameraFov() * 80;
|
||||
u8 wanted_range = MYMIN(255,
|
||||
std::ceil(clientMap->getControl().wanted_range / MAP_BLOCKSIZE));
|
||||
u8 fov = std::fmin(255.0f, clientMap->getCameraFov() * 80.0f);
|
||||
u8 wanted_range = std::fmin(255.0f,
|
||||
std::ceil(clientMap->getWantedRange() * (1.0f / MAP_BLOCKSIZE)));
|
||||
|
||||
v3s32 position(pf.X, pf.Y, pf.Z);
|
||||
v3s32 speed(sf.X, sf.Y, sf.Z);
|
||||
@ -1385,8 +1385,9 @@ void Client::sendPlayerPos()
|
||||
return;
|
||||
|
||||
ClientMap &map = m_env.getClientMap();
|
||||
u8 camera_fov = map.getCameraFov();
|
||||
u8 wanted_range = map.getControl().wanted_range;
|
||||
u8 camera_fov = std::fmin(255.0f, map.getCameraFov() * 80.0f);
|
||||
u8 wanted_range = std::fmin(255.0f,
|
||||
std::ceil(map.getWantedRange() * (1.0f / MAP_BLOCKSIZE)));
|
||||
|
||||
u32 keyPressed = player->control.getKeysPressed();
|
||||
bool camera_inverted = m_camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT;
|
||||
|
Loading…
Reference in New Issue
Block a user