mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Creature: Fix assertion triggered
Fix assertion triggered when a Creature was summoned at an invalid position with Auras loaded as Creature addons.
Fix #17415
(cherry picked from commit 75319e4a68)
This commit is contained in:
@@ -869,15 +869,17 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*
|
||||
//! returning correct zone id for selecting OutdoorPvP/Battlefield script
|
||||
Relocate(x, y, z, ang);
|
||||
|
||||
if (!CreateFromProto(guidlow, entry, data, vehId))
|
||||
return false;
|
||||
|
||||
// Check if the position is valid before calling CreateFromProto(), otherwise we might add Auras to Creatures at
|
||||
// invalid position, triggering a crash about Auras not removed in the destructor
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow " UI64FMTD ", entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, entry, x, y, z, ang);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CreateFromProto(guidlow, entry, data, vehId))
|
||||
return false;
|
||||
|
||||
switch (GetCreatureTemplate()->rank)
|
||||
{
|
||||
case CREATURE_ELITE_RARE:
|
||||
|
||||
Reference in New Issue
Block a user