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


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

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


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

示例1: deserialize

int Hero_Info_Detail::deserialize(Block_Buffer &r) {
	if( r.read_int32(hero_id)  ||  r.read_int32(hero_index)  ||  r.read_int32(hero_facade_id)  ||
			r.read_string(hero_name)  ||  r.read_int8(is_outer) ||  r.read_int8(is_fighter)  ||
			r.read_int32(level)  ||  r.read_int32(formation)  || r.read_int32(awake_lvl) ||
			r.read_double(exp)	)
			return -1;

	uint16_t __prop_value_vec_size;
	if(r.read_uint16(__prop_value_vec_size) )
			return -1;
	prop_value.reserve(__prop_value_vec_size);
	for(uint16_t i = 0; i < __prop_value_vec_size; ++i) {
			Int_Double v;
			if(v.deserialize(r))
					return -1;
			prop_value.push_back(v);
	}

	uint16_t size = 0;
	Artifact_Detail artifact_detail;
	r.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		artifact_detail.reset();
		if (artifact_detail.deserialize(r)) {
			continue;
		};
		artifacts.insert(std::make_pair(artifact_detail.artifact_id, artifact_detail));
	}
	hero_fighter_detail.deserialize(r);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:31,代码来源:Logic_Heroer_Struct.cpp

示例2: deserialize

void Map_Team::deserialize(Block_Buffer &buf) {
	buf.read_int8(type_);
	buf.read_string(words_);
	buf.read_int32(scene_id_);
	buf.read_int8(degree_);
	buf.read_uint32(team_index_);
	buf.read_int64(team_id_);
	buf.read_int64(team_id_for_scene_);
	buf.read_int64(leader_role_id_);
	uint16_t len = 0;
	buf.read_uint16(len);
	int64_t role_id = 0;
	for (uint16_t i = 0; i < len; ++i) {
		buf.read_int64(role_id);
		team_member_set_.insert(role_id);
	}
	buf.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		buf.read_int64(role_id);
		offline_teamer_map_.insert(std::make_pair(role_id, Online_Teamer_Info()));
	}
	buf.read_int8(in_battle_);
	buf.read_uint16(len);
	Int_Role_Id int_role_id;
	Int_Role_Id_Vec lineup;
	for (uint16_t i = 0; i < len; ++i) {
		int_role_id.deserialize(buf);
		lineup.push_back(int_role_id);
	}
	this->lineup_replace(lineup);
	buf.read_int32(enter_level_);
	buf.read_int16(fail_times_);
	buf.read_int16(match_fail_);
	buf.read_bool(is_not_first_team_fb_);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:35,代码来源:Map_Team.cpp

示例3: 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

示例4: deserialize

int Anci_Artifact_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_int64(role_id);
//	buffer.read_int64(perfectPoint);
	uint16_t len = 0;
	buffer.read_uint16(len);
	aa_info_map.clear();
	Anci_Artifact_Cond_Info info;
	for (uint16_t i = 0; i < len; ++i) {
		info.reset();
		buffer.read_int32(info.id);
		buffer.read_int8(info.state_count);
		buffer.read_int32(info.data);
		aa_info_map.insert(std::make_pair(info.id, info));
	}
	buffer.read_uint16(len);
	complete_ids.clear();
	int32_t complete_id = 0;
	for (uint16_t i = 0; i < len; ++i) {
		buffer.read_int32(complete_id);
		complete_ids.insert(complete_id);
	}
	aa_unban_info.clear();
	Anci_Artifact_Unban_Info aa_ui;
	for (uint16_t i = 0; i < len; ++i) {
		aa_ui.reset();
		buffer.read_int32(aa_ui.id);
		buffer.read_int8(aa_ui.state);
		buffer.read_int8(aa_ui.box_state);
		aa_unban_info.insert(std::make_pair(aa_ui.id, aa_ui));
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:32,代码来源:Anci_Artifact_Struct.cpp

示例5: gang_war_load_source_gangs_from_logic

int Scene_Gang_Manager::gang_war_load_source_gangs_from_logic(Block_Buffer &buf) {
	int8_t type = 0;
	buf.read_int8(type);
	if (type == 1) {
		int64_t server_id = 0;
		std::string zone;
		uint16_t len = 0;
		int8_t stage = 0;

		buf.read_int64(server_id);
		buf.read_string(zone);
		buf.read_int8(stage);
		if (stage != stage_
				|| load_source_ < Time_Value::gettimeofday()) {
			gang_map_.clear();
			gangid_serverid_map_.clear();
			gangid_zone_map_.clear();
			server_ids_.clear();
			stage_ = stage;
			load_source_ = Time_Value::gettimeofday() + Time_Value(Time_Value::ONE_MINUTE_IN_SECS * 5);
			MSG_USER("GANG_WAR: source_gangs server_id(%d) clear data",server_id);
		}
		server_ids_.insert(server_id);
		buf.read_uint16(len);
		Gang_War_Spot spot;
		std::map<int8_t, Gang_War_Spot> gang_war_result_map;
		for (uint16_t i = 0; i < len; ++i) {
			spot.reset();
			spot.deserialize(buf);
			gang_war_result_map.insert(std::make_pair(spot.index, spot));
		}
		if (!gang_war_result_map.empty()) {
			gang_war_result_map_.clear();
			gang_war_result_map_ = gang_war_result_map;
		}
		buf.read_uint16(len);
		Gang_DB_View info;
		for (uint16_t i = 0; i < len; ++i) {
			info.reset();
			info.gang_war_deserialize(buf);
			gang_map_.insert(std::make_pair(info.gang_id, info));
			gangid_serverid_map_.insert(std::make_pair(info.gang_id, server_id));
			gangid_zone_map_.insert(std::make_pair(info.gang_id, zone));
			SCENE_GANG_GLOBAL_MANAGER->add_gang(info.gang_id, this);
		}
		MSG_USER("GANG_WAR: source_gangs server_id(%d)",server_id);
	} else {
		role_id_t gang_id = 0;
		buf.read_int64(gang_id);
		gang_map_.erase(gang_id);
		gangid_serverid_map_.erase(gang_id);
		gangid_zone_map_.erase(gang_id);
		SCENE_GANG_GLOBAL_MANAGER->erase_gang(gang_id);
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:56,代码来源:Scene_Gang_Manager.cpp

示例6: deserialize

int Skill_Running_Info::deserialize(Block_Buffer &buf) {
	uint32_t sec = 0, usec = 0;

	buf.read_int32(skill_id);

	buf.read_uint32(sec);
	buf.read_uint32(usec);
	last_use_timestamp.sec(sec);
	last_use_timestamp.usec(usec);

	buf.read_int32(use_times);
	uint16_t size;
	buf.read_uint16(size);

	buf.read_int32(last_step);
	buf.read_uint32(sec);
	buf.read_uint32(usec);

	config_cache = CONFIG_CACHE_FIGHTER->skill_config_cache(skill_id);
	if (NULL == config_cache) {
		return -1;
	}

	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:25,代码来源:Fighter_Detail.cpp

示例7:

int Scene_Server_Request::process_20100503(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	int8_t type = 0;
	uint16_t len = 0;
	buf.read_int8(type);
	buf.read_uint16(len);
	if (len <= 0) {
		return 0;
	}
//	player
	Hero *hero = SCENE_PUBLIC->find_fight_hero(role_id);
	if (!hero) {
		return 0;
	}
	if (type == 1) { // add
		for (uint16_t i = 0; i < len; ++i) {
			hero->inner_status_insert(buf);
		}
	} else {
		Int_Hash_Set is;
		int status_id = 0;
		for (uint16_t i = 0; i < len; ++i) {
			buf.read_int32(status_id);
			is.insert(status_id);
		}
		hero->erase_status_in_set(is);
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:29,代码来源:Scene_Server_Request.cpp

示例8: handle_scope

v8::Local<v8::Map> Msg_Struct::build_object_map(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate) {
    EscapableHandleScope handle_scope(isolate);

    uint16_t vec_size = 0;
    buffer.read_uint16(vec_size);
    Local<Map> map = Map::New(isolate);
    if(is_struct(field_info.field_type)) {
        for(uint16_t i = 0; i < vec_size; ++i) {
            Local<Object> object = build_object_struct(field_info, buffer, isolate);
            Local<Value> key = object->Get(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, field_info.key_name.c_str(), NewStringType::kNormal).ToLocalChecked()).ToLocalChecked();
            map->Set(isolate->GetCurrentContext(), key, object).ToLocalChecked();
        }
    }
    else {
        Field_Info key_info;
        key_info.field_label = "args";
        key_info.field_type = field_info.key_type;
        key_info.field_name = field_info.key_name;
        Local<Value> key = build_object_arg(key_info, buffer, isolate);
        Local<Value> value = build_object_arg(field_info, buffer, isolate);

        map->Set(isolate->GetCurrentContext(), key, value).ToLocalChecked();
    }

    return handle_scope.Escape(map);
}
开发者ID:jice1001,项目名称:server,代码行数:26,代码来源:Msg_Struct.cpp

示例9: if

int Scene_Server_Request::process_20100403(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	int8_t type = 0;
	buf.read_int8(type);
	uint16_t vec_size = 0;
	if (buf.read_uint16(vec_size)) {
		return -1;
	}

	Int_Double_Map force_map;
	player->get_all_pre_force(force_map);
	int old_val = player->fighter_detail().force;

	Skill_Info skill_info;
	for (uint16_t i = 0; i < vec_size; ++i) {
		skill_info.reset();
		skill_info.deserialize(buf);
		if (type == NPT_ADD) {
			player->add_skill_extra(skill_info.skill_id, skill_info.skill_lv);
		} else if (type == NPT_REMOVE) {
			player->remove_skill_extra(skill_info.skill_id, skill_info.skill_lv);
		}
	}

	if (vec_size > 0) {
		player->sync_force_to_client();
	}

	int new_val = player->fighter_detail().force;
	player->print_all_part_force(100, new_val-old_val, force_map);

	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:33,代码来源:Scene_Server_Request.cpp

示例10: deserialize

void Expedition_Drop_Or_Material::deserialize(Block_Buffer &r) {
	this->birth_time.deserialize(r);
	uint16_t len = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		int64_t role_id = 0;
		r.read_int64(role_id);
		had_collected.insert(role_id);
	}
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:10,代码来源:Expedition_Scene_Struct.cpp

示例11: deserialize

int Public_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_string(plot_id);
	buffer.read_int32(plot_step);
	buffer.read_bool(plot_switch);

	uint16_t size = 0;
	buffer.read_uint16(size);
	std::string str = "";
	int num = 0;
	for (uint16_t i = 0; i < size; ++i) {
		buffer.read_string(str);
		buffer.read_int32(num);
		plot_info.insert(String_Int_Map::value_type(str, num));
	}

	buffer.read_int32(awake_lvl);

	Artifact_Detail artifact_detail;
	buffer.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		artifact_detail.reset();
		if (artifact_detail.deserialize(buffer)) {
			continue;
		};
		artifacts.insert(std::make_pair(artifact_detail.artifact_id, artifact_detail));
	}

	int32_t gift_lvl = 0;
	int8_t status = 0;
	buffer.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		buffer.read_int32(gift_lvl);
		buffer.read_int8(status);
		fornotice_gifts_status.insert(std::make_pair(gift_lvl, status));
	}

	buffer.read_int32(exploit_val);
	buffer.read_int32(exploit_lvl);

	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:41,代码来源:Public_Struct.cpp

示例12: deserialize

int Logic_Status_Detail::deserialize(Block_Buffer &buffer) {
//	buffer.read_int64(this->role_id);
	uint16_t len = 0;
	buffer.read_uint16(len);
	Status_Info status_info;
	status_map.clear();
	for (uint16_t i = 0; i < len; ++i) {
		status_info.reset();
		status_info.deserialize(buffer);
		status_map.insert(std::make_pair(status_info.status_id_, status_info));
	}
	running_effect.reset();
	running_effect.deserialize(buffer);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:15,代码来源:Logic_Status_Struct.cpp

示例13: deserialize

int Rune_Stone_Detail::deserialize(Block_Buffer & r) {
	r.read_int64(role_id);
	r.read_int32(points);

	uint16_t size = 0;
	r.read_uint16(size);
	Smelter_Detail smelter_detail;
	for (uint16_t i = 0; i < size; ++i) {
		smelter_detail.reset();
		smelter_detail.deserialize(r);
		if (smelter_detail.smelter_idx) {
			smelter_detail_map[smelter_detail.smelter_idx] = smelter_detail;
		}
	}

	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:17,代码来源:Rune_Stone_Struct.cpp

示例14: deserialize

int DragonBuildingInfo::deserialize(Block_Buffer &buffer) {
	buffer.read_uint32(id);
	buffer.read_uint8(type);
	buffer.read_uint16(level);
	buffer.read_uint8(status);
	buffer.read_uint32(production);
	buffer.read_bool(is_gain);

	uint64_t  temp_begin_upgrade_time_sec = 0;
	uint64_t temp_last_output_production_time_sec = 0;
	buffer.read_uint64(temp_begin_upgrade_time_sec);
	buffer.read_uint64(temp_last_output_production_time_sec);

	begin_upgrade_time.sec((long)temp_begin_upgrade_time_sec);
	last_output_production_time.sec((long)temp_last_output_production_time_sec);

	buffer.read_uint8(order);
	buffer.read_uint8(consume_type);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:20,代码来源:Dragon_Vale_Struct.cpp

示例15: process_server_msg

int Message_Unit::process_server_msg(uint32_t msg_id, int cid, Block_Buffer &buf) {
	switch (msg_id) {
	case SERVER_INNER_LINK_BUILD: {
		int type = 0;
		buf.read_int32(type);

		uint16_t muid_size = 0;
		if (!buf.read_uint16(muid_size)) {
			Monitor_Mark_Vec muids;
			Monitor_Unique_ID muid;
			for (int i = 0; i < muid_size; ++i) {
				muid.reset();
				muid.deserialize(buf);
				monitor()->server_muid_build(muid, cid, 2);
			}
		} else {
			LOG_USER("server link build error!");
		}
		break;
	}
	case SERVER_INNER_SELF_CLOSE: {
		DAEMON_SERVER_INSTANCE->set_server_list(Daemon_Server::MONITOR_SHUTDOWN);
		break;
	}
	case SERVER_INNER_CONFIG_UPDATE: {
		Time_Value now = Time_Value::gettimeofday();

		std::string module;
		buf.read_string(module);
		String_Vec files;
		uint16_t f_size = 0;
		buf.read_uint16(f_size);
		for (int i = 0; i < f_size; ++i) {
			std::string file_path;
			buf.read_string(file_path);
			files.push_back(file_path);
		}
		LOG_DEBUG("config update! module:%s, file size:%d, type:%d, idx:%d", module.c_str(), f_size, monitor_->type(), monitor_->monitor_idx());


		int cross_id = CONFIG_CACHE->server_maintainer_cache().game_inter_flag;
		if(module == "server_global_conf") {
			//加载主配制
			CONFIG_INSTANCE->load_global_config();
			CONFIG_CACHE->refresh_maintainer_cache();
			RECORD_CLIENT->set_switcher(CONFIG_CACHE->server_maintainer_cache().record_log_level);
			Lib_Log::instance()->set_switcher(CONFIG_CACHE->server_maintainer_cache().local_log_level);
		} else {
			CONFIG_INSTANCE->update_config(files, module);
		}

		// 重启条件:跨服id改变且还没开服
		bool restart = false;
		if (cross_id != CONFIG_CACHE->server_maintainer_cache().game_inter_flag) {
			LOG_DEBUG("inter change, new:%d old:%d, open_time:%ld", CONFIG_CACHE->server_maintainer_cache().game_inter_flag, cross_id,
					CONFIG_CACHE->server_maintainer_cache().game_open_time.sec());
			if (CONFIG_CACHE->server_maintainer_cache().game_open_time > Time_Value::gettimeofday()) {
				restart = true;
			} else {
				CONFIG_CACHE->set_cross_info(cross_id);
			}
		}

		Time_Value cost_t = Time_Value::gettimeofday() - now;
		process_config_hook(module, restart);

		break;
	}
	case SERVER_INNER_HEARTBEAT: {
		Block_Buffer inner_buf;
		inner_buf.make_message(SERVER_INNER_HEARTBEAT_BACK);
		inner_buf.copy(&buf);
		inner_buf.finish_message();
		inner_buf.make_head(inner_buf.get_msg_id(), 0);
		monitor_->send_to_server_by_cid(cid, inner_buf);
		break;
	}
	case SERVER_INNER_MSG_TEST: {
		break;
	}
	default : {
		return CALL_CONTINUE;
		break;
	}
	}

	return CALL_RETURN;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:88,代码来源:Message_Unit.cpp


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