mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Mark liquid and light updates low priority
This commit is contained in:
parent
2a3427a39c
commit
00addc3e5d
5 changed files with 29 additions and 20 deletions
|
@ -422,30 +422,34 @@ void RemoteClient::SentBlock(v3s16 p)
|
|||
" already in m_blocks_sending"<<std::endl;
|
||||
}
|
||||
|
||||
void RemoteClient::SetBlockNotSent(v3s16 p)
|
||||
void RemoteClient::SetBlockNotSent(v3s16 p, bool low_priority)
|
||||
{
|
||||
m_nothing_to_send_pause_timer = 0;
|
||||
|
||||
// remove the block from sending and sent sets,
|
||||
// and reset the scan loop if found
|
||||
if (m_blocks_sending.erase(p) + m_blocks_sent.erase(p) > 0) {
|
||||
// Note that we do NOT use the euclidean distance here.
|
||||
// getNextBlocks builds successive cube-surfaces in the send loop.
|
||||
// This resets the distance to the maximum cube size that
|
||||
// still guarantees that this block will be scanned again right away.
|
||||
//
|
||||
// Using m_last_center is OK, as a change in center
|
||||
// will reset m_nearest_unsent_d to 0 anyway (see getNextBlocks).
|
||||
p -= m_last_center;
|
||||
s16 this_d = std::max({std::abs(p.X), std::abs(p.Y), std::abs(p.Z)});
|
||||
m_nearest_unsent_d = std::min(m_nearest_unsent_d, this_d);
|
||||
// If this is a low priority event, do not reset m_nearest_unsent_d.
|
||||
// Instead, the send loop will get to the block in the next full loop iteration.
|
||||
if (!low_priority) {
|
||||
// Note that we do NOT use the euclidean distance here.
|
||||
// getNextBlocks builds successive cube-surfaces in the send loop.
|
||||
// This resets the distance to the maximum cube size that
|
||||
// still guarantees that this block will be scanned again right away.
|
||||
//
|
||||
// Using m_last_center is OK, as a change in center
|
||||
// will reset m_nearest_unsent_d to 0 anyway (see getNextBlocks).
|
||||
p -= m_last_center;
|
||||
s16 this_d = std::max({std::abs(p.X), std::abs(p.Y), std::abs(p.Z)});
|
||||
m_nearest_unsent_d = std::min(m_nearest_unsent_d, this_d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteClient::SetBlocksNotSent(const std::vector<v3s16> &blocks)
|
||||
void RemoteClient::SetBlocksNotSent(const std::vector<v3s16> &blocks, bool low_priority)
|
||||
{
|
||||
for (v3s16 p : blocks) {
|
||||
SetBlockNotSent(p);
|
||||
SetBlockNotSent(p, low_priority);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,12 +668,12 @@ std::vector<session_t> ClientInterface::getClientIDs(ClientState min_state)
|
|||
return reply;
|
||||
}
|
||||
|
||||
void ClientInterface::markBlocksNotSent(const std::vector<v3s16> &positions)
|
||||
void ClientInterface::markBlocksNotSent(const std::vector<v3s16> &positions, bool low_priority)
|
||||
{
|
||||
RecursiveMutexAutoLock clientslock(m_clients_mutex);
|
||||
for (const auto &client : m_clients) {
|
||||
if (client.second->getState() >= CS_Active)
|
||||
client.second->SetBlocksNotSent(positions);
|
||||
client.second->SetBlocksNotSent(positions, low_priority);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue