diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/TemporarySummon.cpp | 3 | ||||
-rw-r--r-- | src/game/Unit.cpp | 25 | ||||
-rw-r--r-- | src/game/Unit.h | 2 | ||||
-rw-r--r-- | src/game/Vehicle.cpp | 3 |
4 files changed, 16 insertions, 17 deletions
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 42cf0f4c2ef..3382c794622 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -334,7 +334,8 @@ void Puppet::InitStats(uint32 duration) void Puppet::InitSummon() { Minion::InitSummon(); - SetCharmedBy(m_owner, CHARM_TYPE_POSSESS); + if (!SetCharmedBy(m_owner, CHARM_TYPE_POSSESS)) + assert(false); } void Puppet::Update(uint32 time) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d17d536f468..0ba74f3b5e3 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -14016,26 +14016,26 @@ void Unit::SetConfused(bool apply) ((Player*)this)->SetClientControl(this, !apply); } -void Unit::SetCharmedBy(Unit* charmer, CharmType type) +bool Unit::SetCharmedBy(Unit* charmer, CharmType type) { if(!charmer) - return; + return false; assert(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER); assert(type != CHARM_TYPE_VEHICLE || GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isVehicle()); if(this == charmer) - return; + return false; if(hasUnitState(UNIT_STAT_UNATTACKABLE)) - return; + return false; if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetTransport()) - return; + return false; // Already charmed if(GetCharmerGUID()) - return; + return false; CastStop(); CombatStop(); //TODO: CombatStop(true) may cause crash (interrupt spells) @@ -14057,7 +14057,7 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type) // StopCastingCharm may remove a possessed pet? if(!IsInWorld()) - return; + return false; // Set charmed setFaction(charmer->getFaction()); @@ -14127,6 +14127,7 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type) break; } } + return true; } void Unit::RemoveCharmedBy(Unit *charmer) @@ -14134,17 +14135,13 @@ void Unit::RemoveCharmedBy(Unit *charmer) if(!isCharmed()) return; - // Charm was not set for unit - return - if (charmer && charmer->m_Controlled.find(this) == charmer->m_Controlled.end()) - return; - if(!charmer) charmer = GetCharmer(); else if(charmer != GetCharmer()) // one aura overrides another? { - sLog.outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, - GetGUID(), GetCharmerGUID(), charmer->GetGUID()); - assert(false); +// sLog.outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, +// GetGUID(), GetCharmerGUID(), charmer->GetGUID()); +// assert(false); return; } diff --git a/src/game/Unit.h b/src/game/Unit.h index 2e8a211e048..8cc65138d9e 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1397,7 +1397,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void SetMinion(Minion *minion, bool apply); void SetCharm(Unit* target, bool apply); Unit* GetNextRandomRaidMemberOrPet(float radius); - void SetCharmedBy(Unit* charmer, CharmType type); + bool SetCharmedBy(Unit* charmer, CharmType type); void RemoveCharmedBy(Unit* charmer); void RestoreFaction(); diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index 8389eaf4cc9..257dfb5c912 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -329,7 +329,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId) unit->m_movementInfo.t_seat = seat->first; if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right - SetCharmedBy(unit, CHARM_TYPE_VEHICLE); + if (!SetCharmedBy(unit, CHARM_TYPE_VEHICLE)) + assert(false); if(IsInWorld()) unit->SendMonsterMoveTransport(this); |