mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +00:00
feat(Core/Scripts): Optimize PlayerScripts by calling only overridden/implemented functions. (#18672)
* feat(Core/Scripts): Optimize PlayerScripts by calling only overridden/implemented functions. * Fix codestyle. * Fix typo * PLAYERHOOK_END is not a hook * Address code review feedback. Co-authored-by: Winfidonarleyan <dowlandtop@yandex.com> * Codestyle fixes * Fix typo Co-authored-by: PkllonG --------- Co-authored-by: Winfidonarleyan <dowlandtop@yandex.com>
This commit is contained in:
committed by
GitHub
parent
fd029f81aa
commit
f792b0d708
@@ -69,4 +69,14 @@ inline bool ReturnValidBool(Optional<bool> ret, bool need = false)
|
||||
return ret && *ret ? need : !need;
|
||||
}
|
||||
|
||||
#define CALL_ENABLED_HOOKS(scriptType, hookType, action) \
|
||||
if (!ScriptRegistry<scriptType>::EnabledHooks[hookType].empty()) \
|
||||
for (auto const& script : ScriptRegistry<scriptType>::EnabledHooks[hookType]) { action; }
|
||||
|
||||
#define CALL_ENABLED_BOOLEAN_HOOKS(scriptType, hookType, action) \
|
||||
if (ScriptRegistry<scriptType>::EnabledHooks[hookType].empty()) \
|
||||
return true; \
|
||||
for (auto const& script : ScriptRegistry<scriptType>::EnabledHooks[hookType]) { if (action) return false; } \
|
||||
return true;
|
||||
|
||||
#endif // _SCRIPT_MGR_MACRO_H_
|
||||
|
||||
Reference in New Issue
Block a user