refactor(Core): rename namespaces and macros to acore (#2454)

This commit is contained in:
Viste
2019-12-01 15:13:31 +03:00
committed by Francesco Borzì
parent e19e95e5d0
commit e22d78ecd6
278 changed files with 1292 additions and 1309 deletions

View File

@@ -1807,7 +1807,7 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
{
if (mask & 1)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.creatures.insert(guid);
}
@@ -1821,7 +1821,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
{
if (mask & 1)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.creatures.erase(guid);
}
@@ -2140,7 +2140,7 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
{
if (mask & 1)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.gameobjects.insert(guid);
}
@@ -2154,7 +2154,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
{
if (mask & 1)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->posX, data->posY);
CellCoord cellCoord = acore::ComputeCellCoord(data->posX, data->posY);
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
cell_guids.gameobjects.erase(guid);
}
@@ -4701,7 +4701,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
continue;
}
if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
if (!acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
{
sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id);
@@ -4799,7 +4799,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
if (!acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
{
sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id);
@@ -6277,7 +6277,7 @@ uint32 ObjectMgr::GenerateMailID()
sLog->outError("Mail ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
TRINITY_GUARD(ACE_Thread_Mutex, _mailIdMutex);
ACORE_GUARD(ACE_Thread_Mutex, _mailIdMutex);
return _mailId++;
}
@@ -6288,25 +6288,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
case HIGHGUID_ITEM:
{
ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex);
return _hiItemGuid++;
}
case HIGHGUID_UNIT:
{
ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex);
return _hiCreatureGuid++;
}
case HIGHGUID_PET:
{
ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex);
return _hiPetGuid++;
}
case HIGHGUID_VEHICLE:
{
ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex);
return _hiVehicleGuid++;
}
case HIGHGUID_PLAYER:
@@ -6317,25 +6317,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
case HIGHGUID_GAMEOBJECT:
{
ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex);
return _hiGoGuid++;
}
case HIGHGUID_CORPSE:
{
ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex);
return _hiCorpseGuid++;
}
case HIGHGUID_DYNAMICOBJECT:
{
ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex);
return _hiDoGuid++;
}
case HIGHGUID_MO_TRANSPORT:
{
ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!");
TRINITY_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex);
return _hiMoTransGuid++;
}
default:
@@ -6821,7 +6821,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry)
uint32 ObjectMgr::GeneratePetNumber()
{
TRINITY_GUARD(ACE_Thread_Mutex, _hiPetNumberMutex);
ACORE_GUARD(ACE_Thread_Mutex, _hiPetNumberMutex);
return ++_hiPetNumber;
}
@@ -7172,7 +7172,7 @@ void ObjectMgr::LoadPointsOfInterest()
POI.Importance = fields[5].GetUInt32();
POI.Name = fields[6].GetString();
if (!Trinity::IsValidMapCoord(POI.PositionX, POI.PositionY))
if (!acore::IsValidMapCoord(POI.PositionX, POI.PositionY))
{
sLog->outErrorDb("Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY);
continue;
@@ -7745,15 +7745,15 @@ void ObjectMgr::LoadGameObjectForQuests()
sLog->outString();
}
bool ObjectMgr::LoadTrinityStrings()
bool ObjectMgr::LoadAcoreStrings()
{
uint32 oldMSTime = getMSTime();
_trinityStringStore.clear(); // for reload case
QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM trinity_string");
_acoreStringStore.clear(); // for reload case
QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM acore_string");
if (!result)
{
sLog->outString(">> Loaded 0 trinity strings. DB table `trinity_strings` is empty.");
sLog->outString(">> Loaded 0 trinity strings. DB table `acore_strings` is empty.");
sLog->outString();
return false;
}
@@ -7764,7 +7764,7 @@ bool ObjectMgr::LoadTrinityStrings()
uint32 entry = fields[0].GetUInt32();
TrinityString& data = _trinityStringStore[entry];
AcoreString& data = _acoreStringStore[entry];
data.Content.resize(DEFAULT_LOCALE + 1);
@@ -7773,15 +7773,15 @@ bool ObjectMgr::LoadTrinityStrings()
} while (result->NextRow());
sLog->outString(">> Loaded %u trinity strings in %u ms", (uint32)_trinityStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(">> Loaded %u trinity strings in %u ms", (uint32)_acoreStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
return true;
}
char const* ObjectMgr::GetTrinityString(uint32 entry, LocaleConstant locale) const
char const* ObjectMgr::GetAcoreString(uint32 entry, LocaleConstant locale) const
{
if (TrinityString const* ts = GetTrinityString(entry))
if (AcoreString const* ts = GetAcoreString(entry))
{
if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
return ts->Content[locale].c_str();
@@ -8143,7 +8143,7 @@ void ObjectMgr::LoadMailLevelRewards()
void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
{
if (entry >= TRINITY_TRAINER_START_REF)
if (entry >= ACORE_TRAINER_START_REF)
return;
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);