From 16185423abb033d47cb83eafeafdc073e6cbdacf Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sat, 20 Sep 2014 17:27:42 +0300 Subject: [PATCH] Eluna: fix compatibility with new guid changes, fix bg methods for cata --- BattleGroundMethods.h | 4 ++++ ElunaUtility.h | 17 +++++++++++++---- MapMethods.h | 12 ++++++------ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/BattleGroundMethods.h b/BattleGroundMethods.h index d8480db..0f17b19 100644 --- a/BattleGroundMethods.h +++ b/BattleGroundMethods.h @@ -77,7 +77,11 @@ namespace LuaBattleGround */ int GetEndTime(lua_State* L, BattleGround* bg) { +#ifdef CATA + Eluna::Push(L, bg->GetRemainingTime()); +#else Eluna::Push(L, bg->GetEndTime()); +#endif return 1; } diff --git a/ElunaUtility.h b/ElunaUtility.h index ffeaaa0..6d9eac6 100644 --- a/ElunaUtility.h +++ b/ElunaUtility.h @@ -41,10 +41,6 @@ typedef uint64 ObjectGuid; #define GET_GUID GetGUID #else typedef QueryNamedResult ElunaQuery; -#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l) -#define GUID_ENPART(guid) ObjectGuid(guid).GetEntry() -#define GUID_LOPART(guid) ObjectGuid(guid).GetCounter() -#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh() #define ASSERT MANGOS_ASSERT #define ELUNA_LOG_INFO(...) sLog.outString(__VA_ARGS__); #define ELUNA_LOG_ERROR(...) sLog.outErrorEluna(__VA_ARGS__); @@ -64,6 +60,19 @@ typedef QueryNamedResult ElunaQuery; #define UNORDERED_SET std::unordered_set #endif +#ifndef MAKE_NEW_GUID +#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l) +#endif +#ifndef GUID_ENPART +#define GUID_ENPART(guid) ObjectGuid(guid).GetEntry() +#endif +#ifndef GUID_LOPART +#define GUID_LOPART(guid) ObjectGuid(guid).GetCounter() +#endif +#ifndef GUID_HIPART +#define GUID_HIPART(guid) ObjectGuid(guid).GetHigh() +#endif + class Unit; class WorldObject; diff --git a/MapMethods.h b/MapMethods.h index 4a74de5..6a2a3b9 100644 --- a/MapMethods.h +++ b/MapMethods.h @@ -203,25 +203,25 @@ namespace LuaMap switch (GUID_HIPART(guid)) { case HIGHGUID_PLAYER: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (Player*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Player*)NULL)); break; case HIGHGUID_TRANSPORT: case HIGHGUID_MO_TRANSPORT: case HIGHGUID_GAMEOBJECT: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (GameObject*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (GameObject*)NULL)); break; case HIGHGUID_VEHICLE: case HIGHGUID_UNIT: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (Creature*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Creature*)NULL)); break; case HIGHGUID_PET: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (Pet*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Pet*)NULL)); break; case HIGHGUID_DYNAMICOBJECT: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (DynamicObject*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (DynamicObject*)NULL)); break; case HIGHGUID_CORPSE: - Eluna::Push(L, sObjectAccessor->GetObjectInMap(guid, map, (Corpse*)NULL)); + Eluna::Push(L, sObjectAccessor->GetObjectInMap(ObjectGuid(guid), map, (Corpse*)NULL)); break; default: break;