Fix TC build

This commit is contained in:
Rochet2
2017-06-24 23:22:43 +03:00
parent 6804f6e90f
commit f1117fc2d8
7 changed files with 51 additions and 20 deletions

View File

@@ -47,6 +47,11 @@
#include "Battleground.h" #include "Battleground.h"
#include "GitRevision.h" #include "GitRevision.h"
#include "SpellHistory.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 #else
#include "Config/Config.h" #include "Config/Config.h"
#ifdef CMANGOS #ifdef CMANGOS

View File

@@ -303,13 +303,30 @@ namespace LuaQuery
const char* str = row[i].GetCString(); const char* str = row[i].GetCString();
if (row[i].IsNull() || !str) if (row[i].IsNull() || !str)
Eluna::Push(L); 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 #else
Eluna::Push(L, names[i]); Eluna::Push(L, names[i]);
const char* str = row[i].GetString(); const char* str = row[i].GetString();
if (row[i].IsNULL() || !str) if (row[i].IsNULL() || !str)
Eluna::Push(L); Eluna::Push(L);
#endif
else else
{ {
// MYSQL_TYPE_LONGLONG Interpreted as string for lua // MYSQL_TYPE_LONGLONG Interpreted as string for lua
@@ -328,6 +345,7 @@ namespace LuaQuery
break; break;
} }
} }
#endif
lua_rawset(L, tbl); lua_rawset(L, tbl);
} }

View File

@@ -16,6 +16,7 @@
#include "ObjectGuid.h" #include "ObjectGuid.h"
#ifdef TRINITY #ifdef TRINITY
#include "QueryResult.h" #include "QueryResult.h"
#include "Log.h"
#ifdef CATA #ifdef CATA
#include "Object.h" #include "Object.h"
#endif #endif

View File

@@ -1709,7 +1709,7 @@ namespace LuaGlobalFunctions
GameObject* object = new GameObject; GameObject* object = new GameObject;
uint32 guidLow = map->GenerateLowGuid<HighGuid::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)) if (!object->Create(guidLow, objectInfo->entry, map, phase, Position(x, y, z, o), rot, 0, GO_STATE_READY))
{ {
delete object; delete object;
@@ -1842,12 +1842,16 @@ namespace LuaGlobalFunctions
if (!items || items->Empty()) if (!items || items->Empty())
return 0; return 0;
VendorItemList const itemlist = items->m_items; auto const & itemlist = items->m_items;
for (VendorItemList::const_iterator itr = itemlist.begin(); itr != itemlist.end(); ++itr) for (auto itr = itemlist.begin(); itr != itemlist.end(); ++itr)
#ifdef CATA #ifdef CATA
eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1); eObjectMgr->RemoveVendorItem(entry, (*itr)->item, 1);
#else
#ifdef TRINITY
eObjectMgr->RemoveVendorItem(entry, itr->item);
#else #else
eObjectMgr->RemoveVendorItem(entry, (*itr)->item); eObjectMgr->RemoveVendorItem(entry, (*itr)->item);
#endif
#endif #endif
return 0; return 0;
} }

View File

@@ -2882,7 +2882,10 @@ namespace LuaPlayer
#ifdef TRINITY #ifdef TRINITY
// check item starting quest (it can work incorrectly if added without item in inventory) // check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore(); 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()) if (result != itc->end())
return 0; return 0;
@@ -3319,9 +3322,7 @@ namespace LuaPlayer
uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2); uint32 itemId = Eluna::CHECKVAL<uint32>(L, 2);
uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1); uint32 itemCount = Eluna::CHECKVAL<uint32>(L, 3, 1);
#ifndef TRINITY #ifdef TRINITY
Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
#else
uint32 noSpaceForCount = 0; uint32 noSpaceForCount = 0;
ItemPosCountVec dest; ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount); InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, itemCount, &noSpaceForCount);
@@ -3331,10 +3332,12 @@ namespace LuaPlayer
if (itemCount == 0 || dest.empty()) if (itemCount == 0 || dest.empty())
return 1; return 1;
Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomPropertyId(itemId));
if (item) if (item)
player->SendNewItem(item, itemCount, true, false); player->SendNewItem(item, itemCount, true, false);
Eluna::Push(L, item); Eluna::Push(L, item);
#else
Eluna::Push(L, player->StoreNewItemInInventorySlot(itemId, itemCount));
#endif #endif
return 1; return 1;
} }

View File

@@ -1200,7 +1200,7 @@ namespace LuaUnit
#else #else
Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range); Trinity::AnyFriendlyUnitInObjectRangeCheck checker(unit, unit, range);
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker); Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
unit->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(unit, searcher, range);
#endif #endif
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
list.remove_if(guidCheck); list.remove_if(guidCheck);
@@ -1237,7 +1237,7 @@ namespace LuaUnit
#else #else
Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range); Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range);
Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unit, list, checker);
unit->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(unit, searcher, range);
#endif #endif
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
list.remove_if(guidCheck); list.remove_if(guidCheck);

View File

@@ -188,7 +188,7 @@ namespace LuaWorldObject
Cell::VisitWorldObjects(obj, searcher, range); Cell::VisitWorldObjects(obj, searcher, range);
#else #else
Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Trinity::UnitLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
Eluna::Push(L, target); Eluna::Push(L, target);
@@ -217,7 +217,7 @@ namespace LuaWorldObject
Cell::VisitGridObjects(obj, searcher, range); Cell::VisitGridObjects(obj, searcher, range);
#else #else
Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Trinity::GameObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
Eluna::Push(L, target); Eluna::Push(L, target);
@@ -248,7 +248,7 @@ namespace LuaWorldObject
Cell::VisitGridObjects(obj, searcher, range); Cell::VisitGridObjects(obj, searcher, range);
#else #else
Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Trinity::CreatureLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
Eluna::Push(L, target); Eluna::Push(L, target);
@@ -277,7 +277,7 @@ namespace LuaWorldObject
Cell::VisitWorldObjects(obj, searcher, range); Cell::VisitWorldObjects(obj, searcher, range);
#else #else
Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Trinity::PlayerListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
@@ -318,7 +318,7 @@ namespace LuaWorldObject
Cell::VisitGridObjects(obj, searcher, range); Cell::VisitGridObjects(obj, searcher, range);
#else #else
Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Trinity::CreatureListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
@@ -357,7 +357,7 @@ namespace LuaWorldObject
Cell::VisitGridObjects(obj, searcher, range); Cell::VisitGridObjects(obj, searcher, range);
#else #else
Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Trinity::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
@@ -404,7 +404,7 @@ namespace LuaWorldObject
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else #else
Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker); Trinity::WorldObjectLastSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
Eluna::Push(L, target); Eluna::Push(L, target);
@@ -441,7 +441,7 @@ namespace LuaWorldObject
Cell::VisitAllObjects(obj, searcher, range); Cell::VisitAllObjects(obj, searcher, range);
#else #else
Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker); Trinity::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
obj->VisitNearbyObject(range, searcher); Cell::VisitAllObjects(obj, searcher, range);
#endif #endif
lua_createtable(L, list.size(), 0); lua_createtable(L, list.size(), 0);
@@ -682,7 +682,7 @@ namespace LuaWorldObject
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay)); Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, respawnDelay));
#else #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)); Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, respawnDelay));
#endif #endif
return 1; return 1;