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


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

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


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

示例1: serialize

int Expedition_Occupy_Castle_Data::serialize(Block_Buffer &w) const {
	w.write_int64(role_id);
	w.write_int64(gang_id);
	w.write_int64(server_uuid);
	w.write_string(role_name);
	w.write_string(gang_name);
	w.write_string(server_name);
	w.write_int32(level);
	w.write_int32(force);
	w.write_int16(nums);
	w.write_int16(get_nums);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:13,代码来源:Expedition_Scene_Struct.cpp

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

示例3: build_buffer_arg

void Msg_Struct::build_buffer_arg(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate, v8::Local<v8::Value> value) {
    if(field_info.field_type == "int8") {
        int8_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int8(val);
    }
    else if(field_info.field_type == "int16") {
        int16_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int16(val);
    }
    else if(field_info.field_type == "int32") {
        int32_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int32(val);
    }
    else if(field_info.field_type == "int64") {
        int64_t val = 0;
        if (value->IsNumber()) {
            val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int64(val);
    }
    else if(field_info.field_type == "double") {
        double val = 0;
        if (value->IsNumber()) {
            val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_double(val);
    }
    else if(field_info.field_type == "bool") {
        bool val = 0;
        if (value->IsBoolean()) {
            val = value->BooleanValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_bool(val);
    }
    else if(field_info.field_type == "string") {
        std::string val = "";
        if (value->IsString()) {
            String::Utf8Value str(value->ToString(isolate->GetCurrentContext()).ToLocalChecked());
            std::stringstream stream;
            stream << ToCString(str);
            val = stream.str();
        }
        buffer.write_string(val);
    }
    else {
        LOG_ERROR("Can not find the field_type:%s, struct_name:%s", field_info.field_type.c_str(), struct_name().c_str());
    }
}
开发者ID:jice1001,项目名称:server,代码行数:57,代码来源:Msg_Struct.cpp

示例4: sync_info_logic

int Map_Team::sync_info_logic(void) {
	MSG_20100304 inner_msg;
	Block_Buffer buf;
	Time_Value now;
	now = Time_Value::gettimeofday();
	buf.make_message(inner_msg.msg_id);
	buf.write_int64(team_id_);
	buf.write_int16(fail_times_);
	buf.write_int16(match_fail_);
	now.serialize(buf);
	buf.finish_message();
	this->info_all_online_player(inner_msg.msg_id, &buf);
	return 0;
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:14,代码来源:Map_Team.cpp


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