Cleanup in content_mapblock (#5746)
[oweals/minetest.git] / src / clientiface.cpp
index 39223d3eb5e05ccb554a66888a3a20a022356937..356281ca67ba7eae4c72d2c77d424c10826fa7e3 100644 (file)
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <sstream>
 
 #include "clientiface.h"
-#include "util/numeric.h"
 #include "remoteplayer.h"
 #include "settings.h"
 #include "mapblock.h"
@@ -30,7 +29,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "emerge.h"
 #include "content_sao.h"              // TODO this is used for cleanup of only
 #include "log.h"
+#include "network/serveropcodes.h"
 #include "util/srp.h"
+#include "face_position_cache.h"
 
 const char *ClientInterface::statenames[] = {
        "Invalid",
@@ -589,9 +590,9 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
        }
 }
 
-u32 RemoteClient::uptime()
+u32 RemoteClient::uptime() const
 {
-       return getTime(PRECISION_SECONDS) - m_connection_time;
+       return porting::getTime(PRECISION_SECONDS) - m_connection_time;
 }
 
 ClientInterface::ClientInterface(con::Connection* con)
@@ -678,16 +679,17 @@ void ClientInterface::send(u16 peer_id, u8 channelnum,
        m_con->Send(peer_id, channelnum, pkt, reliable);
 }
 
-void ClientInterface::sendToAll(u16 channelnum,
-               NetworkPacket* pkt, bool reliable)
+void ClientInterface::sendToAll(NetworkPacket *pkt)
 {
        MutexAutoLock clientslock(m_clients_mutex);
-       for(UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin();
-               i != m_clients.end(); ++i) {
+       for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin();
+                       i != m_clients.end(); ++i) {
                RemoteClient *client = i->second;
 
                if (client->net_proto_version != 0) {
-                       m_con->Send(client->peer_id, channelnum, pkt, reliable);
+                       m_con->Send(client->peer_id,
+                                       clientCommandFactoryTable[pkt->getCommand()].channel, pkt,
+                                       clientCommandFactoryTable[pkt->getCommand()].reliable);
                }
        }
 }