Core/Vehicles: Some research on VehicleSeatFlagsB.
It is assumed that VehicleSeatFlagsB & 322 means the seat can be used indirectly (ie. by aura 236 (SPELL_AURA_CONTROL_VEHICLE)) even though !(VehicleSeatFlags & VEHICLE_SEAT_FLAG_USABLE). More research to be done Soon (tm). --HG-- branch : trunk
This commit is contained in:
@@ -35,7 +35,7 @@ Vehicle::Vehicle(Unit *unit, VehicleEntry const *vehInfo) : me(unit), m_vehicleI
|
||||
if (VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(seatId))
|
||||
{
|
||||
m_Seats.insert(std::make_pair(i, VehicleSeat(veSeat)));
|
||||
if (veSeat->IsUsable())
|
||||
if (veSeat->IsUsableByPlayer())
|
||||
++m_usableSeatNum;
|
||||
}
|
||||
}
|
||||
@@ -213,12 +213,15 @@ Unit *Vehicle::GetPassenger(int8 seatId) const
|
||||
return seat->second.passenger;
|
||||
}
|
||||
|
||||
int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
|
||||
int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next, bool byAura) const
|
||||
{
|
||||
SeatMap::const_iterator seat = m_Seats.find(seatId);
|
||||
if (seat == m_Seats.end()) return -1;
|
||||
while (seat->second.passenger || !seat->second.seatInfo->IsUsable())
|
||||
if (seat == m_Seats.end())
|
||||
return -1;
|
||||
|
||||
while (seat->second.passenger || (!byAura && !seat->second.seatInfo->IsUsableByPlayer()) || (byAura && !seat->second.seatInfo->IsUsableByAura()))
|
||||
{
|
||||
sLog->outDebug("Vehicle::GetNextEmptySeat: m_flags: %u, m_flagsB:%u", seat->second.seatInfo->m_flags, seat->second.seatInfo->m_flagsB);
|
||||
if (next)
|
||||
{
|
||||
++seat;
|
||||
@@ -235,6 +238,7 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
|
||||
if (seat->first == seatId)
|
||||
return -1; // no available seat
|
||||
}
|
||||
|
||||
return seat->first;
|
||||
}
|
||||
|
||||
@@ -267,7 +271,7 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
|
||||
}
|
||||
}
|
||||
|
||||
bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
bool Vehicle::AddPassenger(Unit *unit, int8 seatId, bool byAura)
|
||||
{
|
||||
if (unit->GetVehicle() != this)
|
||||
return false;
|
||||
@@ -276,7 +280,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
if (seatId < 0) // no specific seat requirement
|
||||
{
|
||||
for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
|
||||
if (!seat->second.passenger && seat->second.seatInfo->IsUsable())
|
||||
if (!seat->second.passenger && ((!byAura && seat->second.seatInfo->IsUsableByPlayer() || (byAura && seat->second.seatInfo->IsUsableByAura()))))
|
||||
break;
|
||||
|
||||
if (seat == m_Seats.end()) // no available seat
|
||||
@@ -297,7 +301,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
sLog->outDebug("Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), me->GetEntry(), m_vehicleInfo->m_ID, me->GetGUIDLow(), (int32)seat->first);
|
||||
|
||||
seat->second.passenger = unit;
|
||||
if (seat->second.seatInfo->IsUsable())
|
||||
if (seat->second.seatInfo->IsUsableByPlayer())
|
||||
{
|
||||
ASSERT(m_usableSeatNum);
|
||||
--m_usableSeatNum;
|
||||
@@ -380,7 +384,7 @@ void Vehicle::RemovePassenger(Unit *unit)
|
||||
sLog->outDebug("Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), me->GetEntry(), m_vehicleInfo->m_ID, me->GetGUIDLow(), (int32)seat->first);
|
||||
|
||||
seat->second.passenger = NULL;
|
||||
if (seat->second.seatInfo->IsUsable())
|
||||
if (seat->second.seatInfo->IsUsableByPlayer())
|
||||
{
|
||||
if (!m_usableSeatNum)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user