本文整理汇总了C++中PlayerSAO::getWantedRange方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerSAO::getWantedRange方法的具体用法?C++ PlayerSAO::getWantedRange怎么用?C++ PlayerSAO::getWantedRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSAO
的用法示例。
在下文中一共展示了PlayerSAO::getWantedRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextBlocks
//.........这里部分代码省略.........
u16 max_simul_sends_setting = g_settings->getU16
("max_simultaneous_block_sends_per_client");
u16 max_simul_sends_usually = max_simul_sends_setting;
/*
Check the time from last addNode/removeNode.
Decrease send rate if player is building stuff.
*/
m_time_from_building += dtime;
if(m_time_from_building < g_settings->getFloat(
"full_block_send_enable_min_time_from_building"))
{
max_simul_sends_usually
= LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS;
}
/*
Number of blocks sending + number of blocks selected for sending
*/
u32 num_blocks_selected = m_blocks_sending.size();
/*
next time d will be continued from the d from which the nearest
unsent block was found this time.
This is because not necessarily any of the blocks found this
time are actually sent.
*/
s32 new_nearest_unsent_d = -1;
// get view range and camera fov from the client
s16 wanted_range = sao->getWantedRange();
float camera_fov = sao->getFov();
// if FOV, wanted_range are not available (old client), fall back to old default
if (wanted_range <= 0) wanted_range = 1000;
if (camera_fov <= 0) camera_fov = (72.0*M_PI/180) * 4./3.;
const s16 full_d_max = MYMIN(g_settings->getS16("max_block_send_distance"), wanted_range);
const s16 d_opt = MYMIN(g_settings->getS16("block_send_optimize_distance"), wanted_range);
const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;
//infostream << "Fov from client " << camera_fov << " full_d_max " << full_d_max << std::endl;
s16 d_max = full_d_max;
s16 d_max_gen = MYMIN(g_settings->getS16("max_block_generate_distance"), wanted_range);
// Don't loop very much at a time
s16 max_d_increment_at_time = 2;
if(d_max > d_start + max_d_increment_at_time)
d_max = d_start + max_d_increment_at_time;
s32 nearest_emerged_d = -1;
s32 nearest_emergefull_d = -1;
s32 nearest_sent_d = -1;
//bool queue_is_full = false;
const v3s16 cam_pos_nodes = floatToInt(camera_pos, BS);
const bool occ_cull = g_settings->getBool("server_side_occlusion_culling");
s16 d;
for(d = d_start; d <= d_max; d++) {
/*
Get the border/face dot coordinates of a "d-radiused"
box
*/