aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Unit.cpp12
-rw-r--r--src/game/Vehicle.cpp2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e2db82879a4..ad210ad8fd6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -13626,16 +13626,16 @@ void Unit::RestoreFaction()
((Player*)this)->setFactionForRace(getRace());
else
{
- CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo();
-
- if(((Creature*)this)->isPet())
+ if(((Creature*)this)->HasSummonMask(SUMMON_MASK_MINION))
{
if(Unit* owner = GetOwner())
+ {
setFaction(owner->getFaction());
- else if(cinfo)
- setFaction(cinfo->faction_A);
+ return;
+ }
}
- else if(cinfo) // normal creature
+
+ if(CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo()) // normal creature
setFaction(cinfo->faction_A);
}
}
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index bfc87011761..0bcdf088bc2 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -245,6 +245,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if(seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right
{
+ setFaction(unit->getFaction());
((Player*)unit)->SetCharm(this, true);
((Player*)unit)->SetViewpoint(this, true);
((Player*)unit)->VehicleSpellInitialize();
@@ -289,6 +290,7 @@ void Vehicle::RemovePassenger(Unit *unit)
if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable())
{
+ RestoreFaction();
((Player*)unit)->SetCharm(this, false);
((Player*)unit)->SetViewpoint(this, false);
((Player*)unit)->SendRemoveControlBar();