mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Reduce some instances of useless data shuffling
This commit is contained in:
parent
362e4505e8
commit
731b84d725
3 changed files with 11 additions and 24 deletions
|
@ -480,12 +480,11 @@ void RemoteClient::SetBlockNotSent(v3s16 p)
|
|||
m_blocks_modified.insert(p);
|
||||
}
|
||||
|
||||
void RemoteClient::SetBlocksNotSent(std::map<v3s16, MapBlock*> &blocks)
|
||||
void RemoteClient::SetBlocksNotSent(const std::vector<v3s16> &blocks)
|
||||
{
|
||||
m_nothing_to_send_pause_timer = 0;
|
||||
|
||||
for (auto &block : blocks) {
|
||||
v3s16 p = block.first;
|
||||
for (v3s16 p : blocks) {
|
||||
// remove the block from sending and sent sets,
|
||||
// and mark as modified if found
|
||||
if (m_blocks_sending.erase(p) + m_blocks_sent.erase(p) > 0)
|
||||
|
@ -707,12 +706,12 @@ std::vector<session_t> ClientInterface::getClientIDs(ClientState min_state)
|
|||
return reply;
|
||||
}
|
||||
|
||||
void ClientInterface::markBlockposAsNotSent(const v3s16 &pos)
|
||||
void ClientInterface::markBlocksNotSent(const std::vector<v3s16> &positions)
|
||||
{
|
||||
RecursiveMutexAutoLock clientslock(m_clients_mutex);
|
||||
for (const auto &client : m_clients) {
|
||||
if (client.second->getState() >= CS_Active)
|
||||
client.second->SetBlockNotSent(pos);
|
||||
client.second->SetBlocksNotSent(positions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue