mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/GameObjects: Properly set GO_FLAG_MAP_OBJECT during gameobject creation
This commit is contained in:
@@ -330,9 +330,7 @@ bool GameObject::Create(uint32 entry, Map* map, Position const& pos, QuaternionD
|
||||
|
||||
SetDisplayId(goInfo->displayId);
|
||||
|
||||
m_model = CreateModel();
|
||||
if (m_model && m_model->isMapObject())
|
||||
AddFlag(GO_FLAG_MAP_OBJECT);
|
||||
CreateModel();
|
||||
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
|
||||
SetGoType(GameobjectTypes(goInfo->type));
|
||||
m_prevGoState = goState;
|
||||
@@ -2504,15 +2502,12 @@ void GameObject::UpdateModel()
|
||||
if (m_model)
|
||||
if (GetMap()->ContainsGameObjectModel(*m_model))
|
||||
GetMap()->RemoveGameObjectModel(*m_model);
|
||||
RemoveFlag(GO_FLAG_MAP_OBJECT);
|
||||
delete m_model;
|
||||
m_model = CreateModel();
|
||||
m_model = nullptr;
|
||||
CreateModel();
|
||||
if (m_model)
|
||||
GetMap()->InsertGameObjectModel(*m_model);
|
||||
|
||||
if (m_model && m_model->isMapObject())
|
||||
AddFlag(GO_FLAG_MAP_OBJECT);
|
||||
else
|
||||
RemoveFlag(GO_FLAG_MAP_OBJECT);
|
||||
}
|
||||
|
||||
Player* GameObject::GetLootRecipient() const
|
||||
@@ -2728,7 +2723,9 @@ private:
|
||||
GameObject* _owner;
|
||||
};
|
||||
|
||||
GameObjectModel* GameObject::CreateModel()
|
||||
void GameObject::CreateModel()
|
||||
{
|
||||
return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
|
||||
m_model = GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
|
||||
if (m_model && m_model->isMapObject())
|
||||
AddFlag(GO_FLAG_MAP_OBJECT);
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
UF::UpdateField<UF::GameObjectData, 0, TYPEID_GAMEOBJECT> m_gameObjectData;
|
||||
|
||||
protected:
|
||||
GameObjectModel* CreateModel();
|
||||
void CreateModel();
|
||||
void UpdateModel(); // updates model in case displayId were changed
|
||||
uint32 m_spellId;
|
||||
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
|
||||
|
||||
@@ -104,7 +104,7 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
|
||||
SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
SetParentRotation(QuaternionData());
|
||||
|
||||
m_model = CreateModel();
|
||||
CreateModel();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user