diff options
author | madmaxoft <github@xoft.cz> | 2013-08-17 23:58:37 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-17 23:58:37 +0200 |
commit | d287183137a616c9cbb6eb878d2a177fd2cafbd3 (patch) | |
tree | 4fc462fc34648b8b7745cd1ac8d5139722911744 /source | |
parent | The server Tick thread ticks PluginManager. (diff) | |
download | cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar.gz cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar.bz2 cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar.lz cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar.xz cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.tar.zst cuberite-d287183137a616c9cbb6eb878d2a177fd2cafbd3.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/Bindings.cpp | 37 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/Root.cpp | 12 | ||||
-rw-r--r-- | source/Root.h | 3 |
4 files changed, 52 insertions, 2 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 955032df7..30c5e8e34 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:12. +** Generated automatically by tolua++-1.0.92 on 08/17/13 23:54:30. */ #ifndef __cplusplus @@ -20372,6 +20372,40 @@ static int tolua_AllToLua_cRoot_SaveAllChunks00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: BroadcastChat of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_BroadcastChat00 +static int tolua_AllToLua_cRoot_BroadcastChat00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL); +#endif + { + self->BroadcastChat(a_Message); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetProtocolVersionTextFromInt of class cRoot */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00 static int tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00(lua_State* tolua_S) @@ -30174,6 +30208,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); tolua_function(tolua_S,"GetTotalChunkCount",tolua_AllToLua_cRoot_GetTotalChunkCount00); tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cRoot_SaveAllChunks00); + tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cRoot_BroadcastChat00); tolua_function(tolua_S,"GetProtocolVersionTextFromInt",tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00); tolua_endmodule(tolua_S); #ifdef __cplusplus diff --git a/source/Bindings.h b/source/Bindings.h index a51f3667c..fdc3f39d9 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/16/13 10:46:13. +** Generated automatically by tolua++-1.0.92 on 08/17/13 23:54:30. */ /* Exported function */ 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) diff --git a/source/Root.h b/source/Root.h index 262c9b0e5..194b1cbb5 100644 --- a/source/Root.h +++ b/source/Root.h @@ -95,6 +95,9 @@ public: /// Saves all chunks in all worlds void SaveAllChunks(void); // tolua_export + /// Sends a chat message to all connected clients (in all worlds) + void BroadcastChat(const AString & a_Message); // tolua_export + /// Calls the callback for each player in all worlds bool ForEachPlayer(cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << |