From 1b5eaa92b562c09ed7cea4de7186ff6541e65e5f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 18 Aug 2012 10:38:15 +0000 Subject: Chat packet handled in the new way; fixed missing packet sending for inventory slot. Again, API change! cPlugin:OnChat() has had its parameters swapped, to match all the other callbacks - Player first, Message second git-svn-id: http://mc-server.googlecode.com/svn/trunk@751 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWorld.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/cWorld.cpp') diff --git a/source/cWorld.cpp b/source/cWorld.cpp index 5bb1e8094..3c1da9945 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -1238,7 +1238,7 @@ void cWorld::Broadcast( const cPacket & a_Packet, cClientHandle * a_Exclude) { continue; } - (*itr)->GetClientHandle()->Send( a_Packet ); + ch->Send( a_Packet ); } } @@ -1264,6 +1264,24 @@ void cWorld::BroadcastToChunkOfBlock(int a_X, int a_Y, int a_Z, cPacket * a_Pack +void cWorld::BroadcastChat(const AString & a_Message, 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->SendChat(a_Message); + } +} + + + + + void cWorld::MarkChunkDirty (int a_ChunkX, int a_ChunkY, int a_ChunkZ) { m_ChunkMap->MarkChunkDirty (a_ChunkX, a_ChunkY, a_ChunkZ); -- cgit v1.2.3