diff options
-rw-r--r-- | .gitmodules | 9 | ||||
-rw-r--r-- | ClonePlugins.cmd | 7 | ||||
-rw-r--r-- | MCServer/Plugins/.gitignore | 2 | ||||
m--------- | MCServer/Plugins/Core | 0 | ||||
m--------- | MCServer/Plugins/ProtectionAreas | 0 | ||||
m--------- | MCServer/Plugins/TransAPI | 6 | ||||
-rw-r--r-- | MCServer/Plugins/TransAPI/LICENSE | 20 | ||||
-rw-r--r-- | MCServer/Plugins/TransAPI/README.md | 20 | ||||
-rw-r--r-- | MCServer/Plugins/TransAPI/main.lua | 91 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | source/Bindings.cpp | 37 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/LuaState.cpp | 31 | ||||
-rw-r--r-- | source/LuaWindow.cpp | 10 | ||||
-rw-r--r-- | source/Root.cpp | 12 | ||||
-rw-r--r-- | source/Root.h | 3 | ||||
-rw-r--r-- | source/Server.cpp | 5 | ||||
-rw-r--r-- | source/TNTEntity.cpp | 4 | ||||
-rw-r--r-- | source/TNTEntity.h | 8 |
19 files changed, 90 insertions, 179 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..088271457 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "MCServer/Plugins/Core"] + path = MCServer/Plugins/Core + url = git@github.com:mc-server/Core.git +[submodule "MCServer/Plugins/ProtectionAreas"] + path = MCServer/Plugins/ProtectionAreas + url = git@github.com:mc-server/ProtectionAreas.git +[submodule "MCServer/Plugins/TransAPI"] + path = MCServer/Plugins/TransAPI + url = git@github.com:bearbin/transapi.git diff --git a/ClonePlugins.cmd b/ClonePlugins.cmd deleted file mode 100644 index ad1fbe014..000000000 --- a/ClonePlugins.cmd +++ /dev/null @@ -1,7 +0,0 @@ - -:: ClonePlugins.cmd - -:: Clones the base plugins from their respective repos into proper folders (./MCServer/Plugins - -git clone https://github.com/mc-server/Core.git ./MCServer/Plugins/Core -git clone https://github.com/mc-server/ProtectionAreas.git ./MCServer/Plugins/ProtectionAreas
\ No newline at end of file diff --git a/MCServer/Plugins/.gitignore b/MCServer/Plugins/.gitignore deleted file mode 100644 index 010351de2..000000000 --- a/MCServer/Plugins/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Core -ProtectionAreas
\ No newline at end of file diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core new file mode 160000 +Subproject e3a45f34303331be77aceacf2ba53e503ad7284 diff --git a/MCServer/Plugins/ProtectionAreas b/MCServer/Plugins/ProtectionAreas new file mode 160000 +Subproject 3019c7b396221b987cd3f89d422276f764834ff diff --git a/MCServer/Plugins/TransAPI b/MCServer/Plugins/TransAPI new file mode 160000 +Subproject 52e1de4332a026e58fda843aae98c1f51e57199 diff --git a/MCServer/Plugins/TransAPI/LICENSE b/MCServer/Plugins/TransAPI/LICENSE deleted file mode 100644 index 102ed2a36..000000000 --- a/MCServer/Plugins/TransAPI/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Alexander Harkness - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/MCServer/Plugins/TransAPI/README.md b/MCServer/Plugins/TransAPI/README.md deleted file mode 100644 index b037a6732..000000000 --- a/MCServer/Plugins/TransAPI/README.md +++ /dev/null @@ -1,20 +0,0 @@ -TransAPI -======== - -A plugin translation API for MCServer. - -TransAPI is designed to be used with the [client library](https://github.com/bearbin/transapi-client), however there is also a stable API available for use. - -API ---- - - GetLanguage ( cPlayer ) - Returns the user's preferred language (or server default if not set). (ISO 639-1 language code) - - GetConsoleLanguage ( ) - Returns the preferred language for console text. (ISO 639-1 language code) - -Commands --------- - - * /language [lang] - Takes a language code (ISO 639-1) and sets the user's preferred language to that. (tranapi.setlang) diff --git a/MCServer/Plugins/TransAPI/main.lua b/MCServer/Plugins/TransAPI/main.lua deleted file mode 100644 index 2b6f77da6..000000000 --- a/MCServer/Plugins/TransAPI/main.lua +++ /dev/null @@ -1,91 +0,0 @@ --- This plugin copyright Alexander Harkness 2013, licensed under the MIT license. - --- Configuration -g_ServerLang = "en" -g_ConsoleLang = "en" - --- Global Variables -g_Plugin = nil -g_PluginManager = nil -g_PluginDir = nil -g_UserData = nil - --- START WITH DA AWESOME! -function Initialize( Plugin ) - - -- Set up the globals. - g_Plugin = Plugin - g_PluginManager = cRoot:Get():GetPluginManager() - g_PluginDir = Plugin:GetDirectory() - - -- Set up the plugin details. - Plugin:SetName( "TransAPI" ) - Plugin:SetVersion( 1 ) - - -- This is the place for commands! - g_PluginManager:BindCommand("/language", "transapi.setlang", HandleLanguageCommand, " - Set your preferred language (use ISO 639-1)") - - -- Load the userdata file. - g_UserData = cIniFile( g_PluginDir .. "/userdata.ini" ) - if g_UserData ~= true then - LOGERROR( "TransAPI INI file could not be opened!" ) - end - - LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() ) - - return true - -end - -function GetLanguage( Player ) - - -- Returns a language to use. - if g_UserData:ReadFile() == true then - local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" ) - g_UserData:WriteFile() - end - - if userLang == "false" then - return g_ServerLang - else - return userLang - end - -end - -function GetConsoleLanguage() - -- Return the language to use for console messages. - return g_ConsoleLang -end - -function HandleLanguageCommand ( Split, Player ) - - -- If the user is not setting the language, tell them the currently selected one. - if #Split ~= 2 then - - local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" ) - if userLang == "false" then - return g_ServerLang - else - return userLang - end - - end - - -- Set the language. - local success = g_UserData:SetValue( Player:GetName(), "language" Split[2] ) - g_UserData:WriteFile() - - if not success then - Player:SendMessage( "Language could not be set!" ) - else - Player:SendMessage( "Language set!" ) - end - - return true - -end - -function OnDisable() - LOG( "Disabled TransAPI!" ) -end @@ -10,6 +10,8 @@ Installation To install MCServer, you can either download the repository and compile it, or download a pre-compiled version. +If you are cloning the repository, you are required to recursively download the submodules also with `git clone -r`. When pulling, you should use `git pull --recurse-submodules`. You might want to set the base forms as aliases to these. + Compilation instructions are available in the COMPILING file. Linux builds can be downloaded from [the Berboe CI server](http://ci.berboe.co.uk) and windows from xoft's [nightly build service](http://mc-server.xoft.cz). 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/LuaState.cpp b/source/LuaState.cpp index d1a8613b0..4b84df1e5 100644 --- a/source/LuaState.cpp +++ b/source/LuaState.cpp @@ -296,7 +296,6 @@ bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnNam void cLuaState::Push(const AString & a_String) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushcppstring(m_LuaState, a_String); m_NumCurrentFunctionArgs += 1; @@ -309,7 +308,6 @@ void cLuaState::Push(const AString & a_String) void cLuaState::Push(const AStringVector & a_Vector) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first lua_createtable(m_LuaState, a_Vector.size(), 0); int newTable = lua_gettop(m_LuaState); @@ -329,7 +327,6 @@ void cLuaState::Push(const AStringVector & a_Vector) void cLuaState::PushUserType(void * a_Object, const char * a_Type) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Object, a_Type); m_NumCurrentFunctionArgs += 1; @@ -342,7 +339,6 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type) void cLuaState::Push(int a_Value) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushnumber(m_LuaState, a_Value); m_NumCurrentFunctionArgs += 1; @@ -355,7 +351,6 @@ void cLuaState::Push(int a_Value) void cLuaState::Push(double a_Value) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushnumber(m_LuaState, a_Value); m_NumCurrentFunctionArgs += 1; @@ -368,7 +363,6 @@ void cLuaState::Push(double a_Value) void cLuaState::Push(const char * a_Value) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushstring(m_LuaState, a_Value); m_NumCurrentFunctionArgs += 1; @@ -381,7 +375,6 @@ void cLuaState::Push(const char * a_Value) void cLuaState::Push(bool a_Value) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushboolean(m_LuaState, a_Value ? 1 : 0); m_NumCurrentFunctionArgs += 1; @@ -394,7 +387,6 @@ void cLuaState::Push(bool a_Value) void cLuaState::Push(cWorld * a_World) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_World, "cWorld"); m_NumCurrentFunctionArgs += 1; @@ -407,7 +399,6 @@ void cLuaState::Push(cWorld * a_World) void cLuaState::Push(cPlayer * a_Player) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); m_NumCurrentFunctionArgs += 1; @@ -420,7 +411,6 @@ void cLuaState::Push(cPlayer * a_Player) void cLuaState::Push(const cPlayer * a_Player) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); m_NumCurrentFunctionArgs += 1; @@ -433,7 +423,6 @@ void cLuaState::Push(const cPlayer * a_Player) void cLuaState::Push(cEntity * a_Entity) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Entity, "cEntity"); m_NumCurrentFunctionArgs += 1; @@ -446,7 +435,6 @@ void cLuaState::Push(cEntity * a_Entity) void cLuaState::Push(cMonster * a_Monster) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Monster, "cMonster"); m_NumCurrentFunctionArgs += 1; @@ -459,7 +447,6 @@ void cLuaState::Push(cMonster * a_Monster) void cLuaState::Push(cItem * a_Item) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Item, "cItem"); m_NumCurrentFunctionArgs += 1; @@ -472,7 +459,6 @@ void cLuaState::Push(cItem * a_Item) void cLuaState::Push(cItems * a_Items) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Items, "cItems"); m_NumCurrentFunctionArgs += 1; @@ -485,7 +471,6 @@ void cLuaState::Push(cItems * a_Items) void cLuaState::Push(cClientHandle * a_Client) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Client, "cClientHandle"); m_NumCurrentFunctionArgs += 1; @@ -498,7 +483,6 @@ void cLuaState::Push(cClientHandle * a_Client) void cLuaState::Push(cPickup * a_Pickup) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Pickup, "cPickup"); m_NumCurrentFunctionArgs += 1; @@ -511,7 +495,6 @@ void cLuaState::Push(cPickup * a_Pickup) void cLuaState::Push(cChunkDesc * a_ChunkDesc) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc"); m_NumCurrentFunctionArgs += 1; @@ -524,7 +507,6 @@ void cLuaState::Push(cChunkDesc * a_ChunkDesc) void cLuaState::Push(const cCraftingGrid * a_Grid) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid"); m_NumCurrentFunctionArgs += 1; @@ -537,7 +519,6 @@ void cLuaState::Push(const cCraftingGrid * a_Grid) void cLuaState::Push(const cCraftingRecipe * a_Recipe) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe"); m_NumCurrentFunctionArgs += 1; @@ -550,7 +531,6 @@ void cLuaState::Push(const cCraftingRecipe * a_Recipe) void cLuaState::Push(TakeDamageInfo * a_TDI) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo"); m_NumCurrentFunctionArgs += 1; @@ -563,7 +543,6 @@ void cLuaState::Push(TakeDamageInfo * a_TDI) void cLuaState::Push(cWindow * a_Window) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Window, "cWindow"); m_NumCurrentFunctionArgs += 1; @@ -576,7 +555,6 @@ void cLuaState::Push(cWindow * a_Window) void cLuaState::Push(cPlugin_NewLua * a_Plugin) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Plugin, "cPlugin_NewLua"); m_NumCurrentFunctionArgs += 1; @@ -589,7 +567,6 @@ void cLuaState::Push(cPlugin_NewLua * a_Plugin) void cLuaState::Push(const HTTPRequest * a_Request) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest"); m_NumCurrentFunctionArgs += 1; @@ -602,7 +579,6 @@ void cLuaState::Push(const HTTPRequest * a_Request) void cLuaState::Push(cWebAdmin * a_WebAdmin) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin"); m_NumCurrentFunctionArgs += 1; @@ -615,7 +591,6 @@ void cLuaState::Push(cWebAdmin * a_WebAdmin) void cLuaState::Push(const HTTPTemplateRequest * a_Request) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest"); m_NumCurrentFunctionArgs += 1; @@ -628,7 +603,6 @@ void cLuaState::Push(const HTTPTemplateRequest * a_Request) void cLuaState::Push(cTNTEntity * a_TNTEntity) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity"); m_NumCurrentFunctionArgs += 1; @@ -641,7 +615,6 @@ void cLuaState::Push(cTNTEntity * a_TNTEntity) void cLuaState::Push(cCreeper * a_Creeper) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper"); m_NumCurrentFunctionArgs += 1; @@ -654,7 +627,6 @@ void cLuaState::Push(cCreeper * a_Creeper) void cLuaState::Push(Vector3i * a_Vector) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Vector, "Vector3i"); m_NumCurrentFunctionArgs += 1; @@ -667,7 +639,6 @@ void cLuaState::Push(Vector3i * a_Vector) void cLuaState::Push(void * a_Ptr) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first lua_pushnil(m_LuaState); m_NumCurrentFunctionArgs += 1; @@ -680,7 +651,6 @@ void cLuaState::Push(void * a_Ptr) void cLuaState::Push(cHopperEntity * a_Hopper) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity"); m_NumCurrentFunctionArgs += 1; @@ -693,7 +663,6 @@ void cLuaState::Push(cHopperEntity * a_Hopper) void cLuaState::Push(cBlockEntity * a_BlockEntity) { ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity"); m_NumCurrentFunctionArgs += 1; diff --git a/source/LuaWindow.cpp b/source/LuaWindow.cpp index 18cc7650e..1dcfc885f 100644 --- a/source/LuaWindow.cpp +++ b/source/LuaWindow.cpp @@ -48,6 +48,16 @@ cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_Slo cLuaWindow::~cLuaWindow() { + m_Contents.RemoveListener(*this); + + // Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's + // destructor, when the member is already gone. + for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr) + { + delete *itr; + } + m_SlotAreas.clear(); + ASSERT(m_OpenedBy.empty()); } 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 << diff --git a/source/Server.cpp b/source/Server.cpp index fad562973..c43ee83d2 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -355,8 +355,13 @@ bool cServer::Tick(float a_Dt) m_PlayerCount += PlayerCountDiff; } + // Send the tick to the plugins, as well as let the plugin manager reload, if asked to (issue #102): + cPluginManager::Get()->Tick(a_Dt); + + // Let the Root process all the queued commands: cRoot::Get()->TickCommands(); + // Tick all clients not yet assigned to a world: TickClients(a_Dt); if (!m_bRestarting) diff --git a/source/TNTEntity.cpp b/source/TNTEntity.cpp index 84b56d01a..60625667d 100644 --- a/source/TNTEntity.cpp +++ b/source/TNTEntity.cpp @@ -8,7 +8,7 @@ -cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec) : +cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec) : super(etTNT, a_X, a_Y, a_Z, 0.98, 0.98), m_Counter(0), m_MaxFuseTime(a_FuseTimeInSec) @@ -19,7 +19,7 @@ cTNTEntity::cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec -cTNTEntity::cTNTEntity(const Vector3d & a_Pos, float a_FuseTimeInSec) : +cTNTEntity::cTNTEntity(const Vector3d & a_Pos, double a_FuseTimeInSec) : super(etTNT, a_Pos.x, a_Pos.y, a_Pos.z, 0.98, 0.98), m_Counter(0), m_MaxFuseTime(a_FuseTimeInSec) diff --git a/source/TNTEntity.h b/source/TNTEntity.h index a8487b66f..e3eae24f2 100644 --- a/source/TNTEntity.h +++ b/source/TNTEntity.h @@ -16,8 +16,8 @@ class cTNTEntity : public: CLASS_PROTODEF(cTNTEntity); - cTNTEntity(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec); - cTNTEntity(const Vector3d & a_Pos, float a_FuseTimeInSec); + cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec); + cTNTEntity(const Vector3d & a_Pos, double a_FuseTimeInSec); // cEntity overrides: virtual bool Initialize(cWorld * a_World) override; @@ -25,8 +25,8 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; protected: - float m_Counter; ///< How much time has elapsed since the object was created, in seconds - float m_MaxFuseTime; ///< How long the fuse is, in seconds + double m_Counter; ///< How much time has elapsed since the object was created, in seconds + double m_MaxFuseTime; ///< How long the fuse is, in seconds }; |