Add StackTracePlus, Rewrite not to recreate eluna on reload

This commit is contained in:
Rochet2
2015-01-14 01:03:16 +02:00
parent e8d840ace9
commit 3d645d8048
13 changed files with 924 additions and 198 deletions

View File

@@ -9,14 +9,35 @@
#include "Hooks.h"
#include "HookHelpers.h"
#include "ElunaTemplate.h"
#include "LuaEngine.h"
#include "ElunaBinding.h"
#include "ElunaTemplate.h" // Needed to be able to push AuctionHouseObjects.
#include "ElunaTemplate.h"
#include "ElunaEventMgr.h"
#include "ElunaIncludes.h"
using namespace Hooks;
void Eluna::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* obj)
{
LOCK_ELUNA;
ASSERT(!event_level);
// Get function
lua_rawgeti(L, LUA_REGISTRYINDEX, funcRef);
// Push parameters
Push(L, funcRef);
Push(L, delay);
Push(L, calls);
Push(L, obj);
// Call function
ExecuteCall(4, 0);
ASSERT(!event_level);
InvalidateObjects();
}
void Eluna::OnLuaStateClose()
{
if (!ServerEventBindings->HasEvents(ELUNA_EVENT_ON_LUA_STATE_CLOSE))
@@ -273,12 +294,10 @@ void Eluna::OnShutdownCancel()
void Eluna::OnWorldUpdate(uint32 diff)
{
LOCK_ELUNA;
if (reload)
{
ReloadEluna();
return;
LOCK_ELUNA;
if (reload)
_ReloadEluna();
}
eventMgr->globalProcessor->Update(diff);
@@ -286,6 +305,7 @@ void Eluna::OnWorldUpdate(uint32 diff)
if (!ServerEventBindings->HasEvents(WORLD_EVENT_ON_UPDATE))
return;
LOCK_ELUNA;
Push(diff);
CallAllFunctions(ServerEventBindings, WORLD_EVENT_ON_UPDATE);
}