#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"
const char *ClientInterface::statenames[] = {
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);
}
}
}
void send(u16 peer_id, u8 channelnum, NetworkPacket* pkt, bool reliable);
/* send to all clients */
- void sendToAll(u16 channelnum, NetworkPacket* pkt, bool reliable);
+ void sendToAll(NetworkPacket *pkt);
/* delete a client */
void DeleteClient(u16 peer_id);
Send(&pkt);
}
else {
- m_clients.sendToAll(0, &pkt, true);
+ m_clients.sendToAll(&pkt);
}
}
Send(&pkt);
}
else {
- m_clients.sendToAll(0, &pkt, true);
+ m_clients.sendToAll(&pkt);
}
}
pkt << time << time_speed;
if (peer_id == PEER_ID_INEXISTENT) {
- m_clients.sendToAll(0, &pkt, true);
+ m_clients.sendToAll(&pkt);
}
else {
Send(&pkt);
const std::string &check = m_detached_inventories_player[name];
if (peer_id == PEER_ID_INEXISTENT) {
if (check == "")
- return m_clients.sendToAll(0, &pkt, true);
+ return m_clients.sendToAll(&pkt);
RemotePlayer *p = m_env->getPlayer(check.c_str());
if (p)
m_clients.send(p->peer_id, 0, &pkt, true);