chore(Core/Object): Rename GetGOData() to GetGameObjectData() (#14875)

This commit is contained in:
Skjalf
2023-02-05 08:35:52 -03:00
committed by GitHub
parent 61dec3f143
commit dba8c49bce
14 changed files with 35 additions and 35 deletions

View File

@@ -1227,7 +1227,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false; return false;
} }
if (e.event.distance.guid != 0 && !sObjectMgr->GetGOData(e.event.distance.guid)) if (e.event.distance.guid != 0 && !sObjectMgr->GetGameObjectData(e.event.distance.guid))
{ {
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject guid {}, skipped.", e.event.distance.guid); LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject guid {}, skipped.", e.event.distance.guid);
return false; return false;

View File

@@ -650,7 +650,7 @@ ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& gu
ObjectGuid::LowType lowguid = (uint32)atol(idS); ObjectGuid::LowType lowguid = (uint32)atol(idS);
if (sObjectMgr->GetGOData(lowguid)) if (sObjectMgr->GetGameObjectData(lowguid))
return lowguid; return lowguid;
else else
return 0; return 0;

View File

@@ -2163,7 +2163,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
} }
if (cond->ConditionValue3) if (cond->ConditionValue3)
{ {
if (GameObjectData const* goData = sObjectMgr->GetGOData(cond->ConditionValue3)) if (GameObjectData const* goData = sObjectMgr->GetGameObjectData(cond->ConditionValue3))
{ {
if (cond->ConditionValue2 && goData->id != cond->ConditionValue2) if (cond->ConditionValue2 && goData->id != cond->ConditionValue2)
{ {

View File

@@ -1040,7 +1040,7 @@ void GameObject::SaveToDB(bool saveAddon /*= false*/)
{ {
// this should only be used when the gameobject has already been loaded // this should only be used when the gameobject has already been loaded
// preferably after adding to map, because mapid may not be valid otherwise // preferably after adding to map, because mapid may not be valid otherwise
GameObjectData const* data = sObjectMgr->GetGOData(m_spawnId); GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId);
if (!data) if (!data)
{ {
LOG_ERROR("entities.gameobject", "GameObject::SaveToDB failed, cannot get gameobject data!"); LOG_ERROR("entities.gameobject", "GameObject::SaveToDB failed, cannot get gameobject data!");
@@ -1119,7 +1119,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool
bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap) bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap)
{ {
GameObjectData const* data = sObjectMgr->GetGOData(spawnId); GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
if (!data) if (!data)
{ {
@@ -1441,7 +1441,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
void GameObject::SetGoArtKit(uint8 kit) void GameObject::SetGoArtKit(uint8 kit)
{ {
SetByteValue(GAMEOBJECT_BYTES_1, 2, kit); SetByteValue(GAMEOBJECT_BYTES_1, 2, kit);
GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGOData(m_spawnId)); GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGameObjectData(m_spawnId));
if (data) if (data)
data->artKit = kit; data->artKit = kit;
} }
@@ -1452,10 +1452,10 @@ void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType l
if (go) if (go)
{ {
go->SetGoArtKit(artkit); go->SetGoArtKit(artkit);
data = go->GetGOData(); data = go->GetGameObjectData();
} }
else if (lowguid) else if (lowguid)
data = sObjectMgr->GetGOData(lowguid); data = sObjectMgr->GetGameObjectData(lowguid);
if (data) if (data)
const_cast<GameObjectData*>(data)->artKit = artkit; const_cast<GameObjectData*>(data)->artKit = artkit;
@@ -2193,7 +2193,7 @@ void GameObject::EventInform(uint32 eventId)
uint32 GameObject::GetScriptId() const uint32 GameObject::GetScriptId() const
{ {
if (GameObjectData const* gameObjectData = GetGOData()) if (GameObjectData const* gameObjectData = GetGameObjectData())
if (uint32 scriptId = gameObjectData->ScriptId) if (uint32 scriptId = gameObjectData->ScriptId)
return scriptId; return scriptId;
@@ -2482,7 +2482,7 @@ void GameObject::SetGoState(GOState state)
// startOpen determines whether we are going to add or remove the LoS on activation // startOpen determines whether we are going to add or remove the LoS on activation
/*bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); /*bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
if (GetGOData() && GetGOData()->go_state == GO_STATE_READY) if (GetGameObjectData() && GetGameObjectData()->go_state == GO_STATE_READY)
startOpen = !startOpen; startOpen = !startOpen;
if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE) if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
@@ -2886,7 +2886,7 @@ void GameObject::GetRespawnPosition(float& x, float& y, float& z, float* ori /*
{ {
if (m_spawnId) if (m_spawnId)
{ {
if (GameObjectData const* data = sObjectMgr->GetGOData(m_spawnId)) if (GameObjectData const* data = sObjectMgr->GetGameObjectData(m_spawnId))
{ {
x = data->posX; x = data->posX;
y = data->posY; y = data->posY;

View File

@@ -828,7 +828,7 @@ public:
void Update(uint32 p_time) override; void Update(uint32 p_time) override;
[[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } [[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
[[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const; [[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const;
[[nodiscard]] GameObjectData const* GetGOData() const { return m_goData; } [[nodiscard]] GameObjectData const* GetGameObjectData() const { return m_goData; }
[[nodiscard]] GameObjectValue const* GetGOValue() const { return &m_goValue; } [[nodiscard]] GameObjectValue const* GetGOValue() const { return &m_goValue; }
[[nodiscard]] bool IsTransport() const; [[nodiscard]] bool IsTransport() const;

View File

@@ -422,7 +422,7 @@ void MotionTransport::LoadStaticPassengers()
// GameObjects on transport // GameObjects on transport
guidEnd = cellItr->second.gameobjects.end(); guidEnd = cellItr->second.gameobjects.end();
for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr) for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr)
CreateGOPassenger(*guidItr, sObjectMgr->GetGOData(*guidItr)); CreateGOPassenger(*guidItr, sObjectMgr->GetGameObjectData(*guidItr));
} }
} }
} }

View File

@@ -473,7 +473,7 @@ void GameEventMgr::LoadFromDB()
int32 internal_event_id = mGameEvent.size() + event_id - 1; int32 internal_event_id = mGameEvent.size() + event_id - 1;
GameObjectData const* data = sObjectMgr->GetGOData(guid); GameObjectData const* data = sObjectMgr->GetGameObjectData(guid);
if (!data) if (!data)
{ {
LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: {}) not found in `gameobject` table.", guid); LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: {}) not found in `gameobject` table.", guid);
@@ -1357,7 +1357,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
for (GuidLowList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr) for (GuidLowList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
{ {
// Add to correct cell // Add to correct cell
if (GameObjectData const* data = sObjectMgr->GetGOData(*itr)) if (GameObjectData const* data = sObjectMgr->GetGameObjectData(*itr))
{ {
sObjectMgr->AddGameobjectToGrid(*itr, data); sObjectMgr->AddGameobjectToGrid(*itr, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
@@ -1438,7 +1438,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if (event_id > 0 && hasGameObjectActiveEventExcept(*itr, event_id)) if (event_id > 0 && hasGameObjectActiveEventExcept(*itr, event_id))
continue; continue;
// Remove the gameobject from grid // Remove the gameobject from grid
if (GameObjectData const* data = sObjectMgr->GetGOData(*itr)) if (GameObjectData const* data = sObjectMgr->GetGameObjectData(*itr))
{ {
sObjectMgr->RemoveGameobjectFromGrid(*itr, data); sObjectMgr->RemoveGameobjectFromGrid(*itr, data);

View File

@@ -1356,7 +1356,7 @@ void ObjectMgr::LoadGameObjectAddons()
ObjectGuid::LowType guid = fields[0].Get<uint32>(); ObjectGuid::LowType guid = fields[0].Get<uint32>();
const GameObjectData* goData = GetGOData(guid); const GameObjectData* goData = GetGameObjectData(guid);
if (!goData) if (!goData)
{ {
LOG_ERROR("sql.sql", "GameObject (GUID: {}) does not exist but has a record in `gameobject_addon`", guid); LOG_ERROR("sql.sql", "GameObject (GUID: {}) does not exist but has a record in `gameobject_addon`", guid);
@@ -1791,7 +1791,7 @@ void ObjectMgr::LoadLinkedRespawn()
break; break;
} }
const GameObjectData* master = GetGOData(linkedGuidLow); const GameObjectData* master = GetGameObjectData(linkedGuidLow);
if (!master) if (!master)
{ {
LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) {} not found in gameobject table", linkedGuidLow); LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) {} not found in gameobject table", linkedGuidLow);
@@ -1820,7 +1820,7 @@ void ObjectMgr::LoadLinkedRespawn()
} }
case GO_TO_GO: case GO_TO_GO:
{ {
const GameObjectData* slave = GetGOData(guidLow); const GameObjectData* slave = GetGameObjectData(guidLow);
if (!slave) if (!slave)
{ {
LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) {} not found in gameobject table", guidLow); LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) {} not found in gameobject table", guidLow);
@@ -1828,7 +1828,7 @@ void ObjectMgr::LoadLinkedRespawn()
break; break;
} }
const GameObjectData* master = GetGOData(linkedGuidLow); const GameObjectData* master = GetGameObjectData(linkedGuidLow);
if (!master) if (!master)
{ {
LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) {} not found in gameobject table", linkedGuidLow); LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) {} not found in gameobject table", linkedGuidLow);
@@ -1857,7 +1857,7 @@ void ObjectMgr::LoadLinkedRespawn()
} }
case GO_TO_CREATURE: case GO_TO_CREATURE:
{ {
const GameObjectData* slave = GetGOData(guidLow); const GameObjectData* slave = GetGameObjectData(guidLow);
if (!slave) if (!slave)
{ {
LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) {} not found in gameobject table", guidLow); LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) {} not found in gameobject table", guidLow);
@@ -5253,7 +5253,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
{ {
GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); GameObjectData const* data = GetGameObjectData(tmp.RespawnGameobject.GOGuid);
if (!data) if (!data)
{ {
LOG_ERROR("sql.sql", "Table `{}` has invalid gameobject (GUID: {}) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id {}", LOG_ERROR("sql.sql", "Table `{}` has invalid gameobject (GUID: {}) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id {}",
@@ -5304,7 +5304,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_OPEN_DOOR: case SCRIPT_COMMAND_OPEN_DOOR:
case SCRIPT_COMMAND_CLOSE_DOOR: case SCRIPT_COMMAND_CLOSE_DOOR:
{ {
GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); GameObjectData const* data = GetGameObjectData(tmp.ToggleDoor.GOGuid);
if (!data) if (!data)
{ {
LOG_ERROR("sql.sql", "Table `{}` has invalid gameobject (GUID: {}) in {} for script id {}", LOG_ERROR("sql.sql", "Table `{}` has invalid gameobject (GUID: {}) in {} for script id {}",
@@ -7903,7 +7903,7 @@ void ObjectMgr::DeleteCreatureData(ObjectGuid::LowType guid)
void ObjectMgr::DeleteGOData(ObjectGuid::LowType guid) void ObjectMgr::DeleteGOData(ObjectGuid::LowType guid)
{ {
// remove mapid*cellid -> guid_set map // remove mapid*cellid -> guid_set map
GameObjectData const* data = GetGOData(guid); GameObjectData const* data = GetGameObjectData(guid);
if (data) if (data)
RemoveGameobjectFromGrid(guid, data); RemoveGameobjectFromGrid(guid, data);

View File

@@ -1207,7 +1207,7 @@ public:
} }
[[nodiscard]] GameObjectDataContainer const& GetAllGOData() const { return _gameObjectDataStore; } [[nodiscard]] GameObjectDataContainer const& GetAllGOData() const { return _gameObjectDataStore; }
[[nodiscard]] GameObjectData const* GetGOData(ObjectGuid::LowType spawnId) const [[nodiscard]] GameObjectData const* GetGameObjectData(ObjectGuid::LowType spawnId) const
{ {
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(spawnId); GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(spawnId);
if (itr == _gameObjectDataStore.end()) return nullptr; if (itr == _gameObjectDataStore.end()) return nullptr;

View File

@@ -120,7 +120,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefMgr<GameObj
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid) for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
{ {
ObjectGuid::LowType guid = *i_guid; ObjectGuid::LowType guid = *i_guid;
GameObjectData const* data = sObjectMgr->GetGOData(guid); GameObjectData const* data = sObjectMgr->GetGameObjectData(guid);
GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject();
if (!obj->LoadFromDB(guid, map)) if (!obj->LoadFromDB(guid, map))

View File

@@ -68,7 +68,7 @@ void OPvPCapturePoint::AddGO(uint32 type, ObjectGuid::LowType guid, uint32 entry
{ {
if (!entry) if (!entry)
{ {
const GameObjectData* data = sObjectMgr->GetGOData(guid); const GameObjectData* data = sObjectMgr->GetGameObjectData(guid);
if (!data) if (!data)
return; return;
entry = data->id; entry = data->id;

View File

@@ -211,7 +211,7 @@ void PoolGroup<Creature>::Despawn1Object(ObjectGuid::LowType guid)
template<> template<>
void PoolGroup<GameObject>::Despawn1Object(ObjectGuid::LowType guid) void PoolGroup<GameObject>::Despawn1Object(ObjectGuid::LowType guid)
{ {
if (GameObjectData const* data = sObjectMgr->GetGOData(guid)) if (GameObjectData const* data = sObjectMgr->GetGameObjectData(guid))
{ {
sObjectMgr->RemoveGameobjectFromGrid(guid, data); sObjectMgr->RemoveGameobjectFromGrid(guid, data);
@@ -399,7 +399,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
template <> template <>
void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj) void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj)
{ {
if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid)) if (GameObjectData const* data = sObjectMgr->GetGameObjectData(obj->guid))
{ {
sObjectMgr->AddGameobjectToGrid(obj->guid, data); sObjectMgr->AddGameobjectToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
@@ -686,7 +686,7 @@ void PoolMgr::LoadFromDB()
uint32 pool_id = fields[1].Get<uint32>(); uint32 pool_id = fields[1].Get<uint32>();
float chance = fields[2].Get<float>(); float chance = fields[2].Get<float>();
GameObjectData const* data = sObjectMgr->GetGOData(guid); GameObjectData const* data = sObjectMgr->GetGameObjectData(guid);
if (!data) if (!data)
{ {
LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: {}) defined for pool id ({}), skipped.", guid, pool_id); LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: {}) defined for pool id ({}), skipped.", guid, pool_id);

View File

@@ -119,7 +119,7 @@ public:
static bool HandleGoGameObjectSpawnIdCommand(ChatHandler* handler, uint32 spawnId) static bool HandleGoGameObjectSpawnIdCommand(ChatHandler* handler, uint32 spawnId)
{ {
GameObjectData const* spawnpoint = sObjectMgr->GetGOData(spawnId); GameObjectData const* spawnpoint = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnpoint) if (!spawnpoint)
{ {
handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND); handler->SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);

View File

@@ -148,7 +148,7 @@ public:
} }
/// @todo is it really necessary to add both the real and DB table guid here ? /// @todo is it really necessary to add both the real and DB table guid here ?
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGameObjectData(guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, uint32(objectId), objectInfo->name.c_str(), guidLow, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, uint32(objectId), objectInfo->name.c_str(), guidLow, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
return true; return true;
@@ -402,9 +402,9 @@ public:
object->Relocate(pos); object->Relocate(pos);
// update which cell has this gameobject registered for loading // update which cell has this gameobject registered for loading
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGOData()); sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGameObjectData());
object->SaveToDB(); object->SaveToDB();
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGOData()); sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGameObjectData());
// Generate a completely new spawn with new guid // Generate a completely new spawn with new guid
// 3.3.5a client caches recently deleted objects and brings them back to life // 3.3.5a client caches recently deleted objects and brings them back to life
@@ -509,7 +509,7 @@ public:
if (isGuid || data.holds_alternative<Hyperlink<gameobject>>()) if (isGuid || data.holds_alternative<Hyperlink<gameobject>>())
{ {
spawnId = *data; spawnId = *data;
GameObjectData const* spawnData = sObjectMgr->GetGOData(spawnId); GameObjectData const* spawnData = sObjectMgr->GetGameObjectData(spawnId);
if (!spawnData) if (!spawnData)
{ {
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, spawnId); handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, spawnId);