Exported player list states to extra functions.
This commit is contained in:
parent
be6d4a5912
commit
43ed690520
@ -127,7 +127,7 @@ cClientHandle::~cClientHandle()
|
||||
if (!m_Username.empty() && (World != NULL))
|
||||
{
|
||||
// Send the Offline PlayerList packet:
|
||||
World->BroadcastPlayerListItem(*m_Player, 4, this);
|
||||
World->BroadcastPlayerListRemovePlayer(*m_Player, this);
|
||||
}
|
||||
if (World != NULL)
|
||||
{
|
||||
@ -364,8 +364,8 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID,
|
||||
m_Player->SendExperience();
|
||||
|
||||
// Send player list items
|
||||
SendPlayerListItem(*m_Player, 0);
|
||||
World->BroadcastPlayerListItem(*m_Player, 0);
|
||||
SendPlayerListAddPlayer(*m_Player);
|
||||
World->BroadcastPlayerListAddPlayer(*m_Player);
|
||||
World->SendPlayerList(m_Player);
|
||||
|
||||
m_Player->Initialize(*World);
|
||||
@ -2408,9 +2408,45 @@ void cClientHandle::SendPlayerAbilities()
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
void cClientHandle::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
||||
{
|
||||
m_Protocol->SendPlayerListItem(a_Player, a_Action);
|
||||
m_Protocol->SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPlayerListRemovePlayer(const cPlayer & a_Player)
|
||||
{
|
||||
m_Protocol->SendPlayerListRemovePlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
|
||||
{
|
||||
m_Protocol->SendPlayerListUpdateGameMode(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPlayerListUpdatePing(const cPlayer & a_Player)
|
||||
{
|
||||
m_Protocol->SendPlayerListUpdatePing(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
|
||||
{
|
||||
m_Protocol->SendPlayerListUpdateDisplayName(a_Player, a_OldListName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,7 +156,11 @@ public:
|
||||
void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); // tolua_export
|
||||
void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount);
|
||||
void SendPlayerAbilities (void);
|
||||
void SendPlayerListItem (const cPlayer & a_Player, char a_Action);
|
||||
void SendPlayerListAddPlayer (const cPlayer & a_Player);
|
||||
void SendPlayerListRemovePlayer (const cPlayer & a_Player);
|
||||
void SendPlayerListUpdateGameMode (const cPlayer & a_Player);
|
||||
void SendPlayerListUpdatePing (const cPlayer & a_Player);
|
||||
void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName);
|
||||
void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+)
|
||||
void SendPlayerMoveLook (void);
|
||||
void SendPlayerPosition (void);
|
||||
|
@ -266,7 +266,7 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
cTimer t1;
|
||||
if (m_LastPlayerListTime + PLAYER_LIST_TIME_MS <= t1.GetNowTime())
|
||||
{
|
||||
m_World->BroadcastPlayerListItem(*this, 2);
|
||||
// m_World->BroadcastPlayerListUpdatePing(*this);
|
||||
m_LastPlayerListTime = t1.GetNowTime();
|
||||
}
|
||||
|
||||
@ -1164,7 +1164,7 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
|
||||
SetCanFly(false);
|
||||
}
|
||||
|
||||
m_World->BroadcastPlayerListItem(*this, 1);
|
||||
m_World->BroadcastPlayerListUpdateGameMode(*this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +94,11 @@ public:
|
||||
virtual void SendPlayerAbilities (void) = 0;
|
||||
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0;
|
||||
virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) = 0;
|
||||
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) = 0;
|
||||
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) = 0;
|
||||
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) = 0;
|
||||
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) = 0;
|
||||
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) = 0;
|
||||
virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) = 0;
|
||||
virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
|
||||
virtual void SendPlayerMoveLook (void) = 0;
|
||||
virtual void SendPlayerPosition (void) = 0;
|
||||
|
@ -719,30 +719,75 @@ void cProtocol125::SendPaintingSpawn(const cPainting & a_Painting)
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
void cProtocol125::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
if (a_Action == 1)
|
||||
WriteByte (PACKET_PLAYER_LIST_ITEM);
|
||||
WriteString(a_Player.GetName());
|
||||
WriteBool (true);
|
||||
WriteShort (a_Player.GetClientHandle()->GetPing());
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendPlayerListRemovePlayer(const cPlayer & a_Player)
|
||||
{
|
||||
cCSLock Lock(m_CSPacket);
|
||||
WriteByte (PACKET_PLAYER_LIST_ITEM);
|
||||
WriteString(a_Player.GetName());
|
||||
WriteBool (false);
|
||||
WriteShort (0);
|
||||
Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
UNUSED(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendPlayerListUpdatePing(const cPlayer & a_Player)
|
||||
{
|
||||
// It is a simple add player packet in this protocol.
|
||||
SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol125::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
|
||||
{
|
||||
if (a_OldListName == a_Player.GetName())
|
||||
{
|
||||
// Ignore gamemode update
|
||||
return;
|
||||
}
|
||||
|
||||
AString PlayerName(a_Player.GetColor());
|
||||
PlayerName.append(a_Player.GetName());
|
||||
if (PlayerName.length() > 14)
|
||||
{
|
||||
PlayerName.erase(14);
|
||||
}
|
||||
PlayerName += cChatColor::White;
|
||||
cCSLock Lock(m_CSPacket);
|
||||
|
||||
WriteByte ((unsigned char)PACKET_PLAYER_LIST_ITEM);
|
||||
WriteString(PlayerName);
|
||||
WriteBool (a_Action != 4);
|
||||
WriteShort ((a_Action == 4) ? 0 : a_Player.GetClientHandle()->GetPing());
|
||||
// Remove the old name from the tablist:
|
||||
{
|
||||
WriteByte (PACKET_PLAYER_LIST_ITEM);
|
||||
WriteString(a_OldListName);
|
||||
WriteBool (false);
|
||||
WriteShort (0);
|
||||
Flush();
|
||||
}
|
||||
|
||||
SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -65,7 +65,11 @@ public:
|
||||
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
|
||||
virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message
|
||||
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
|
||||
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
|
||||
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
|
||||
virtual void SendPlayerMaxSpeed (void) override;
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
|
@ -777,19 +777,71 @@ void cProtocol172::SendParticleEffect(const AString & a_ParticleName, float a_Sr
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
void cProtocol172::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
if (a_Action == 1)
|
||||
{
|
||||
// Ignore gamemode update
|
||||
return;
|
||||
}
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteString(a_Player.GetName());
|
||||
Pkt.WriteBool(a_Action != 4);
|
||||
Pkt.WriteShort((a_Action == 4) ? 0 : a_Player.GetClientHandle()->GetPing());
|
||||
Pkt.WriteBool(true);
|
||||
Pkt.WriteShort(a_Player.GetClientHandle()->GetPing());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendPlayerListRemovePlayer(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38);
|
||||
Pkt.WriteString(a_Player.GetName());
|
||||
Pkt.WriteBool(false);
|
||||
Pkt.WriteShort(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
|
||||
{
|
||||
// Not implemented in this protocol version
|
||||
UNUSED(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendPlayerListUpdatePing(const cPlayer & a_Player)
|
||||
{
|
||||
// It is a simple add player packet in this protocol.
|
||||
SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol172::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
if (a_OldListName == a_Player.GetName())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the old name from the tablist:
|
||||
{
|
||||
cPacketizer Pkt(*this, 0x38);
|
||||
Pkt.WriteString(a_OldListName);
|
||||
Pkt.WriteBool(false);
|
||||
Pkt.WriteShort(0);
|
||||
}
|
||||
|
||||
SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,11 @@ public:
|
||||
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
|
||||
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
|
||||
virtual void SendPlayerAbilities (void) override;
|
||||
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
|
||||
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
|
||||
virtual void SendPlayerMaxSpeed (void) override;
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
|
@ -793,20 +793,14 @@ void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_Sr
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteVarInt(a_Action);
|
||||
Pkt.WriteVarInt(0);
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteUUID(a_Player.GetUUID());
|
||||
|
||||
switch (a_Action)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
// Add Player
|
||||
Pkt.WriteString(a_Player.GetName());
|
||||
|
||||
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
|
||||
@ -830,36 +824,75 @@ void cProtocol180::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
Pkt.WriteVarInt((UInt32)a_Player.GetGameMode());
|
||||
Pkt.WriteVarInt((UInt32)a_Player.GetClientHandle()->GetPing());
|
||||
Pkt.WriteBool(false);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendPlayerListRemovePlayer(const cPlayer & a_Player)
|
||||
{
|
||||
// Update GameMode
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteVarInt(4);
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteUUID(a_Player.GetUUID());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteUUID(a_Player.GetUUID());
|
||||
Pkt.WriteVarInt((UInt32)a_Player.GetGameMode());
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendPlayerListUpdatePing(const cPlayer & a_Player)
|
||||
{
|
||||
// Update Ping
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteVarInt(2);
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteUUID(a_Player.GetUUID());
|
||||
Pkt.WriteVarInt((UInt32)a_Player.GetClientHandle()->GetPing());
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
|
||||
{
|
||||
UNUSED(a_OldListName);
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
|
||||
Pkt.WriteVarInt(3);
|
||||
Pkt.WriteVarInt(1);
|
||||
Pkt.WriteUUID(a_Player.GetUUID());
|
||||
|
||||
// TODO: Replace this with GetPlayerListName() (It's already done in other pull request)
|
||||
if (a_Player.GetName().empty())
|
||||
{
|
||||
// Update DisplayName
|
||||
Pkt.WriteBool(false);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
else
|
||||
{
|
||||
// Remove player
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled player list item action!");
|
||||
return;
|
||||
}
|
||||
Pkt.WriteBool(true);
|
||||
Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_Player.GetName().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,11 @@ public:
|
||||
virtual void SendPlayerAbilities (void) override;
|
||||
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
|
||||
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
|
||||
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
|
||||
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
|
||||
virtual void SendPlayerMaxSpeed (void) override;
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
|
@ -489,10 +489,50 @@ void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_A
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
|
||||
void cProtocolRecognizer::SendPlayerListAddPlayer(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendPlayerListItem(a_Player, a_Action);
|
||||
m_Protocol->SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendPlayerListRemovePlayer(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendPlayerListRemovePlayer(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendPlayerListUpdateGameMode(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendPlayerListUpdatePing(const cPlayer & a_Player)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendPlayerListUpdatePing(a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
|
||||
{
|
||||
ASSERT(m_Protocol != NULL);
|
||||
m_Protocol->SendPlayerListUpdateDisplayName(a_Player, a_OldListName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,11 @@ public:
|
||||
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
|
||||
virtual void SendPlayerAbilities (void) override;
|
||||
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
|
||||
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
|
||||
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
|
||||
virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
|
||||
virtual void SendPlayerMaxSpeed (void) override;
|
||||
virtual void SendPlayerMoveLook (void) override;
|
||||
virtual void SendPlayerPosition (void) override;
|
||||
|
@ -2153,7 +2153,7 @@ void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src
|
||||
|
||||
|
||||
|
||||
void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude)
|
||||
void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
@ -2163,7 +2163,79 @@ void cWorld::BroadcastPlayerListItem(const cPlayer & a_Player, char a_Action, co
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ch->SendPlayerListItem(a_Player, a_Action);
|
||||
ch->SendPlayerListAddPlayer(a_Player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
cClientHandle * ch = (*itr)->GetClientHandle();
|
||||
if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ch->SendPlayerListRemovePlayer(a_Player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWorld::BroadcastPlayerListUpdateGameMode(const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
cClientHandle * ch = (*itr)->GetClientHandle();
|
||||
if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ch->SendPlayerListUpdateGameMode(a_Player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWorld::BroadcastPlayerListUpdatePing(const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
cClientHandle * ch = (*itr)->GetClientHandle();
|
||||
if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ch->SendPlayerListUpdatePing(a_Player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWorld::BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName, const cClientHandle * a_Exclude)
|
||||
{
|
||||
cCSLock Lock(m_CSPlayers);
|
||||
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
cClientHandle * ch = (*itr)->GetClientHandle();
|
||||
if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ch->SendPlayerListUpdateDisplayName(a_Player, a_OldListName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2686,7 +2758,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer)
|
||||
cClientHandle * ch = (*itr)->GetClientHandle();
|
||||
if ((ch != NULL) && !ch->IsDestroyed())
|
||||
{
|
||||
a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), 0);
|
||||
a_DestPlayer->GetClientHandle()->SendPlayerListAddPlayer(*(*itr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,11 @@ public:
|
||||
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||
virtual void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; // tolua_export
|
||||
void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude = NULL); // tolua_export
|
||||
void BroadcastPlayerListItem (const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastPlayerListUpdatePing (const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
|
||||
void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
|
||||
void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
|
||||
|
Loading…
Reference in New Issue
Block a user