1
0

Manually exported DoWithMap

This commit is contained in:
andrew 2014-02-23 13:25:02 +02:00
parent 9fa4fa1cc7
commit 30b22e9f59
5 changed files with 12 additions and 3 deletions

View File

@ -1541,7 +1541,7 @@ a_Player:OpenWindow(Window);
]], ]],
Functions = 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." }, GetNumMaps = { Params = "", Return = "number", Notes = "Returns the number of registered maps." },
}, },

View File

@ -2511,6 +2511,10 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines); tolua_function(tolua_S, "UpdateSign", tolua_cWorld_SetSignLines);
tolua_endmodule(tolua_S); 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_beginmodule(tolua_S, "cPlugin");
tolua_function(tolua_S, "Call", tolua_cPlugin_Call); tolua_function(tolua_S, "Call", tolua_cPlugin_Call);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);

View File

@ -185,6 +185,11 @@ public:
const cColorList & GetData(void) const { return m_Data; } const cColorList & GetData(void) const { return m_Data; }
static const char * GetClassStatic(void) // Needed for ManualBindings's DoWith templates
{
return "cMap";
}
protected: protected:

View File

@ -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); cCSLock Lock(m_CS);
cMap * Map = GetMapData(a_ID); cMap * Map = GetMapData(a_ID);

View File

@ -45,7 +45,7 @@ public:
* Returns true if the map was found and the callback called, false if map not found. * Returns true if the map was found and the callback called, false if map not found.
* Callback return ignored. * 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. /** Calls the callback for each map.
* *