Beispiel #1
0
int Chat_Player::send_to_scene(Block_Buffer &buf, bool use_swap) {
	CHECK_BUFFER_LEN(buf);

	int ret = 0;
	if (buf.is_read_begin()) {
		buf.make_head(buf.get_msg_id(), role_id());
		ret = monitor_->send_to_monitor(monitor_link_.scene_muid, buf, use_swap);
		buf.set_read_begin();
	} else {
		Block_Buffer tmp_buf;
		tmp_buf.copy(&buf);
		tmp_buf.make_head(buf.get_msg_id(), role_id());
		ret = monitor_->send_to_monitor(monitor_link_.scene_muid, tmp_buf, true);
	}

	return ret;
}
Beispiel #2
0
int Chat_Player::send_to_client(Block_Buffer &buf, bool use_swap) {
	CHECK_BUFFER_LEN(buf);

	int ret = 0;
	if (buf.is_read_begin()) {
		buf.make_head(0, role_id());
		ret = send_to_gate(buf, use_swap);
		buf.set_read_begin();
	} else {
		Block_Buffer tmp_buf;
		tmp_buf.copy(&buf);
		tmp_buf.make_head(0, role_id());
		ret = send_to_gate(tmp_buf, true);
	}

	return ret;
}