本文整理汇总了C++中GetSeatIteratorForPassenger函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSeatIteratorForPassenger函数的具体用法?C++ GetSeatIteratorForPassenger怎么用?C++ GetSeatIteratorForPassenger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSeatIteratorForPassenger函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSeatIteratorForPassenger
void Vehicle::RemovePassenger(Unit *unit)
{
if (unit->GetVehicle() != this)
return;
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
ASSERT(seat != m_Seats.end());
sLog->outDebug(LOG_FILTER_VEHICLES, "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 = 0;
if (seat->second.seatInfo->CanEnterOrExit())
{
if (!m_usableSeatNum)
{
if (me->GetTypeId() == TYPEID_PLAYER)
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
else
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
}
++m_usableSeatNum;
}
unit->ClearUnitState(UNIT_STAT_ONVEHICLE);
if (me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER
&& seat->first == 0 && seat->second.seatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
{
me->RemoveCharmedBy(unit);
if (m_bonusHP)
{
me->SetHealth(me->GetHealth() - m_bonusHP);
me->SetMaxHealth(me->GetMaxHealth() - m_bonusHP);
m_bonusHP = 0;
}
}
if (me->IsInWorld())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.t_pos.Relocate(0, 0, 0, 0);
unit->m_movementInfo.t_time = 0;
unit->m_movementInfo.t_seat = 0;
}
if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsAIEnabled)
me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
// only for flyable vehicles
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnRemovePassenger(this, unit);
}
示例2: GetSeatIteratorForPassenger
void Vehicle::RemovePassenger(Unit* unit)
{
if (unit->GetVehicle() != this)
return;
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
ASSERT(seat != Seats.end());
sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
seat->second.Passenger = 0;
if (seat->second.SeatInfo->CanEnterOrExit())
{
if (!_usableSeatNum)
{
if (_me->GetTypeId() == TYPEID_PLAYER)
_me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
else
_me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
}
++_usableSeatNum;
}
unit->ClearUnitState(UNIT_STATE_ONVEHICLE);
// trinity what this is fuck?
unit->RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_NO_STRAFE);
unit->RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_NO_JUMPING);
unit->RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_FULL_SPEED_TURNING);
unit->RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING);
unit->RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_FULL_SPEED_PITCHING);
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
_me->RemoveCharmedBy(unit);
if (_me->IsInWorld())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.t_pos.Relocate(0, 0, 0, 0);
unit->m_movementInfo.t_time = 0;
unit->m_movementInfo.t_seat = 0;
}
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
// only for flyable vehicles
if (unit->IsFlying())
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnRemovePassenger(this, unit);
}
示例3: GetSeatIteratorForPassenger
void Vehicle::RemovePassenger(Unit* unit)
{
if (unit->GetVehicle() != this)
return;
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
// it can happen that unit enters vehicle and removes owner passenger
// then vehicles is dissmised and removes all existing passengers, even the unit (vehicle has aura of unit)
// but the unit is not on the vehicles seat yet, thus crashing at ASSERT(seat != Seats.end());
// ASSERT(seat != Seats.end());
if (seat == Seats.end())
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
#endif
if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum)
_me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
// Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
seat->second.Passenger.Reset();
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
_me->RemoveCharmedBy(unit);
if (_me->IsInWorld())
{
if (!_me->GetTransport())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.transport.Reset();
}
else
unit->m_movementInfo.transport = _me->m_movementInfo.transport;
}
// only for flyable vehicles
if (_me->IsFlying() && !_me->GetInstanceId() && unit->GetTypeId() == TYPEID_PLAYER && !(unit->ToPlayer()->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT) && _me->GetEntry() != 30275 /*NPC_WILD_WYRM*/)
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnRemovePassenger(this, unit);
}
示例4: GetSeatIteratorForPassenger
Vehicle* Vehicle::RemovePassenger(Unit* unit)
{
if (unit->GetVehicle() != this)
return NULL;
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
ASSERT(seat != Seats.end());
TC_LOG_DEBUG("entities.vehicle", "Unit %s exit vehicle entry %u id %u dbguid %u seat %d",
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
if (seat->second.SeatInfo->CanEnterOrExit() && ++UsableSeatNum)
_me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
// Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
seat->second.Passenger.Reset();
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
_me->RemoveCharmedBy(unit);
if (_me->IsInWorld())
{
if (!_me->GetTransport())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.transport.Reset();
}
else
unit->m_movementInfo.transport = _me->m_movementInfo.transport;
}
// only for flyable vehicles
if (unit->IsFlying())
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnRemovePassenger(this, unit);
unit->SetVehicle(NULL);
return this;
}
示例5: GetSeatIteratorForPassenger
void Vehicle::EjectPassenger(Unit* passenger, EjectTargetDirectionTypes dir, float distance)
{
if (passenger->GetVehicle() != this)
return ;
SeatMap::iterator seat = GetSeatIteratorForPassenger(passenger);
Unit *unitBase = GetBase();
if (seat == Seats.end())
{
sLog->outError(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to eject non boarded passenger %s GuidLow: %u"
, _me->GetGUIDLow(), _me->GetEntry(), passenger->GetName().c_str(), passenger->GetGUIDLow());
return;
}
float x, y, z;
float angle = unitBase->GetOrientation();
switch (dir)
{
case EJECT_DIR_FRONT:
angle += 0.0f;
case EJECT_DIR_BACK:
angle += static_cast<float>(M_PI);
case EJECT_DIR_RIGHT:
angle += static_cast<float>(-M_PI / 2);
case EJECT_DIR_LEFT:
angle += static_cast<float>(M_PI / 2);
case EJECT_DIR_FRONT_RIGHT:
angle += static_cast<float>(-M_PI / 4);
case EJECT_DIR_BACK_RIGHT:
angle += static_cast<float>(-3 * M_PI / 4);
case EJECT_DIR_BACK_LEFT:
angle += static_cast<float>(3 * M_PI / 4);
case EJECT_DIR_FRONT_LEFT:
angle += static_cast<float>(M_PI / 4);
case EJECT_DIR_RANDOM:
angle += float(rand_norm()) * static_cast<float>(2 * M_PI);
default:
angle += 0.0f;
}
RemovePassenger(passenger);
passenger->ExitVehicle(); //I don't know why but passenger don't properly exit vehicle without that
passenger->GetNearPoint(passenger, x, y, z, passenger->GetObjectSize(), distance, angle);
passenger->GetMotionMaster()->MoveJump(x, y, z, 20.0f, 20.0f);
}
示例6: GetSeatIteratorForPassenger
Vehicle* Vehicle::RemovePassenger(Unit* unit)
{
if (unit->GetVehicle() != this)
return NULL;
SeatMap::iterator seat = GetSeatIteratorForPassenger(unit);
ASSERT(seat != Seats.end());
TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d",
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
seat->second.Passenger = 0;
if (seat->second.SeatInfo->CanEnterOrExit() && ++UsableSeatNum)
_me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
unit->ClearUnitState(UNIT_STATE_ONVEHICLE);
if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
_me->RemoveCharmedBy(unit);
if (_me->IsInWorld())
{
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
unit->m_movementInfo.ClearTransport();
}
// only for flyable vehicles
if (unit->IsFlying())
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (_me->GetTypeId() == TYPEID_UNIT && _me->ToCreature()->IsAIEnabled)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
sScriptMgr->OnRemovePassenger(this, unit);
unit->SetVehicle(NULL);
return this;
}