Skip to content

Commit

Permalink
Avoid short overflow with large viewing ranges (#14175)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhofhansl committed Dec 28, 2023
1 parent 32e4928 commit bc33648
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clientiface.cpp
Expand Up @@ -228,7 +228,8 @@ void RemoteClient::GetNextBlocks (
wanted_range);
const s16 d_cull_opt = std::min(adjustDist(m_block_cull_optimize_distance, prop_zoom_fov),
wanted_range);
const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;
// f32 to prevent overflow, it is also what isBlockInSight(...) expects
const f32 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;

s16 d_max_gen = std::min(adjustDist(m_max_gen_distance, prop_zoom_fov),
wanted_range);
Expand Down

0 comments on commit bc33648

Please sign in to comment.