Core/Vehicles: Logic fix for AddPassenger seat validity check, thanks to Tassader

This commit is contained in:
Machiavelli
2011-01-08 21:13:18 +01:00
parent aa87c61cfb
commit 58f795d171

View File

@@ -228,7 +228,6 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next, bool byAura) const
while (seat->second.passenger || (!byAura && !seat->second.seatInfo->CanEnterOrExit()) || (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;
@@ -287,7 +286,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId, bool byAura)
if (seatId < 0) // no specific seat requirement
{
for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
if (!seat->second.passenger && (!byAura && seat->second.seatInfo->CanEnterOrExit()) || (byAura && seat->second.seatInfo->IsUsableByAura()))
if (!seat->second.passenger && ((!byAura && seat->second.seatInfo->CanEnterOrExit()) || (byAura && seat->second.seatInfo->IsUsableByAura())))
break;
if (seat == m_Seats.end()) // no available seat
@@ -303,7 +302,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId, bool byAura)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.passenger))
passenger->ExitVehicle();
else
seat->second.passenger = 0;
seat->second.passenger = NULL;
ASSERT(!seat->second.passenger);
}