]> git.lizzy.rs Git - minetest.git/blobdiff - src/server.cpp
Make MapEditEvent more complete
[minetest.git] / src / server.cpp
index fb2e0db95b33ab8534b8383f8a6f5e5a1f79f686..a20e82856e889c44a408f5b3efd3f8b7a52cdf67 100644 (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="