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


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

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


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

示例1: serialize

void Prop_Setter::serialize(Block_Buffer & w) const {
	w.write_int32(prop_type);
	w.write_int32(addi_type);
	w.write_uint8(operate);
	w.write_double(basic);
	w.write_double(fixed);
	w.write_double(percent);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:8,代码来源:Fighter_Detail.cpp

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

示例3: serialize

// for db save --
void Expedition_Scene_Demage_Rank_Data::serialize(Block_Buffer &w) const {
	w.write_string(role_name);
	w.write_int64(role_id);
	w.write_int64(gang_id);
	w.write_string(gang_name);
	w.write_int64(uuid);
	w.write_string(server_name);
	w.write_int32(force);
	w.write_int32(level);
	w.write_double(demage);
}
开发者ID:tidaybreak,项目名称:game-server,代码行数:12,代码来源:Expedition_Scene_Struct.cpp

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


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