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


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

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


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

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

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

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

示例4: deserialize

int Smelter_Detail::deserialize(Block_Buffer & r) {
	if(r.read_int8(smelter_idx) ||
			r.read_int8(is_open)) {
		return -1;
	}
 	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:7,代码来源:Rune_Stone_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:

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

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

示例8: set_activity_state

int Scene_Gang_Manager::set_activity_state(Block_Buffer &buf) {
	int8_t swit = 0;
	buf.read_int8(swit);
	MSG_USER("GANG_WAR: state(%d)",swit);
	switch(swit) {
	case ACTIVITY_OPEN: {
		open_activity();
		break;
	}
	case ACTIVITY_CLOSE: {
		Role_Hash_Set scene_ids;
		for (SceneIndex_GangWarMatchedGangsPair_Map::const_iterator it = scene_index_gang_map_.begin();
				it != scene_index_gang_map_.end(); ++it) {
			scene_ids.insert(it->first);
		}
		GANG_WAR_SCENE_MANAGER->close_all_gang_war_scene(scene_ids);
		close_activity();
		break;
	}
	case GANG_WAR_CREATE_16: {
		gang_war_create_16();
		break;
	}
	case ACTIVITY_READY: {
		ready_activity();
		break;
	}
	default:
		break;
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:32,代码来源:Scene_Gang_Manager.cpp

示例9: deserialize

int Stronghold::deserialize(Block_Buffer &r) {
	r.read_uint32(point_id);
	int8_t tp = 0;
	r.read_int8(tp);
	type = (Expedition_Build_Type)tp;

	info.deserialize(r);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:9,代码来源:Expedition_Scene_Struct.cpp

示例10: deserialize_fighter

int Heroer_Detail::deserialize_fighter(Block_Buffer &buffer){
	this->hero_base_detail_.deserialize(buffer);
	buffer.read_int32(this->fighter_index);
	int8_t has_hero = 0;
	buffer.read_int8(has_hero);
	if(has_hero != 0){
		Hero_Info_Detail info;
		info.deserialize(buffer);
		this->hero_map[this->fighter_index] = info;
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:12,代码来源:Logic_Heroer_Struct.cpp

示例11: handle_scope

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

    Local<Value> value;
    if(field_info.field_type == "int8") {
        int8_t val = 0;
        buffer.read_int8(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int16") {
        int16_t val = 0;
        buffer.read_int16(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int32") {
        int32_t val = 0;
        buffer.read_int32(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int64") {
        int64_t val = 0;
        buffer.read_int64(val);
        value = Number::New(isolate, val);
    }
    else if(field_info.field_type == "double") {
        double val = 0;
        buffer.read_double(val);
        value = Number::New(isolate, val);
    }
    else if(field_info.field_type == "bool") {
        bool val = false;
        buffer.read_bool(val);
        value = Boolean::New(isolate, val);
    }
    else if(field_info.field_type == "string") {
        std::string val = "";
        buffer.read_string(val);
        value = String::NewFromUtf8(isolate, val.c_str(), NewStringType::kNormal).ToLocalChecked();
    }
    else {
        LOG_ERROR("Can not find the field_type:%s, struct_name:%s", field_info.field_type.c_str(), struct_name().c_str());
        return handle_scope.Escape(Local<Value>());
    }
    return handle_scope.Escape(value);
}
开发者ID:jice1001,项目名称:server,代码行数:45,代码来源:Msg_Struct.cpp

示例12: hero_battle_birth

int Player_Monster::hero_battle_birth(Block_Buffer& buf, Battle_Scene* scene) {
    int8_t has_fight_hero = 0;
    buf.read_int8(has_fight_hero);
    if (has_fight_hero) {
        Hero_Base_Detail base_detail;
        base_detail.reset();
        base_detail.deserialize(buf);

        Hero *hero = NPC_MANAGER->create_hero_in_battle_scene(scene, Coord(0,0));
        if (hero) {
            base_detail.hero_role_id = hero->role_id();
            //SCENE_PUBLIC->bind_master_id_hero(detail.master_role_id, *hero);

            hero->refresh_hero_base_detail(base_detail);

            Fighter_Detail fighter_detail;
            fighter_detail.reset();
            fighter_detail.deserialize(buf);
            hero->refresh_hero_fighter_detail(fighter_detail);

            Position_Key player_pos_key = mover_detail().battle_position;
            Position_Key hero_pos_key(player_pos_key.pos, hero->hero_const_base_detail().hero_formation);

            player_pos_key_fit_hero(player_pos_key, hero_pos_key);
            this->set_battle_position(player_pos_key.pos, player_pos_key.idx, scene);
            hero->set_pos_key(hero_pos_key.pos, hero_pos_key.idx);
            // birth
            const Coord &player_coord = mover_detail().grid_coord;
            hero->set_battle_ai();
            if (0 != hero->battle_birth(hero->hero_const_base_detail().hero_role_id, scene,	player_coord)) {
                NPC_MANAGER->destroy_npc(hero);
                return -1;
            }
            hero_role_id_ = hero->role_id();
            hero->hero_base_detail().master_role_id = role_id();
            NPC_MANAGER->battle_scene_npc_map()[hero->role_id()] = hero;
        } else {
            return -1;
        }
    }

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

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

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

示例15: inner_sync_info

int Scene_Outpost_Manager::inner_sync_info(Scene_Player* player, Block_Buffer& buf){
	int8_t sync_type = 0;
	buf.read_int8(sync_type);
		switch(sync_type){
		case 10:{// 购买流浪商人物品返回
			if(!player){
				return 0;
			}
			int scene_id = 0;
			int64_t monster_role_id = 0;
			int item_index = 0;
			int8_t result = 0;

			buf.read_int32(scene_id);
			buf.read_int64(monster_role_id);
			buf.read_int32(item_index);
			buf.read_int8(result);
			if(result == 1){
				Vagrant_Item_Info* item_info = get_vagrant_item_info(scene_id, monster_role_id, item_index);
				if(item_info){
					item_info->buy_item(player->role_id());
				}
				MSG_50211301 msg;
				msg.item_index = item_index;
				msg.result = 1;
				OBJ_SEND_TO_CLIENT(msg, (*player));
				req_vagrant_item_info(player, monster_role_id);
			}else{
				MSG_50211301 msg;
				msg.item_index = item_index;
				msg.result = 0;
				OBJ_SEND_TO_CLIENT(msg, (*player));
			}
			return 0;
			break;
		}
		case 20:{
			if(!player){
				return 0;
			}
			int8_t bless_index = 0;
			int8_t result = 0;
			buf.read_int8(bless_index);
			buf.read_int8(result);
			if(result == 1){
				Move_Scene* scene = player->move_scene();
				if(scene){
					Tbay_Scene* tbay_scene = dynamic_cast<Tbay_Scene*>(scene);
					if(tbay_scene){
						tbay_scene->inner_tbay_bless(player, bless_index);
					}
				}
				MSG_50211312 msg;
				msg.bless_index = bless_index;
				msg.result = 1;
				OBJ_SEND_TO_CLIENT(msg, (*player));
			}else{
				MSG_50211312 msg;
				msg.bless_index = bless_index;
				msg.result = 0;
				OBJ_SEND_TO_CLIENT(msg, (*player));
			}
			return 0;
			break;
		}
		default:{
			return 0;
			break;
		}
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:72,代码来源:Scene_Outpost_Manager.cpp


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