Merge new_bindings, closes #151

Refer to 6194ddb43c for new C++11 required changes for mangos based cores
This commit is contained in:
Patman64
2015-06-01 20:37:32 +03:00
committed by Rochet2
parent 5c68b7301a
commit 7397c98a61
20 changed files with 1350 additions and 2231 deletions

View File

@@ -4,64 +4,55 @@
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef _BATTLEGROUND_HOOKS_H
#define _BATTLEGROUND_HOOKS_H
#include "Hooks.h"
#include "HookHelpers.h"
#include "LuaEngine.h"
#include "ElunaBinding.h"
#include "BindingMap.h"
#include "ElunaTemplate.h"
using namespace Hooks;
#define START_HOOK(EVENT) \
if (!IsEnabled())\
return;\
auto key = EventKey<BGEvents>(EVENT);\
if (!BGEventBindings->HasBindingsFor(key))\
return;\
LOCK_ELUNA
void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
{
if (!BGEventBindings->HasEvents(BG_EVENT_ON_START))
return;
LOCK_ELUNA;
START_HOOK(BG_EVENT_ON_START);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, BG_EVENT_ON_START);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
{
if (!BGEventBindings->HasEvents(BG_EVENT_ON_END))
return;
LOCK_ELUNA;
START_HOOK(BG_EVENT_ON_END);
Push(bg);
Push(bgId);
Push(instanceId);
Push(winner);
CallAllFunctions(BGEventBindings, BG_EVENT_ON_END);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
{
if (!BGEventBindings->HasEvents(BG_EVENT_ON_CREATE))
return;
LOCK_ELUNA;
START_HOOK(BG_EVENT_ON_CREATE);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, BG_EVENT_ON_CREATE);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
{
if (!BGEventBindings->HasEvents(BG_EVENT_ON_PRE_DESTROY))
return;
LOCK_ELUNA;
START_HOOK(BG_EVENT_ON_PRE_DESTROY);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, BG_EVENT_ON_PRE_DESTROY);
CallAllFunctions(BGEventBindings, key);
}
#endif // _BATTLEGROUND_HOOKS_H