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


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

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


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

示例1: deserialize

int DragonInfo::deserialize(Block_Buffer &buffer) {
	buffer.read_uint8(progress);
	buffer.read_uint8(feeling);
	buffer.read_uint32(power);
	buffer.read_uint32(armor);
	buffer.read_uint32(stamina);
	buffer.read_uint32(power_level);
	buffer.read_uint32(armor_level);
	buffer.read_uint32(stamina_level);
	buffer.read_uint32(hero_power);
	buffer.read_uint32(hero_armor);
	buffer.read_uint32(hero_stamina);
	buffer.read_uint32(hero_power_level);
	buffer.read_uint32(hero_armor_level);
	buffer.read_uint32(hero_stamina_level);
	buffer.read_bool(is_play_dragon);
	buffer.read_uint32(energy);
	buffer.read_uint32(crit);
	buffer.read_uint32(prevent_crit);
	buffer.read_uint32(crit_level);
	buffer.read_uint32(prevent_crit_level);
	buffer.read_uint32(hero_crit);
	buffer.read_uint32(hero_prevent_crit);
	buffer.read_uint32(hero_crit_level);
	buffer.read_uint32(hero_prevent_crit_level);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:27,代码来源:Dragon_Vale_Struct.cpp

示例2: data_channle

int Answer_Manager::data_channle(Block_Buffer& buf) {
	uint8_t type = 0;
	buf.read_uint8(type);
	switch(type) {
		case ANSWER_DATA_CHANNLE_TYPE_SL_GET_RANK_REWARD: {
			uint16_t size = 0;
			buf.read_uint16(size);
			for(uint16_t i = 0; i < size; ++i) {
				uint16_t nsize = 0;
				buf.read_uint16(nsize);
				for(uint16_t j = 0; j < nsize; ++j) {
					role_id_t role_id = 0;
					buf.read_int64(role_id);
					reward_to_player(role_id, i+1);
				} //end j
			}//end i
			break;
		}// end case
		case ANSWER_DATA_CHANNLE_TYPE_SL_SAVE_DATA: {
			save_data(buf);
			break;
		}
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:25,代码来源:Answer_Manager.cpp

示例3: deserialize

int Prop_Setter::deserialize(Block_Buffer & r) {
	int prop_type_ =0, addition_type_ = 0;
	uint8_t operate_ = 0;
	if( r.read_int32(prop_type_)  ||  r.read_int32(addition_type_)  ||  r.read_uint8(operate_)  || r.read_double(basic) || r.read_double(fixed)  ||  r.read_double(percent)  )
			return -1;
	prop_type = Property_Type(prop_type_);
	addi_type = Addition_Type(addition_type_);
	operate = Operate_Type(operate_);
		return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:10,代码来源:Fighter_Detail.cpp

示例4:

int Scene_Server_Request::process_20100029(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	uint8_t gender = 0;
	buf.read_uint8(gender);
	player->modify_gender(gender);
    MSG_81000060 msg;
    msg.role_id = player->role_id();
    Prop_Change change_info;
    change_info.prop_type = PT_GENDER;
    change_info.current_val = gender;
    msg.change_info.push_back(change_info);
    Block_Buffer active_buf;
    MAKE_MSG_BUF(msg, active_buf);
    // 广播给周围玩家
    player->scene_broad_around(active_buf,Mover::SCENE_MOVE);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:17,代码来源:Scene_Server_Request.cpp

示例5: update_role_score

void Team_Arena_Controler::update_role_score(Block_Buffer &buf) {
	uint8_t type = 0;
	buf.read_uint8(type);
	if (type) {

		int role_size = 0;


		std::string server_name;
		buf.read_string(server_name);
		buf.read_int32(role_size);
		for (int i = 0; i < role_size; ++i) {
			role_id_t role_id = 0;
			int score = 0;
			int force = 0;
			std::string name;

			buf.read_int64(role_id);
			buf.read_int32(score);
			buf.read_int32(force);
			buf.read_string(name);

			Team_Role_Score_Map::iterator find_it = team_role_score_map.find(role_id);
			if (find_it != team_role_score_map.end()) {
				find_it->second.score = score;
				find_it->second.change = true;
			} else {
				Team_Role_Score role_score;
				role_score.role_id = role_id;
				role_score.score = score;
				role_score.force = force;
				role_score.name = name;
				role_score.area = server_name;
				team_role_score_map.insert(std::make_pair(role_id, role_score));
			}
		}

		if (level_team_role_score_map.empty())
			refresh_rank_list();
	} else {
		team_role_score_map.clear();
		level_team_role_score_map.clear();
	}

}
开发者ID:tidaybreak,项目名称:game-server,代码行数:45,代码来源:Team_Arena_Controler.cpp

示例6: inner_sync_info

int Honor_Arena_Manager::inner_sync_info(Scene_Player* player, Block_Buffer& buf){
	int8_t sync_type = 0;
	buf.read_int8(sync_type);
	switch(sync_type){
		case 99:{
			role_id_t role_id = 0;
			std::string role_name = "";
			uint8_t gender = 0;
			buf.read_int64(role_id);
			buf.read_string(role_name);
			buf.read_uint8(gender);
			Honor_Arena_Player_Info_Map::iterator it = player_info_map_.find(role_id);
			if(it != player_info_map_.end()){
				it->second.rank_info.role_name = role_name;
			}
			break;
		}
		default:{
			break;
		}
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:23,代码来源:Honor_Arena_Manager.cpp

示例7: scene_knight_trials_match_player

int Scene_Knight_Trials_Manager::scene_knight_trials_match_player(Block_Buffer& buf) {
	uint8_t type = 0;
	buf.read_uint8(type);
	role_id_t role_id = 0;
	buf.read_int64(role_id);
	if(!type || !role_id) {
		return 0;
	}
	int64_t from_uuid = 0;
	buf.read_int64(from_uuid);
	switch(type) {
		case KNIGHT_TRIALS_SIX_MATCH: {
			int ttl_force = 0;
			buf.read_int32(ttl_force);
			std::vector<int64_t> uuid_vector;
			SCENE_MONITOR->logic_server_uuid_to_vector(uuid_vector);
			//为了排除自己服;
			for(std::vector<int64_t>::iterator it = uuid_vector.begin(); it != uuid_vector.end(); ++it) {
				if(*it == from_uuid) {
					uuid_vector.erase(it);
					break;
				}
			}
			if(uuid_vector.empty()) {
				return 0;
			}
			std::map<int64_t, std::vector<uint8_t>> uuid_num_map;
			const Knight_Trials_Points_Conf_Map &conf = CONFIG_CACHE_KNIGHT_TRIALS->get_points_conf();
			for(uint8_t i=1; i<=conf.size(); i++){
				srandom(Time_Value::gettimeofday().sec() + Time_Value::gettimeofday().usec());
				uint32_t index = random() % uuid_vector.size();
				std::map<int64_t, std::vector<uint8_t>>::iterator it = uuid_num_map.find(uuid_vector[index]);
				if(it == uuid_num_map.end()) {
					std::vector<uint8_t> rank_vec;
					rank_vec.clear();
					rank_vec.push_back(i);
					uuid_num_map.insert(std::make_pair(uuid_vector[index], rank_vec));
				} else {
					it->second.push_back(i);
				}
			}
			for(std::map<int64_t, std::vector<uint8_t>>::iterator it = uuid_num_map.begin(); it != uuid_num_map.end(); ++it) {
				Block_Buffer block_buf;
				block_buf.make_message(INNER_KNIGHT_TRIALS_MATCH_PLAYER);
				block_buf.write_uint8(KNIGHT_TRIALS_SIX_MATCH);
				block_buf.write_int64(role_id);
				block_buf.write_int64(from_uuid);
				block_buf.write_int32(ttl_force);
				block_buf.write_uint8(it->second.size());
				for(std::vector<uint8_t>::iterator rit = it->second.begin(); rit != it->second.end(); ++rit) {
					block_buf.write_uint8(*rit);
				}
				block_buf.finish_message();
				SCENE_MONITOR->send_to_logic(it->first, block_buf);
			}
			break;
		}
		case KNIGHT_TRIALS_ONE_MATCH: {
			break;
		}
		case KNIGHT_TRIALS_SIX_MATCH_BACK: {
			Block_Buffer block_buf;
			block_buf.make_message(INNER_KNIGHT_TRIALS_MATCH_PLAYER);
			block_buf.write_uint8(KNIGHT_TRIALS_SIX_MATCH_BACK);
			block_buf.write_int64(role_id);
			block_buf.write_int64(from_uuid);
			block_buf.copy(&buf);
			SCENE_MONITOR->send_to_logic(from_uuid, block_buf);
			break;
		}
		case KNIGHT_TRIALS_ONE_MATCH_BACK: {
			break;
		}
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:76,代码来源:Scene_Knight_Trials_Manager.cpp


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