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


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

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


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

示例1: serialize

int Expedition_Global_Manager_Data::serialize(Block_Buffer &w) const {
	w.write_uint16(opened_uuid_opentime_map_.size());
	for (Role_Id_Time_Map::const_iterator it = opened_uuid_opentime_map_.begin();
			it != opened_uuid_opentime_map_.end(); ++it) {
		w.write_int64(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(uuid_inter_map_.size());
	for (Role_Int_Map::const_iterator it = uuid_inter_map_.begin();
			it != uuid_inter_map_.end(); ++it) {
		w.write_int64(it->first);
		w.write_int32(it->second);
	}

	w.write_uint16(opentime_.size());
	for (Int_Time_Map::const_iterator it = opentime_.begin();
			it != opentime_.end(); ++it) {
		w.write_int32(it->first);
		it->second.serialize(w);
	}

	mmuid_.serialize(w);

//	w.write_uint16(inter_manager_data_map_.size());
//	for (Inter_ExpeditionManagerData_Map::const_iterator it = inter_manager_data_map_.begin();
//			it != inter_manager_data_map_.end(); ++it) {
//		w.write_uint32(it->first);
//		it->second.serialize(w);
//	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:32,代码来源:Expedition_Scene_Struct.cpp

示例2: serialize

int Public_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_string(plot_id);
	buffer.write_int32(plot_step);
	buffer.write_bool(plot_switch);

	buffer.write_uint16(plot_info.size());
	for (String_Int_Map::const_iterator it = plot_info.begin(); it != plot_info.end(); ++it) {
		buffer.write_string(it->first);
		buffer.write_int32(it->second);
	}

	buffer.write_int32(awake_lvl);

	buffer.write_uint16(artifacts.size());
	for (Artifact_Map::const_iterator it = artifacts.begin(); it != artifacts.end(); ++it) {
		it->second.serialize(buffer);
	}

	buffer.write_uint16(fornotice_gifts_status.size());
	for (Fornotice_Gifts_Status_Map::const_iterator it = fornotice_gifts_status.begin();
			it != fornotice_gifts_status.end(); ++it) {
		buffer.write_int32(it->first);
		buffer.write_int8(it->second);
	}

	buffer.write_int32(exploit_val);
	buffer.write_int32(exploit_lvl);

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

示例3: serialize

void Map_Team::serialize(Block_Buffer &buf) {
	buf.write_int8(type_);
	buf.write_string(words_);
	buf.write_int32(scene_id_);
	buf.write_int8(degree_);
	buf.write_uint32(team_index_);
	buf.write_int64(team_id_);
	buf.write_int64(team_id_for_scene_);
	buf.write_int64(leader_role_id_);
	uint16_t len = 0;
	len = team_member_set_.size();
	buf.write_uint16(len);
	for (Role_Hash_Set::iterator it = team_member_set_.begin(); it != team_member_set_.end(); ++it) {
		buf.write_int64(*it);
	}
	len = offline_teamer_map_.size();
	buf.write_uint16(len);
	for (RoleID_OnlineMap_TeamerInfo_Map::iterator it = offline_teamer_map_.begin(); it != offline_teamer_map_.end(); ++it) {
		buf.write_int64(it->first);
	}
	buf.write_int8(in_battle_);
	len = lineup_.size();
	buf.write_uint16(len);
	for (Int_Role_Id_Vec::iterator it = lineup_.begin(); it != lineup_.end(); ++it) {
		it->serialize(buf);
	}
	buf.write_int32(enter_level_);
	buf.write_int16(fail_times_);
	buf.write_int16(match_fail_);
	buf.write_bool(is_not_first_team_fb_);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:31,代码来源:Map_Team.cpp

示例4: build_buffer_map

void Msg_Struct::build_buffer_map(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate, v8::Local<v8::Value> value) {
    if (!value->IsMap()) {
        LOG_ERROR("field_name:%s is not map, struct_name:%s", field_info.field_name.c_str(), struct_name().c_str());
        buffer.write_uint16(0);
        return;
    }

    Local<Map> map = Local<Map>::Cast(value);
    int16_t len = map->Size();
    buffer.write_uint16(len);
    Local<Array> array = map->AsArray();
    //index N is the Nth key and index N + 1 is the Nth value.
    if(is_struct(field_info.field_type)) {
        for (int i = 0; i < len * 2; i = i + 2) {
            Local<Value> element = array->Get(isolate->GetCurrentContext(), i + 1).ToLocalChecked();
            build_buffer_struct(field_info, buffer, isolate, element);
        }
    }
    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;
        for (int i = 0; i < len * 2; i = i + 2) {
            Local<Value> key = array->Get(isolate->GetCurrentContext(), i).ToLocalChecked();
            Local<Value> element = array->Get(isolate->GetCurrentContext(), i + 1).ToLocalChecked();
            build_buffer_struct(key_info, buffer, isolate, key);
            build_buffer_struct(field_info, buffer, isolate, element);
        }
    }
}
开发者ID:jice1001,项目名称:server,代码行数:31,代码来源:Msg_Struct.cpp

示例5: send_to_logic_get_rank_reward

void Answer_Scene::send_to_logic_get_rank_reward(void) {
	refresh_rank();
	//以下代码;策划要求改跨服需要特殊处理
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_SL_GET_RANK_REWARD);
	buf.write_uint16(role_sorce_rank.size());
	for(RoleID_Data_Vec_Map::iterator iter = role_sorce_rank.begin(); iter != role_sorce_rank.end(); ++iter) {
		buf.write_uint16(iter->second.size());
		for(RoleID_Data_Vec::iterator it = iter->second.begin(); it != iter->second.end(); ++it) {
			buf.write_int64(it->role_id);
		}
	}
	SCENE_MONITOR->send_to_logic(CONFIG_CACHE->server_flag(), buf);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:15,代码来源:Answer_Scene.cpp

示例6: serialize

int Logic_Status_Detail::serialize(Block_Buffer &buffer) const {
//	buffer.write_int64(this->role_id);
	buffer.write_uint16(status_map.size());
	for (Status_Map::const_iterator it = status_map.begin(); it != status_map.end(); ++it) {
		it->second.serialize(buffer);
	}
	running_effect.serialize(buffer);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:9,代码来源:Logic_Status_Struct.cpp

示例7: serialize

int Talent::serialize(Block_Buffer &buf) const {
	buf.write_int32(talent_id);
	buf.write_int32(skill_point);
	buf.write_uint16(skill_db_info_map.size());
	for (Skill_DB_Info_Map::const_iterator it = skill_db_info_map.begin(); it != skill_db_info_map.end(); ++it) {
		it->second.serialize(buf);
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:9,代码来源:Fighter_Detail.cpp

示例8: build_buffer_vector

void Msg_Struct::build_buffer_vector(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate, v8::Local<v8::Value> value) {
    if (!value->IsArray()) {
        LOG_ERROR("field_name:%s is not array, struct_name:%s", field_info.field_name.c_str(), struct_name().c_str());
        buffer.write_uint16(0);
        return;
    }

    Local<Array> array = Local<Array>::Cast(value);
    int16_t len = array->Length();
    buffer.write_uint16(len);
    for (int i = 0; i < len; ++i) {
        Local<Value> element = array->Get(isolate->GetCurrentContext(), i).ToLocalChecked();
        if(is_struct(field_info.field_type)) {
            build_buffer_struct(field_info, buffer, isolate, element);
        }
        else {
            build_buffer_arg(field_info, buffer, isolate, element);
        }
    }
}
开发者ID:jice1001,项目名称:server,代码行数:20,代码来源:Msg_Struct.cpp

示例9: serialize

int Anci_Artifact_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_int64(role_id);
//	buffer.write_int64(perfectPoint);
	buffer.write_uint16(aa_info_map.size());
	for (AA_Info_Map::const_iterator it = aa_info_map.begin(); it != aa_info_map.end(); ++it) {
		buffer.write_int32(it->second.id);
		buffer.write_int8(it->second.state_count);
		buffer.write_int32(it->second.data);
	}
	buffer.write_uint16(complete_ids.size());
	for (Int_Hash_Set::const_iterator it = complete_ids.begin(); it != complete_ids.end(); ++it) {
		buffer.write_int32(*it);
	}
	buffer.write_uint16(aa_unban_info.size());
	for (AA_Unban_Info::const_iterator it = aa_unban_info.begin(); it != aa_unban_info.end(); ++it) {
		buffer.write_int32(it->second.id);
		buffer.write_int8(it->second.state);
		buffer.write_int8(it->second.box_state);
	}
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:21,代码来源:Anci_Artifact_Struct.cpp

示例10: serialize

int Rune_Stone_Detail::serialize(Block_Buffer & w) const {
	w.write_int64(role_id);
	w.write_int32(points);
	w.write_int32(remain_double_times);

	w.write_uint16(smelter_detail_map.size());
	for (Smelter_Detail_Map::const_iterator it = smelter_detail_map.begin(); it != smelter_detail_map.end(); ++it) {
		it->second.serialize(w);
	}

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

示例11: serialize

int DragonBuildingInfo::serialize(Block_Buffer &buffer) const {
	buffer.write_uint32(id);
	buffer.write_uint8(type);
	buffer.write_uint16(level);
	buffer.write_uint8(status);
	buffer.write_uint32(production);
	buffer.write_bool(is_gain);
	buffer.write_uint64((uint64_t)begin_upgrade_time.sec());
	buffer.write_uint64((uint64_t)last_output_production_time.sec());
	buffer.write_uint8(order);
	buffer.write_uint8(consume_type);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:13,代码来源:Dragon_Vale_Struct.cpp

示例12: serialize

void Hero_Info_Detail::serialize(Block_Buffer &w) const {
	w.write_int32(hero_id);
	w.write_int32(hero_index);
	w.write_int32(hero_facade_id);
	w.write_string(hero_name);
	w.write_int8(is_outer);
	w.write_int8(is_fighter);
	w.write_int32(level);
	w.write_int32(formation);
	w.write_int32(awake_lvl);
	w.write_double(exp);

	uint16_t __prop_value_vec_size = prop_value.size();
	w.write_uint16(__prop_value_vec_size);
	for(uint16_t i = 0; i < __prop_value_vec_size; ++i) {
			prop_value[i].serialize(w);
	}

	w.write_uint16(artifacts.size());
	for (Artifact_Map::const_iterator it = artifacts.begin(); it != artifacts.end(); ++it) {
		it->second.serialize(w);
	}
	hero_fighter_detail.serialize(w);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:24,代码来源:Logic_Heroer_Struct.cpp

示例13: sync_to_logic

int Scene_Gang_Manager::sync_to_logic(void) {
	MSG_USER("GANG_WAR:sync_to_logic, stage(%d), gang_vec_.size(%d)", stage(), gang_vec_.size());
	Block_Buffer buf;
	buf.make_message(INNER_SYNC_GANG_WAR_INFO);
	buf.write_int8(stage());
	buf.write_uint16(gang_vec_.size());
	int64_t index = 0;
	int8_t camp = 0;
	Time_Value match_time = Time_Value::zero;
	int64_t scene_index = 0;
	std::string zone;
	std::string gang_name;
	int8_t rank = 0;
	int64_t force = 0;
	for (GangWarMatchedGangsPair_Vec::const_iterator it = gang_vec_.begin(); it != gang_vec_.end(); ++it) {
		buf.write_int64(it->matched_pair.first);
		{
			index = 0;
			camp = 0;
			match_time = Time_Value::zero;
			scene_index = 0;
			zone.clear();
			gang_name.clear();
			rank = 0;
			force = 0;
			const Gang_War_Matched_Gang_Info *it_index = find_matched_gang_info(it->matched_pair.first);
			if (it_index) {
				index = it_index->matched_index;
				camp = it_index->camp;
				match_time.set(it_index->match_time);
				scene_index = it_index->scene_index;
				zone = it_index->zone;
				gang_name = it_index->gang_name;
				rank = it_index->rank;
				force = it_index->force;
			}
		}
		buf.write_int64(index);
		buf.write_int8(camp);
		match_time.serialize(buf);
		buf.write_int64(scene_index);
		buf.write_string(zone);
		buf.write_string(gang_name);
		buf.write_int8(rank);
		buf.write_int64(force);

		buf.write_int64(it->matched_pair.second);
		{
			index = 0;
			camp = 0;
			match_time = Time_Value::zero;
			scene_index = 0;
			zone.clear();
			gang_name.clear();
			rank = 0;
			force = 0;
			const Gang_War_Matched_Gang_Info *it_index = find_matched_gang_info(it->matched_pair.second);
			if (it_index) {
				index = it_index->matched_index;
				camp = it_index->camp;
				match_time.set(it_index->match_time);
				scene_index = it_index->scene_index;
				zone = it_index->zone;
				gang_name = it_index->gang_name;
				rank = it_index->rank;
				force = it_index->force;
			}
		}
		buf.write_int64(index);
		buf.write_int8(camp);
		match_time.serialize(buf);
		buf.write_int64(scene_index);
		buf.write_string(zone);
		buf.write_string(gang_name);
		buf.write_int8(rank);
		buf.write_int64(force);

		it->match_time.serialize(buf);
		buf.write_int8(it->result);
		buf.write_int8(it->matched_index);
		buf.write_int64(it->scene_index);
	}
	buf.finish_message();
	sync_to_logic(buf);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:86,代码来源:Scene_Gang_Manager.cpp


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