forked from Mirrorlandia_minetest/minetest
ClientIface::sendToAll: honor packet configuration (#5590)
This commit is contained in:
parent
98286a24bc
commit
b0be7ab61e
@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "emerge.h"
|
#include "emerge.h"
|
||||||
#include "content_sao.h" // TODO this is used for cleanup of only
|
#include "content_sao.h" // TODO this is used for cleanup of only
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "network/serveropcodes.h"
|
||||||
#include "util/srp.h"
|
#include "util/srp.h"
|
||||||
|
|
||||||
const char *ClientInterface::statenames[] = {
|
const char *ClientInterface::statenames[] = {
|
||||||
@ -678,8 +679,7 @@ void ClientInterface::send(u16 peer_id, u8 channelnum,
|
|||||||
m_con->Send(peer_id, channelnum, pkt, reliable);
|
m_con->Send(peer_id, channelnum, pkt, reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::sendToAll(u16 channelnum,
|
void ClientInterface::sendToAll(NetworkPacket *pkt)
|
||||||
NetworkPacket* pkt, bool reliable)
|
|
||||||
{
|
{
|
||||||
MutexAutoLock clientslock(m_clients_mutex);
|
MutexAutoLock clientslock(m_clients_mutex);
|
||||||
for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin();
|
for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin();
|
||||||
@ -687,7 +687,9 @@ void ClientInterface::sendToAll(u16 channelnum,
|
|||||||
RemoteClient *client = i->second;
|
RemoteClient *client = i->second;
|
||||||
|
|
||||||
if (client->net_proto_version != 0) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ public:
|
|||||||
void send(u16 peer_id, u8 channelnum, NetworkPacket* pkt, bool reliable);
|
void send(u16 peer_id, u8 channelnum, NetworkPacket* pkt, bool reliable);
|
||||||
|
|
||||||
/* send to all clients */
|
/* send to all clients */
|
||||||
void sendToAll(u16 channelnum, NetworkPacket* pkt, bool reliable);
|
void sendToAll(NetworkPacket *pkt);
|
||||||
|
|
||||||
/* delete a client */
|
/* delete a client */
|
||||||
void DeleteClient(u16 peer_id);
|
void DeleteClient(u16 peer_id);
|
||||||
|
@ -1642,7 +1642,7 @@ void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
|
|||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_clients.sendToAll(0, &pkt, true);
|
m_clients.sendToAll(&pkt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1761,7 +1761,7 @@ void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
|
|||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_clients.sendToAll(0, &pkt, true);
|
m_clients.sendToAll(&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1866,7 +1866,7 @@ void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
|||||||
pkt << time << time_speed;
|
pkt << time << time_speed;
|
||||||
|
|
||||||
if (peer_id == PEER_ID_INEXISTENT) {
|
if (peer_id == PEER_ID_INEXISTENT) {
|
||||||
m_clients.sendToAll(0, &pkt, true);
|
m_clients.sendToAll(&pkt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
@ -2519,7 +2519,7 @@ void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
|
|||||||
const std::string &check = m_detached_inventories_player[name];
|
const std::string &check = m_detached_inventories_player[name];
|
||||||
if (peer_id == PEER_ID_INEXISTENT) {
|
if (peer_id == PEER_ID_INEXISTENT) {
|
||||||
if (check == "")
|
if (check == "")
|
||||||
return m_clients.sendToAll(0, &pkt, true);
|
return m_clients.sendToAll(&pkt);
|
||||||
RemotePlayer *p = m_env->getPlayer(check.c_str());
|
RemotePlayer *p = m_env->getPlayer(check.c_str());
|
||||||
if (p)
|
if (p)
|
||||||
m_clients.send(p->peer_id, 0, &pkt, true);
|
m_clients.send(p->peer_id, 0, &pkt, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user