1
0
Fork 0

Removed dead code related to callbacks.

This commit is contained in:
Mattes D 2016-06-12 18:24:01 +02:00
parent 257c5a1a54
commit 7a6670d1d1
4 changed files with 3 additions and 43 deletions

View File

@ -553,7 +553,7 @@ bool cLuaState::PushFunction(const char * a_FunctionName)
bool cLuaState::PushFunction(int a_FnRef)
bool cLuaState::PushFunction(const cRef & a_FnRef)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack
@ -561,7 +561,7 @@ bool cLuaState::PushFunction(int a_FnRef)
// Push the error handler for lua_pcall()
lua_pushcfunction(m_LuaState, &ReportFnCallErrors);
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // same as lua_getref()
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, static_cast<int>(a_FnRef)); // same as lua_getref()
if (!lua_isfunction(m_LuaState, -1))
{
lua_pop(m_LuaState, 2);

View File

@ -640,18 +640,10 @@ protected:
*/
bool PushFunction(const char * a_FunctionName);
/** Pushes a function that has been saved into the global registry, identified by a_FnRef.
Returns true if successful. Logs a warning on failure
*/
bool PushFunction(int a_FnRef);
/** Pushes a function that has been saved as a reference.
Returns true if successful. Logs a warning on failure
*/
bool PushFunction(const cRef & a_FnRef)
{
return PushFunction(static_cast<int>(a_FnRef));
}
bool PushFunction(const cRef & a_FnRef);
/** Pushes a function that is stored in a referenced table by name
Returns true if successful. Logs a warning on failure

View File

@ -1140,32 +1140,6 @@ int cPluginLua::CallFunctionFromForeignState(
bool cPluginLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse)
{
ASSERT(a_FnRef != LUA_REFNIL);
cOperation op(*this);
bool res = false;
op().Call(a_FnRef, &a_Window, &a_Player, a_CanRefuse, cLuaState::Return, res);
return res;
}
void cPluginLua::CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum)
{
ASSERT(a_FnRef != LUA_REFNIL);
cOperation op(*this);
op().Call(a_FnRef, &a_Window, a_SlotNum);
}
void cPluginLua::ClearWebTabs(void)
{
auto webAdmin = cRoot::Get()->GetWebAdmin();

View File

@ -141,12 +141,6 @@ public:
/** Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121) */
bool CanAddOldStyleHook(int a_HookType);
/** Calls the plugin-specified "cLuaWindow closing" callback. Returns true only if the callback returned true */
bool CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse);
/** Calls the plugin-specified "cLuaWindow slot changed" callback. */
void CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum);
/** Returns the name of Lua function that should handle the specified hook type in the older (#121) API */
static const char * GetHookFnName(int a_HookType);