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,13 +4,10 @@
* Please see the included DOCS/LICENSE.md for more information
*/
#ifndef _VEHICLE_HOOKS_H
#define _VEHICLE_HOOKS_H
#include "Hooks.h"
#include "HookHelpers.h"
#include "LuaEngine.h"
#include "ElunaBinding.h"
#include "BindingMap.h"
#include "ElunaTemplate.h"
#ifndef CLASSIC
@@ -18,61 +15,53 @@
using namespace Hooks;
#define START_HOOK(EVENT) \
if (!IsEnabled())\
return;\
auto key = EventKey<VehicleEvents>(EVENT);\
if (!VehicleEventBindings->HasBindingsFor(key))\
return;\
LOCK_ELUNA
// Vehicle
void Eluna::OnInstall(Vehicle* vehicle)
{
if (!VehicleEventBindings->HasEvents(VEHICLE_EVENT_ON_INSTALL))
return;
LOCK_ELUNA;
START_HOOK(VEHICLE_EVENT_ON_INSTALL);
Push(vehicle);
CallAllFunctions(VehicleEventBindings, VEHICLE_EVENT_ON_INSTALL);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnUninstall(Vehicle* vehicle)
{
if (!VehicleEventBindings->HasEvents(VEHICLE_EVENT_ON_UNINSTALL))
return;
LOCK_ELUNA;
START_HOOK(VEHICLE_EVENT_ON_UNINSTALL);
Push(vehicle);
CallAllFunctions(VehicleEventBindings, VEHICLE_EVENT_ON_UNINSTALL);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnInstallAccessory(Vehicle* vehicle, Creature* accessory)
{
if (!VehicleEventBindings->HasEvents(VEHICLE_EVENT_ON_INSTALL_ACCESSORY))
return;
LOCK_ELUNA;
START_HOOK(VEHICLE_EVENT_ON_INSTALL_ACCESSORY);
Push(vehicle);
Push(accessory);
CallAllFunctions(VehicleEventBindings, VEHICLE_EVENT_ON_INSTALL_ACCESSORY);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId)
{
if (!VehicleEventBindings->HasEvents(VEHICLE_EVENT_ON_ADD_PASSENGER))
return;
LOCK_ELUNA;
START_HOOK(VEHICLE_EVENT_ON_ADD_PASSENGER);
Push(vehicle);
Push(passenger);
Push(seatId);
CallAllFunctions(VehicleEventBindings, VEHICLE_EVENT_ON_ADD_PASSENGER);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger)
{
if (!VehicleEventBindings->HasEvents(VEHICLE_EVENT_ON_REMOVE_PASSENGER))
return;
LOCK_ELUNA;
START_HOOK(VEHICLE_EVENT_ON_REMOVE_PASSENGER);
Push(vehicle);
Push(passenger);
CallAllFunctions(VehicleEventBindings, VEHICLE_EVENT_ON_REMOVE_PASSENGER);
CallAllFunctions(VehicleEventBindings, key);
}
#endif // CLASSIC
#endif // TBC
#endif // _VEHICLE_HOOKS_H