Core/Vehicles: Logic fix for AddPassenger seat validity check, thanks to Tassader
This commit is contained in:
@@ -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()))
|
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)
|
if (next)
|
||||||
{
|
{
|
||||||
++seat;
|
++seat;
|
||||||
@@ -287,7 +286,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId, bool byAura)
|
|||||||
if (seatId < 0) // no specific seat requirement
|
if (seatId < 0) // no specific seat requirement
|
||||||
{
|
{
|
||||||
for (seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
|
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;
|
break;
|
||||||
|
|
||||||
if (seat == m_Seats.end()) // no available seat
|
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))
|
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.passenger))
|
||||||
passenger->ExitVehicle();
|
passenger->ExitVehicle();
|
||||||
else
|
else
|
||||||
seat->second.passenger = 0;
|
seat->second.passenger = NULL;
|
||||||
|
|
||||||
ASSERT(!seat->second.passenger);
|
ASSERT(!seat->second.passenger);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user