diff options
author | andrew <xdotftw@gmail.com> | 2014-02-23 12:25:02 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-02-23 12:25:02 +0100 |
commit | 30b22e9f59e0873be84e80c83d274dbe5353b835 (patch) | |
tree | 7d4a1de7ac03ccb112340ca80905ae77cfbea77b | |
parent | Documented and exported cMapManager (diff) | |
download | cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar.gz cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar.bz2 cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar.lz cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar.xz cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.tar.zst cuberite-30b22e9f59e0873be84e80c83d274dbe5353b835.zip |
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 2 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 4 | ||||
-rw-r--r-- | src/Map.h | 5 | ||||
-rw-r--r-- | src/MapManager.cpp | 2 | ||||
-rw-r--r-- | src/MapManager.h | 2 |
5 files changed, 12 insertions, 3 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 8265b4e19..c8811df66 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1541,7 +1541,7 @@ a_Player:OpenWindow(Window); ]], Functions = { - DoWithMap = { Params = "ID, Callback", Return = "bool", Notes = "Calls the callback for the map with the specified ID. Returns true if the map was found and the callback called, false if map not found." }, + DoWithMap = { Params = "ID, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If a map with the specified ID exists, calls the CallbackFunction for that map. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cMap|Map}}, [CallbackData])</pre> Returns true if the map was found and the callback called, false if map not found." }, GetNumMaps = { Params = "", Return = "number", Notes = "Returns the number of registered maps." }, }, diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index c220e5e0a..f2d21a682 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2511,6 +2511,10 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines); tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cMapManager"); + tolua_function(tolua_S, "DoWithMap", tolua_DoWithID<cMapManager, cMap, &cMapManager::DoWithMap>); + tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cPlugin"); tolua_function(tolua_S, "Call", tolua_cPlugin_Call); tolua_endmodule(tolua_S); @@ -185,6 +185,11 @@ public: const cColorList & GetData(void) const { return m_Data; } + static const char * GetClassStatic(void) // Needed for ManualBindings's DoWith templates + { + return "cMap"; + } + protected: diff --git a/src/MapManager.cpp b/src/MapManager.cpp index 2fc44ccc8..9d02eafb4 100644 --- a/src/MapManager.cpp +++ b/src/MapManager.cpp @@ -22,7 +22,7 @@ cMapManager::cMapManager(cWorld * a_World) -bool cMapManager::DoWithMap(unsigned int a_ID, cMapCallback & a_Callback) +bool cMapManager::DoWithMap(int a_ID, cMapCallback & a_Callback) { cCSLock Lock(m_CS); cMap * Map = GetMapData(a_ID); diff --git a/src/MapManager.h b/src/MapManager.h index 5da8be035..80e6d16d1 100644 --- a/src/MapManager.h +++ b/src/MapManager.h @@ -45,7 +45,7 @@ public: * Returns true if the map was found and the callback called, false if map not found. * Callback return ignored. */ - bool DoWithMap(unsigned int a_ID, cMapCallback & a_Callback); // tolua_export + bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp /** Calls the callback for each map. * |