mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Fix TC build
This commit is contained in:
@@ -47,6 +47,11 @@
|
||||
#include "Battleground.h"
|
||||
#include "GitRevision.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Bag.h"
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#else
|
||||
#include "Config/Config.h"
|
||||
#ifdef CMANGOS
|
||||
|
||||
@@ -303,13 +303,30 @@ namespace LuaQuery
|
||||
const char* str = row[i].GetCString();
|
||||
if (row[i].IsNull() || !str)
|
||||
Eluna::Push(L);
|
||||
else
|
||||
{
|
||||
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
|
||||
switch (row[i].GetType())
|
||||
{
|
||||
case DatabaseFieldTypes::Int8:
|
||||
case DatabaseFieldTypes::Int16:
|
||||
case DatabaseFieldTypes::Int32:
|
||||
case DatabaseFieldTypes::Int64:
|
||||
case DatabaseFieldTypes::Float:
|
||||
case DatabaseFieldTypes::Double:
|
||||
Eluna::Push(L, strtod(str, NULL));
|
||||
break;
|
||||
default:
|
||||
Eluna::Push(L, str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Eluna::Push(L, names[i]);
|
||||
|
||||
const char* str = row[i].GetString();
|
||||
if (row[i].IsNULL() || !str)
|
||||
Eluna::Push(L);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
|
||||
@@ -328,6 +345,7 @@ namespace LuaQuery
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lua_rawset(L, tbl);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#ifdef TRINITY
|
||||
#include "QueryResult.h"
|
||||
#include "Log.h"
|
||||
#ifdef CATA
|
||||
#include "Object.h"
|
||||
#endif
|
||||
|
||||
@@ -1709,7 +1709,7 @@ namespace LuaGlobalFunctions
|
||||
GameObject* object = new GameObject;
|
||||
uint32 guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
|
||||
|
||||
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||
if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY))
|
||||
{
|
||||
delete object;
|
||||
@@ -1842,12 +1842,16 @@ namespace LuaGlobalFunctions
|
||||
if (!items || items->Empty())
|
||||
return 0;
|
||||
|
||||
VendorItemList const itemlist = items->m_items;
|
||||
for (VendorItemList::const_iterator itr = itemlist.begin(); itr != itemlist.end(); ++itr)
|
||||
auto const & itemlist = items->m_items;
|
||||
for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr)
|
||||
#ifdef CATA
|
||||
eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1);
|
||||
#else
|
||||
#ifdef TRINITY
|
||||
eObjectMgr->RemoveVendorItem(entry, itr->item);
|
||||
#else
|
||||
eObjectMgr->RemoveVendorItem(entry, (*itr)->item);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2882,7 +2882,10 @@ namespace LuaPlayer
|
||||
#ifdef TRINITY
|
||||
// check item starting quest (it can work incorrectly if added without item in inventory)
|
||||
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
|
||||
ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
|
||||
ItemTemplateContainer::const_iterator result = std::find_if(itc->begin(), itc->end(), [quest](ItemTemplateContainer::value_type const& value)
|
||||
{
|
||||
return value.second.StartQuest == quest->GetQuestId();
|
||||
});
|
||||
|
||||
if (result != itc->end())
|
||||
return 0;
|
||||
@@ -3319,9 +3322,7 @@ namespace LuaPlayer
|
||||
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1);
|
||||
|
||||
#ifndef TRINITY
|
||||
Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
|
||||
#else
|
||||
#ifdef TRINITY
|
||||
uint32 noSpaceForCount = 0;
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
|
||||
@@ -3331,10 +3332,12 @@ namespace LuaPlayer
|
||||
if (itemCount == 0 || dest.empty())
|
||||
return 1;
|
||||
|
||||
Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
|
||||
if (item)
|
||||
player->SendNewItem(item, itemCount, true, false);
|
||||
Eluna::Push(L, item);
|
||||
#else
|
||||
Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ namespace LuaUnit
|
||||
#else
|
||||
Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||
unit->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(unit, searcher, range);
|
||||
#endif
|
||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||
list.remove_if(guidCheck);
|
||||
@@ -1237,7 +1237,7 @@ namespace LuaUnit
|
||||
#else
|
||||
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range);
|
||||
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
|
||||
unit->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(unit, searcher, range);
|
||||
#endif
|
||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||
list.remove_if(guidCheck);
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitWorldObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
Eluna::Push(L, target);
|
||||
@@ -217,7 +217,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitGridObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
Eluna::Push(L, target);
|
||||
@@ -248,7 +248,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitGridObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
Eluna::Push(L, target);
|
||||
@@ -277,7 +277,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitWorldObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -318,7 +318,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitGridObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -357,7 +357,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitGridObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -404,7 +404,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
Eluna::Push(L, target);
|
||||
@@ -441,7 +441,7 @@ namespace LuaWorldObject
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#else
|
||||
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
obj->VisitNearbyObject(range, searcher);
|
||||
Cell::VisitAllObjects(obj, searcher, range);
|
||||
#endif
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -682,7 +682,7 @@ namespace LuaWorldObject
|
||||
#ifndef TRINITY
|
||||
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay));
|
||||
#else
|
||||
G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
|
||||
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, respawnDelay));
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user