Core/Units: Fix movementflag apply for flying/hovering creatures on respawn

This commit is contained in:
Machiavelli
2012-03-18 11:35:33 +01:00
parent 9fc7fe6b28
commit 48799f3376
@@ -1540,9 +1540,11 @@ void Creature::setDeathState(DeathState s)
ResetPlayerDamageReq(); ResetPlayerDamageReq();
CreatureTemplate const* cinfo = GetCreatureTemplate(); CreatureTemplate const* cinfo = GetCreatureTemplate();
SetWalk(true); SetWalk(true);
if (GetCreatureTemplate()->InhabitType & INHABIT_AIR) if (cinfo->InhabitType & INHABIT_AIR && cinfo->InhabitType & INHABIT_GROUND)
SetCanFly(true);
else if (cinfo->InhabitType & INHABIT_AIR)
SetDisableGravity(true); SetDisableGravity(true);
if (GetCreatureTemplate()->InhabitType & INHABIT_WATER) if (cinfo->InhabitType & INHABIT_WATER)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
ClearUnitState(uint32(UNIT_STATE_ALL_STATE)); ClearUnitState(uint32(UNIT_STATE_ALL_STATE));