mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
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()))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user