Fixed faction issue with vehicles in BattleGrounds. Thanks to Gyullo for help and Rat for idea.

--HG--
branch : trunk
This commit is contained in:
_manuel_
2010-04-04 20:00:07 -03:00
parent a5c09f5d44
commit 160666fa00
+7 -2
View File
@@ -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)