本文整理汇总了C++中MovementInfo::Sanitize方法的典型用法代码示例。如果您正苦于以下问题:C++ MovementInfo::Sanitize方法的具体用法?C++ MovementInfo::Sanitize怎么用?C++ MovementInfo::Sanitize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovementInfo
的用法示例。
在下文中一共展示了MovementInfo::Sanitize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleDismissControlledVehicle
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
uint64 vehicleGUID = _player->GetCharmGUID();
if (!vehicleGUID) // something wrong here...
{
recvData.rfinish(); // prevent warnings spam
return;
}
MovementInfo mi;
mi.ReadFromPacket(recvData);
mi.Sanitize(_player);
_player->m_movementInfo = mi;
_player->ExitVehicle();
}
示例2: HandleMovementInfo
bool WorldSession::HandleMovementInfo(MovementInfo &movementInfo, const uint16 opcode, const size_t packSize, Unit *mover)
{
ASSERT(mover != NULL);
if (movementInfo.guid != mover->GetGUID() || !movementInfo.pos.IsPositionValid())
return false;
Player* plrMover = mover->ToPlayer();
if (plrMover && plrMover->IsBeingTeleported())
return false;
if (plrMover && plrMover->HasUnitState(UNIT_STATE_CONTROLLED_BY_SERVER) && !CanMovementBeProcessed(opcode))
return false;
movementInfo.Sanitize(mover);
if (movementInfo.t_guid)
{
if (movementInfo.t_pos.GetPositionX() > 50.0f || movementInfo.t_pos.GetPositionY() > 50.0f || movementInfo.t_pos.GetPositionZ() > 50.0f)
return false; // moved out of transport size
if (!Trinity::IsValidMapCoord(
movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(),
movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(),
movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(),
movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation())
)
return false; // just bad coords
if (plrMover)
{
if (!plrMover->GetTransport()) // didn't have transport. now have
{
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
{
if ((*iter)->GetGUID() == movementInfo.t_guid)
{
plrMover->m_transport = *iter;
(*iter)->AddPassenger(plrMover);
break;
}
}
}
else if (plrMover->GetTransport()->GetGUID() != movementInfo.t_guid) // changes transport
{
bool foundNewTransport = false;
plrMover->m_transport->RemovePassenger(plrMover);
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
{
if ((*iter)->GetGUID() == movementInfo.t_guid)
{
foundNewTransport = true;
plrMover->m_transport = *iter;
(*iter)->AddPassenger(plrMover);
break;
}
}
if (!foundNewTransport)
{
plrMover->m_transport = NULL;
movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
movementInfo.t_time = 0;
movementInfo.t_seat = -1;
}
}
else if (movementInfo.pos.m_positionX != movementInfo.t_pos.m_positionX)
plrMover->GetTransport()->UpdatePosition(&movementInfo);
}
if (!mover->GetTransport() && !mover->GetVehicle())
{
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.t_guid);
if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
movementInfo.t_guid = 0;
}
}
else if (plrMover && plrMover->GetTransport()) // had transport, no loger have
{
plrMover->m_transport->RemovePassenger(plrMover);
plrMover->m_transport = NULL;
movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
movementInfo.t_time = 0;
movementInfo.t_seat = -1;
}
if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight())
plrMover->HandleFall(movementInfo);
if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater())
{
// now client not include swimming flag in case jumping under water
plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));
}
if (plrMover)
sAnticheatMgr->StartHackDetection(plrMover, movementInfo, opcode);
WorldPacket data(movementInfo.GetSMSGOpcodeForCMSG(Opcodes(opcode)), packSize);
//.........这里部分代码省略.........