1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Make MapEditEvent more complete

SetBlocksNotSent is no longer used.
This commit is contained in:
Jude Melton-Houghton 2022-10-08 10:25:22 -04:00
parent 62ee02b8ba
commit 7701e70dc9
7 changed files with 26 additions and 31 deletions

View file

@ -696,11 +696,13 @@ void Server::AsyncRunStep(bool initial_step)
std::map<v3s16, MapBlock*> modified_blocks;
m_env->getServerMap().transformLiquids(modified_blocks, m_env);
/*
Set the modified blocks unsent for all the clients
*/
if (!modified_blocks.empty()) {
SetBlocksNotSent(modified_blocks);
MapEditEvent event;
event.type = MEET_OTHER;
for (const auto &pair : modified_blocks) {
event.modified_blocks.insert(pair.first);
}
m_env->getMap().dispatchEvent(event);
}
}
m_clients.step(dtime);
@ -1253,17 +1255,6 @@ void Server::onMapEditEvent(const MapEditEvent &event)
m_unsent_map_edit_queue.push(new MapEditEvent(event));
}
void Server::SetBlocksNotSent(std::map<v3s16, MapBlock *>& block)
{
std::vector<session_t> clients = m_clients.getClientIDs();
ClientInterface::AutoLock clientlock(m_clients);
// Set the modified blocks unsent for all the clients
for (const session_t client_id : clients) {
if (RemoteClient *client = m_clients.lockedGetClientNoEx(client_id))
client->SetBlocksNotSent(block);
}
}
void Server::peerAdded(con::Peer *peer)
{
verbosestream<<"Server::peerAdded(): peer->id="