本文整理汇总了C++中Block_Buffer::make_client_message方法的典型用法代码示例。如果您正苦于以下问题:C++ Block_Buffer::make_client_message方法的具体用法?C++ Block_Buffer::make_client_message怎么用?C++ Block_Buffer::make_client_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block_Buffer
的用法示例。
在下文中一共展示了Block_Buffer::make_client_message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: say
void Chat::say(Time_Value &now, Location &location) {
if(now >= (last_say_time + say_interval)) {
last_say_time = now;
Robot_Player *player = (Robot_Player*)this;
MSG_10300000 msg;
msg.chat_type = 1;
Chat_Content cc;
//人物信息
cc.reset();
cc.type = 2;
cc.role_Info.role_name = player->base_detail().role_name;
cc.role_Info.career = player->base_detail().career;
cc.role_Info.gender = player->base_detail().gender;
cc.role_Info.role_id = player->base_detail().role_id;
msg.content.push_back(cc);
//聊天内容
cc.reset();
cc.type = 0;
std::ostringstream text;
text << "各位你好!我目前的场景是:" << location.scene_id << ",坐标(x=" << location.coord.x << ",y=" << location.coord.y << "), 过来找我吧~{a" << ((rand()%39)+1) << "}";
cc.text = text.str();
msg.content.push_back(cc);
//send
Block_Buffer buf;
buf.make_client_message(10300000, player->msg_detail().msg_serial++, Time_Value::gettimeofday().sec());
msg.serialize(buf);
buf.finish_message();
player->send_to_server(buf);
}
}
示例2: rand_send
void RandMsg::rand_send(void) {
Robot_Player *player = (Robot_Player*)this;
int num = rand()%msg_vec->size();
Robot_Base_Msg *msg = (*msg_vec)[num];
msg->set_rand();
Block_Buffer buf;
buf.make_client_message(msg->msg_id, player->msg_detail().msg_serial++, Time_Value::gettimeofday().sec());
msg->serialize(buf);
buf.finish_message();
player->send_to_server(buf);
//MSG_USER("%s >< 发送随机消息号:%d", player->base_detail().account.c_str(), msg->msg_id);
}