mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Fix previous commits to be more efficient overall and have better logic. Also try fix clang error.
This commit is contained in:
26
HookMgr.cpp
26
HookMgr.cpp
@@ -51,17 +51,7 @@ using namespace HookMgr;
|
||||
const char* _LuaBindType = this->BINDMAP->groupName; \
|
||||
uint32 _LuaEvent = EVENT; \
|
||||
int _LuaStackTop = lua_gettop(L); \
|
||||
bool _LuaTemporariesDied = false; \
|
||||
for (size_t i = 0; i < this->BINDMAP->Bindings[_LuaEvent].size(); ++i) \
|
||||
{ \
|
||||
if (this->BINDMAP->Bindings[_LuaEvent][i].isTemporary) \
|
||||
{ \
|
||||
this->BINDMAP->Bindings[_LuaEvent][i].remainingShots--; \
|
||||
if (this->BINDMAP->Bindings[_LuaEvent][i].remainingShots == 0) \
|
||||
_LuaTemporariesDied = true; \
|
||||
} \
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, (this->BINDMAP->Bindings[_LuaEvent][i].functionReference)); \
|
||||
} \
|
||||
this->BINDMAP->PushFuncRefs(L, _LuaEvent); \
|
||||
int _LuaFuncTop = lua_gettop(L); \
|
||||
int _LuaFuncCount = _LuaFuncTop-_LuaStackTop; \
|
||||
Eluna::Push(L, _LuaEvent);
|
||||
@@ -95,17 +85,7 @@ using namespace HookMgr;
|
||||
const char* _LuaBindType = _LuaBind->groupName; \
|
||||
uint32 _LuaEvent = EVENT; \
|
||||
int _LuaStackTop = lua_gettop(L); \
|
||||
bool _LuaTemporariesDied = false; \
|
||||
for (size_t i = 0; i < this->BINDMAP->Bindings[ENTRY][_LuaEvent].size(); ++i) \
|
||||
{ \
|
||||
if (this->BINDMAP->Bindings[ENTRY][_LuaEvent][i].isTemporary) \
|
||||
{ \
|
||||
this->BINDMAP->Bindings[ENTRY][_LuaEvent][i].remainingShots--; \
|
||||
if (this->BINDMAP->Bindings[ENTRY][_LuaEvent][i].remainingShots == 0) \
|
||||
_LuaTemporariesDied = true; \
|
||||
} \
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, (this->BINDMAP->Bindings[ENTRY][_LuaEvent][i].functionReference)); \
|
||||
} \
|
||||
this->BINDMAP->PushFuncRefs(L, _LuaEvent, ENTRY); \
|
||||
int _LuaFuncTop = lua_gettop(L); \
|
||||
int _LuaFuncCount = _LuaFuncTop-_LuaStackTop; \
|
||||
Eluna::Push(L, _LuaEvent);
|
||||
@@ -141,8 +121,6 @@ using namespace HookMgr;
|
||||
ELUNA_LOG_ERROR("[Eluna]: Ending event %u for %s, stack top was %i and was supposed to be between %i and %i. Report to devs", _LuaEvent, _LuaBindType, lua_gettop(L), _LuaStackTop, _LuaStackTop + _LuaFuncCount * _LuaReturnValues); \
|
||||
} \
|
||||
lua_settop(L, _LuaStackTop); \
|
||||
if (_LuaTemporariesDied) \
|
||||
_LuaBind->UpdateTemporaryBindings(); \
|
||||
if (!this->event_level) \
|
||||
this->InvalidateObjects(); // Invalidate objects on outermost hook call
|
||||
|
||||
|
||||
Reference in New Issue
Block a user