本文整理汇总了C++中NetworkMessage::isOverrun方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkMessage::isOverrun方法的具体用法?C++ NetworkMessage::isOverrun怎么用?C++ NetworkMessage::isOverrun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkMessage
的用法示例。
在下文中一共展示了NetworkMessage::isOverrun方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsePacket
void ProtocolSpectator::parsePacket(NetworkMessage& msg)
{
if (!m_acceptPackets || g_game.getGameState() == GAME_STATE_SHUTDOWN || msg.getLength() <= 0) {
return;
}
uint8_t recvbyte = msg.getByte();
if (!player) {
if (recvbyte == 0x0F) {
disconnect();
}
return;
}
//a dead player can not perform actions
if (player->isRemoved() || player->getHealth() <= 0) {
disconnect();
return;
}
switch (recvbyte) {
case 0x14: g_dispatcher.addTask(createTask(std::bind(&ProtocolSpectator::logout, this))); break;
case 0x1D: g_dispatcher.addTask(createTask(std::bind(&ProtocolSpectator::sendPingBack, this))); break;
case 0x1E: g_dispatcher.addTask(createTask(std::bind(&ProtocolSpectator::sendPing, this))); break;
//Reset viewed position/direction if the spectator tries to move in any way
case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71:
case 0x72: g_dispatcher.addTask(createTask(std::bind(&ProtocolSpectator::sendCancelWalk, this))); break;
case 0x96: parseSpectatorSay(msg); break;
default:
break;
}
if (msg.isOverrun()) {
disconnect();
}
}