Skip to content

Commit

Permalink
Core/TempSummons: avoid use MoveInLineOfSight before InitSummon (azer…
Browse files Browse the repository at this point in the history
  • Loading branch information
EricksOliveira authored Dec 22, 2024
1 parent ebf7f75 commit 2110f7c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/server/game/Entities/Creature/TemporarySummon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ void TempSummon::InitSummon()
}
}

void TempSummon::UpdateObjectVisibilityOnCreate()
{
WorldObject::UpdateObjectVisibility(true);
}

void TempSummon::SetTempSummonType(TempSummonType type)
{
m_type = type;
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Creature/TemporarySummon.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class TempSummon : public Creature
virtual void InitStats(uint32 lifetime);
virtual void InitSummon();
virtual void UnSummon(uint32 msTime = 0);
void UpdateObjectVisibilityOnCreate() override;
void RemoveFromWorld() override;
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override {}
Expand Down
4 changes: 3 additions & 1 deletion src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2274,7 +2274,9 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert

summon->InitSummon();

//ObjectAccessor::UpdateObjectVisibility(summon);
// call MoveInLineOfSight for nearby creatures
Acore::AIRelocationNotifier notifier(*summon);
Cell::VisitAllObjects(summon, notifier, GetVisibilityRange());

return summon;
}
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Object/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ class WorldObject : public Object, public WorldLocation

void DestroyForNearbyPlayers();
virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
virtual void UpdateObjectVisibilityOnCreate() { UpdateObjectVisibility(true); }
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& player_set) override;
void GetCreaturesWithEntryInRange(std::list<Creature*>& creatureList, float radius, uint32 entry);

Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ bool Map::AddToMap(T* obj, bool checkTransport)
if (obj->IsInWorld())
{
ASSERT(obj->IsInGrid());
obj->UpdateObjectVisibility(true);
obj->UpdateObjectVisibilityOnCreate();
return true;
}

Expand Down

0 comments on commit 2110f7c

Please sign in to comment.