本文整理汇总了C++中SerializeBuffer::move_read_position方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializeBuffer::move_read_position方法的具体用法?C++ SerializeBuffer::move_read_position怎么用?C++ SerializeBuffer::move_read_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializeBuffer
的用法示例。
在下文中一共展示了SerializeBuffer::move_read_position方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handle_message
bool GameNetConnection::_handle_message(int sender,
SerializeBuffer& serializer) {
// Read type from buffer
message_t type;
serializer.read_int(type);
switch (type) {
case PACKET_CLIENT2SERV_CONNECTION_AFFIRM: {
net_recv_connection_affirm(serializer, sender, pd);
break;
}
case PACKET_SERV2CLIENT_INITIALPLAYERDATA: {
net_recv_game_init_data(serializer, sender, init_data, pd);
break;
}
case PACKET_ACTION: {
net_recv_player_actions(serializer, sender, pd);
break;
}
case PACKET_CHAT_MESSAGE: {
ChatMessage msg;
msg.deserialize(serializer);
chat.add_message(msg);
break;
}
default:
serializer.move_read_position(-(int)sizeof(int));
return false;
}
return true;
}
示例2: has_message
static bool has_message(std::vector<QueuedMessage>& delayed_messages,
int type) {
for (int i = 0; i < delayed_messages.size(); i++) {
SerializeBuffer* msg = delayed_messages[i].message;
int msg_type;
msg->read_int(msg_type);
msg->move_read_position(-(int)sizeof(int));
if (type == msg_type) {
return true;
}
}
return false;
}
示例3: find_message_type
static int find_message_type(QueuedMessage& qm,
std::vector<QueuedMessage>& delayed_messages, int type) {
for (int i = 0; i < delayed_messages.size(); i++) {
qm = delayed_messages[i];
SerializeBuffer* msg = qm.message;
int msg_type;
msg->read_int(msg_type);
msg->move_read_position(-(int) sizeof(int));
if (type == msg_type) {
return i;
}
}
return -1;
}
示例4: extract_message
static bool extract_message(QueuedMessage& qm,
std::vector<QueuedMessage>& delayed_messages, int type) {
for (int i = 0; i < delayed_messages.size(); i++) {
qm = delayed_messages[i];
SerializeBuffer* msg = qm.message;
int msg_type;
msg->read_int(msg_type);
if (type == msg_type) {
delayed_messages.erase(delayed_messages.begin() + i);
return true;
}
msg->move_read_position(-(int)sizeof(int));
}
return false;
}