From d287183137a616c9cbb6eb878d2a177fd2cafbd3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 17 Aug 2013 23:58:37 +0200 Subject: Added cRoot:BroadcastChat() to the Lua API. This allows plugins to broadcast a chat message to all connected players. It is a replacement for previously removed cServer:BroadcastChat(). --- source/Root.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/Root.cpp') diff --git a/source/Root.cpp b/source/Root.cpp index 07de0775c..d07cc1ee7 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -478,6 +478,18 @@ void cRoot::SaveAllChunks(void) +void cRoot::BroadcastChat(const AString & a_Message) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) + { + itr->second->BroadcastChat(a_Message); + } // for itr - m_WorldsByName[] +} + + + + + bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback) { for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) -- cgit v1.2.3