Eluna fix build

This commit is contained in:
Rochet2
2014-06-04 20:47:33 +03:00
committed by Foereaper
parent 77ff26ac8e
commit 8acf303652
3 changed files with 16 additions and 16 deletions

View File

@@ -287,7 +287,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 2); lua_pushvalue(L, 2);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_PACKET, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_PACKET, entry, ev, functionRef);
return 0; return 0;
} }
@@ -298,7 +298,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 2); lua_pushvalue(L, 2);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_SERVER, 0, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_SERVER, 0, ev, functionRef);
return 0; return 0;
} }
@@ -309,7 +309,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 2); lua_pushvalue(L, 2);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_PLAYER, 0, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_PLAYER, 0, ev, functionRef);
return 0; return 0;
} }
@@ -320,7 +320,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 2); lua_pushvalue(L, 2);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_GUILD, 0, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_GUILD, 0, ev, functionRef);
return 0; return 0;
} }
@@ -331,7 +331,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 2); lua_pushvalue(L, 2);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_GROUP, 0, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_GROUP, 0, ev, functionRef);
return 0; return 0;
} }
@@ -343,7 +343,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_CREATURE_GOSSIP, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_CREATURE_GOSSIP, entry, ev, functionRef);
return 0; return 0;
} }
@@ -355,7 +355,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_GAMEOBJECT_GOSSIP, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_GAMEOBJECT_GOSSIP, entry, ev, functionRef);
return 0; return 0;
} }
@@ -367,7 +367,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_ITEM, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_ITEM, entry, ev, functionRef);
return 0; return 0;
} }
@@ -379,7 +379,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_ITEM_GOSSIP, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_ITEM_GOSSIP, entry, ev, functionRef);
return 0; return 0;
} }
@@ -391,7 +391,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_PLAYER_GOSSIP, menu_id, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_PLAYER_GOSSIP, menu_id, ev, functionRef);
return 0; return 0;
} }
@@ -403,7 +403,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_CREATURE, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_CREATURE, entry, ev, functionRef);
return 0; return 0;
} }
@@ -415,7 +415,7 @@ namespace LuaGlobalFunctions
lua_pushvalue(L, 3); lua_pushvalue(L, 3);
int functionRef = lua_ref(L, true); int functionRef = lua_ref(L, true);
if (functionRef > 0) if (functionRef > 0)
sEluna->Register(REGTYPE_GAMEOBJECT, entry, ev, functionRef); sEluna->Register(HookMgr::REGTYPE_GAMEOBJECT, entry, ev, functionRef);
return 0; return 0;
} }

View File

@@ -32,7 +32,7 @@ ENDCALL();
lua_State* L = sEluna->L; \ lua_State* L = sEluna->L; \
uint32 _LuaEvent = EVENT; \ uint32 _LuaEvent = EVENT; \
int _LuaStackTop = lua_gettop(L); \ int _LuaStackTop = lua_gettop(L); \
for (int i = 0; i < sEluna->BINDMAP->Bindings[EVENT].size(); ++i) \ for (size_t i = 0; i < sEluna->BINDMAP->Bindings[EVENT].size(); ++i) \
lua_rawgeti(L, LUA_REGISTRYINDEX, (sEluna->BINDMAP->Bindings[EVENT][i])); \ lua_rawgeti(L, LUA_REGISTRYINDEX, (sEluna->BINDMAP->Bindings[EVENT][i])); \
int _LuaFuncTop = lua_gettop(L); \ int _LuaFuncTop = lua_gettop(L); \
Eluna::Push(L, _LuaEvent); Eluna::Push(L, _LuaEvent);

View File

@@ -366,7 +366,7 @@ struct EventBind
void Insert(int eventId, int funcRef) // Inserts a new registered event void Insert(int eventId, int funcRef) // Inserts a new registered event
{ {
Bindings[eventId].push_back(funcRef); Bindings[(T)eventId].push_back(funcRef);
} }
// Gets the binding std::map containing all registered events with the function refs for the entry // Gets the binding std::map containing all registered events with the function refs for the entry
@@ -424,13 +424,13 @@ struct EntryBind
void Insert(uint32 entryId, int eventId, int funcRef) // Inserts a new registered event void Insert(uint32 entryId, int eventId, int funcRef) // Inserts a new registered event
{ {
if (Bindings[entryId][eventId]) if (Bindings[entryId][(T)eventId])
{ {
luaL_unref(E.L, LUA_REGISTRYINDEX, funcRef); // free the unused ref luaL_unref(E.L, LUA_REGISTRYINDEX, funcRef); // free the unused ref
luaL_error(E.L, "A function is already registered for entry (%d) event (%d)", entryId, eventId); luaL_error(E.L, "A function is already registered for entry (%d) event (%d)", entryId, eventId);
} }
else else
Bindings[entryId][eventId] = funcRef; Bindings[entryId][(T)eventId] = funcRef;
} }
// Gets the function ref of an entry for an event // Gets the function ref of an entry for an event