*Change vehicle faction the same as the driver's when driver enters it.

*Fix 3593 sql.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-27 12:42:38 -05:00
parent 75942caacb
commit ffca6ec384
4 changed files with 16 additions and 9 deletions
+6 -6
View File
@@ -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);
}
}
+2
View File
@@ -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();