本文整理汇总了C++中TransportInfo类的典型用法代码示例。如果您正苦于以下问题:C++ TransportInfo类的具体用法?C++ TransportInfo怎么用?C++ TransportInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransportInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Launch
int32 MoveSplineInit::Launch()
{
MoveSpline& move_spline = *unit.movespline;
TransportInfo* transportInfo = unit.GetTransportInfo();
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
// If boarded use current local position
if (transportInfo)
transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation);
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
moveFlags |= MOVEFLAG_WALK_MODE;
else
moveFlags &= ~MOVEFLAG_WALK_MODE;
moveFlags |= (MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD);
if (args.velocity == 0.f)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate(&unit))
return 0;
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data, true);
return move_spline.Duration();
}
开发者ID:Cryptoh,项目名称:server,代码行数:58,代码来源:MoveSplineInit.cpp
示例2: DEBUG_LOG
void WorldSession::HandleRequestVehicleExit(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_EXIT");
recvPacket.hexlike();
TransportInfo* transportInfo = _player->GetTransportInfo();
if (!transportInfo || !transportInfo->IsOnVehicle())
return;
((Unit*)transportInfo->GetTransport())->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, _player->GetObjectGuid());
}
开发者ID:82cheyenne82,项目名称:MaNGOS-Core-4.3.4,代码行数:11,代码来源:VehicleHandler.cpp
示例3: Stop
void MoveSplineInit::Stop()
{
MoveSpline& move_spline = *unit.movespline;
// No need to stop if we are not moving
if (move_spline.Finalized())
return;
TransportInfo* transportInfo = unit.GetTransportInfo();
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
// If boarded use current local position
if (transportInfo)
transportInfo->GetLocalPosition(real_position.x, real_position.y, real_position.z, real_position.orientation);
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
// corrent first vertex
args.path[0] = real_position;
args.flags = MoveSplineFlag::Done;
unit.m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_FORWARD | MOVEFLAG_CAN_FLY));
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
data << uint8(0);
data << real_position.x << real_position.y << real_position.z;
data << move_spline.GetId();
data << uint8(MonsterMoveStop);
unit.SendMessageToSet(&data, true);
}
开发者ID:Flying--Dutchman,项目名称:mangos-cata,代码行数:50,代码来源:MoveSplineInit.cpp
示例4: onNewConnection
void
Acceptor::connectionReady(
AsyncSocket::UniquePtr sock,
const SocketAddress& clientAddr,
const string& nextProtocolName,
TransportInfo& tinfo) {
// Limit the number of reads from the socket per poll loop iteration,
// both to keep memory usage under control and to prevent one fast-
// writing client from starving other connections.
sock->setMaxReadsPerEvent(16);
tinfo.initWithSocket(sock.get());
onNewConnection(std::move(sock), &clientAddr, nextProtocolName, tinfo);
}
开发者ID:chjp2046,项目名称:wangle,代码行数:13,代码来源:Acceptor.cpp
示例5: MoveTo
int32 MoveSplineInit<GameObject*>::Launch()
{
MoveSpline& move_spline = *gameobject.movespline;
TransportInfo* transportInfo = gameobject.GetTransportInfo();
Position real_position = transportInfo ?
transportInfo->GetLocalPosition() :
gameobject.GetPosition();
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized())
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// form final position only for rotate
if (!args.flags.isFacing())
return 0;
MoveTo(real_position);
}
else
{
// check path equivalence
if (!args.flags.isFacing() && args.path[0] == args.path[args.path.size() - 1])
return 0;
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
if (fabs(args.velocity) < M_NULL_F)
return 0;
// args.velocity = gameobject.GetSpeed();
move_spline.Initialize(args);
return move_spline.Duration();
}
开发者ID:Naincapable,项目名称:mangos,代码行数:39,代码来源:MoveSplineInit.cpp
示例6: onNewConnection
void
Acceptor::connectionReady(
AsyncTransportWrapper::UniquePtr sock,
const SocketAddress& clientAddr,
const string& nextProtocolName,
SecureTransportType secureTransportType,
TransportInfo& tinfo) {
// Limit the number of reads from the socket per poll loop iteration,
// both to keep memory usage under control and to prevent one fast-
// writing client from starving other connections.
auto asyncSocket = sock->getUnderlyingTransport<AsyncSocket>();
asyncSocket->setMaxReadsPerEvent(16);
tinfo.initWithSocket(asyncSocket);
tinfo.appProtocol = std::make_shared<std::string>(nextProtocolName);
if (state_ < State::kDraining) {
onNewConnection(
std::move(sock),
&clientAddr,
nextProtocolName,
secureTransportType,
tinfo);
}
}
开发者ID:SocialExplorerFork,项目名称:wangle,代码行数:23,代码来源:Acceptor.cpp
示例7: data
int32 MoveSplineInit<Unit*>::Launch()
{
MoveSpline& move_spline = *unit.movespline;
TransportInfo* transportInfo = unit.GetTransportInfo();
Position real_position = transportInfo ?
transportInfo->GetLocalPosition() :
unit.GetPosition();
// there is a big chane that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized() && !transportInfo)
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// form final position only for rotate
if (!args.flags.isFacing())
return 0;
MoveTo(real_position);
}
else
{
// check path equivalence
if (!args.flags.isFacing() && args.path[0] == args.path[args.path.size() - 1])
return 0;
}
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
moveFlags |= MOVEFLAG_WALK_MODE;
else
moveFlags &= ~MOVEFLAG_WALK_MODE;
moveFlags |= (MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD);
if (fabs(args.velocity) < M_NULL_F)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate(&unit))
return 0;
if (moveFlags & MOVEFLAG_ROOT)
moveFlags &= ~MOVEFLAG_MASK_MOVING;
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
if (transportInfo)
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << transportInfo->GetTransportGuid().WriteAsPacked();
data << int8(transportInfo->GetTransportSeat());
}
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data, true);
return move_spline.Duration();
}
开发者ID:Naincapable,项目名称:mangos,代码行数:67,代码来源:MoveSplineInit.cpp
注:本文中的TransportInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论