From 160666fa0007ac21920ac438688787f8d7b74004 Mon Sep 17 00:00:00 2001 From: _manuel_ Date: Sun, 4 Apr 2010 20:00:07 -0300 Subject: Fixed faction issue with vehicles in BattleGrounds. Thanks to Gyullo for help and Rat for idea. --HG-- branch : trunk --- src/game/Unit.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 92c0da3c2c0..6f539d92646 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -14993,7 +14993,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type) } // Set charmed - setFaction(charmer->getFaction()); + Map* pMap = GetMap(); + if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleGround())) + setFaction(charmer->getFaction()); + charmer->SetCharm(this, true); if (GetTypeId() == TYPEID_UNIT) @@ -15090,7 +15093,9 @@ void Unit::RemoveCharmedBy(Unit *charmer) CombatStop(); //TODO: CombatStop(true) may cause crash (interrupt spells) getHostileRefManager().deleteReferences(); DeleteThreatList(); - RestoreFaction(); + Map* pMap = GetMap(); + if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleGround())) + RestoreFaction(); GetMotionMaster()->InitDefault(); if (type == CHARM_TYPE_POSSESS) -- cgit v1.2.3