示例#1
0
void Vehicle::RemoveAccessories(){
	for( std::vector< uint64 >::iterator itr = installed_accessories.begin(); itr != installed_accessories.end(); ++itr ){
		Unit *u = owner->GetMapMgr()->GetUnit( *itr );
		if( u == NULL )
			continue;

		if( u->GetVehicleComponent() != NULL )
			u->GetVehicleComponent()->EjectAllPassengers();

		EjectPassenger( u );
		u->Delete();
	}
	
	installed_accessories.clear();
}
示例#2
0
void Vehicle::EjectPassenger(int seatId, EjectTargetDirectionTypes dir, float distance)
{
    SeatMap::iterator seat = Seats.find(seatId);

    if (seat == Seats.end())
        sLog->outError(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to eject passennger on non existing seat %u"
                       , _me->GetGUIDLow(), _me->GetEntry(), seatId);
    else if (seat->second.Passenger)
    {
        if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger))
            EjectPassenger(passenger, dir, distance);
        else
            sLog->outError(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to eject passenger on seat %u but seat s empty"
                           , _me->GetGUIDLow(), _me->GetEntry(), seatId);
    }
}