当前位置: 首页>>代码示例>>C++>>正文


C++ Block_Buffer::make_inner_message方法代码示例

本文整理汇总了C++中Block_Buffer::make_inner_message方法的典型用法代码示例。如果您正苦于以下问题:C++ Block_Buffer::make_inner_message方法的具体用法?C++ Block_Buffer::make_inner_message怎么用?C++ Block_Buffer::make_inner_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block_Buffer的用法示例。


在下文中一共展示了Block_Buffer::make_inner_message方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: self_close_process

int Gate_Manager::self_close_process(void) {
	server_status_ = STATUS_CLOSING;

	Block_Buffer buf;
	buf.make_inner_message(ACTIVE_DISCONNECT, ERROR_DISCONNECT_SELF);
	buf.finish_message();
	for (Gate_Player_Cid_Map::iterator iter = player_cid_map_.begin(); iter != player_cid_map_.end(); ++iter) {
		GATE_MANAGER->send_to_client(iter->first, buf);
	}
	//等待服务器通知客户端完毕
	sleep(2);

	//关闭客户端连接
	for (Gate_Player_Cid_Map::iterator iter = player_cid_map_.begin(); iter != player_cid_map_.end(); ++iter) {
		iter->second->link_close();
	}

	int i = 0;
	while (++i < 60) {
		sleep(1);
		LOG_DEBUG("gate server has user:%d", player_cid_map_.size());
		if (player_cid_map_.size() == 0)
			break;
	}

	return 0;
}
开发者ID:firehot,项目名称:server,代码行数:27,代码来源:Gate_Manager.cpp

示例2: process_create_player

int DB_Worker::process_create_player(int cid, Game_Player_Info &player_info) {
	Block_Buffer buf;
	buf.make_inner_message(SYNC_DB_GAME_CREATE_PLAYER);
	int32_t status = 0;
	if (DB_MANAGER->create_player(player_info) < 0) {
		status = ROLE_HAS_EXIST;
	} else {
		status = SUCCESS_CREATED;
		//创建所有玩家表
		create_player_data(player_info.role_id);
	}
	buf.write_string(player_info.account);
	buf.write_int32(status);
	load_player_data(player_info.role_id, buf);
	buf.finish_message();
	DB_MANAGER->send_data_block(cid, buf);
	return 0;
}
开发者ID:ACEZLY,项目名称:server,代码行数:18,代码来源:DB_Worker.cpp

示例3: process_load_player

int DB_Worker::process_load_player(int cid, std::string &account) {
	Block_Buffer buf;
	buf.make_inner_message(SYNC_DB_GAME_LOAD_PLAYER);
	buf.write_string(account);
	DB_Manager::DB_Cache_Account_Map::iterator iter = DB_MANAGER->db_cache_account_map().find(account);
	if (iter != DB_MANAGER->db_cache_account_map().end())	{
		//角色存在,开始加载数据
		buf.write_int32(SUCCESS_LOADED);
		int64_t role_id = iter->second.role_id;
		load_player_data(role_id, buf);
	} else {
		//角色不存在,直接返回
		buf.write_int32(ROLE_NOT_EXIST);
	}
	buf.finish_message();
	DB_MANAGER->send_data_block(cid, buf);
	return 0;
}
开发者ID:ACEZLY,项目名称:server,代码行数:18,代码来源:DB_Worker.cpp

示例4: process_load_public_data

int DB_Worker::process_load_public_data(int cid) {
	DB_Struct *public_data = DB_MANAGER->get_public_data_struct();
	for(std::vector<Field_Info>::iterator iter = public_data->field_vec().begin();
				iter != public_data->field_vec().end(); iter++){
		std::string type_name = (*iter).field_type;
		DB_Manager::DB_Struct_Name_Map::iterator it = DB_MANAGER->db_struct_name_map().find(type_name);
		if(it == DB_MANAGER->db_struct_name_map().end()){
			LOG_ERROR("Can not find the module %s", type_name.c_str());
			return -1;
		}

		DB_Struct *def = it->second;
		Block_Buffer buf;
		buf.make_inner_message(def->msg_id() + 400000);
		def->load_data(0, buf);
		buf.finish_message();
		DB_MANAGER->send_data_block(cid, buf);
	}

	return 0;
}
开发者ID:ACEZLY,项目名称:server,代码行数:21,代码来源:DB_Worker.cpp

示例5: process_save_player

int DB_Worker::process_save_player(int cid, Block_Buffer &buffer) {
	int32_t status = buffer.read_int32();
	if (status == 1) {
		int rdx = buffer.get_read_idx();
		buffer.read_int32();
		int64_t role_id = buffer.read_int64();
		buffer.set_read_idx(rdx);

		save_player_data(buffer);

		Block_Buffer buf;
		buf.make_inner_message(SYNC_DB_GAME_SAVE_PLAYER);
		MSG_550003 msg;
		msg.role_id = role_id;
		msg.serialize(buf);
		buf.finish_message();
		DB_MANAGER->send_data_block(cid, buf);
	} else {
		save_player_data(buffer);
	}
	return 0;
}
开发者ID:ACEZLY,项目名称:server,代码行数:22,代码来源:DB_Worker.cpp


注:本文中的Block_Buffer::make_inner_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。