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


C++ writeF1000函数代码示例

本文整理汇总了C++中writeF1000函数的典型用法代码示例。如果您正苦于以下问题:C++ writeF1000函数的具体用法?C++ writeF1000怎么用?C++ writeF1000使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: gob_cmd_update_position

std::string gob_cmd_update_position(
	v3f position,
	v3f velocity,
	v3f acceleration,
	f32 yaw,
	bool do_interpolate,
	bool is_movement_end,
	f32 update_interval
){
	std::ostringstream os(std::ios::binary);
	// command
	writeU8(os, GENERIC_CMD_UPDATE_POSITION);
	// pos
	writeV3F1000(os, position);
	// velocity
	writeV3F1000(os, velocity);
	// acceleration
	writeV3F1000(os, acceleration);
	// yaw
	writeF1000(os, yaw);
	// do_interpolate
	writeU8(os, do_interpolate);
	// is_end_position (for interpolation)
	writeU8(os, is_movement_end);
	// update_interval (for interpolation)
	writeF1000(os, update_interval);
	return os.str();
}
开发者ID:EXio4,项目名称:minetest,代码行数:28,代码来源:genericobject.cpp

示例2: writeU8

void ToolCapabilities::serialize(std::ostream &os, u16 protocol_version) const
{
	if(protocol_version <= 17)
		writeU8(os, 1); // version
	else
		writeU8(os, 2); // version
	writeF1000(os, full_punch_interval);
	writeS16(os, max_drop_level);
	writeU32(os, groupcaps.size());
	for(std::map<std::string, ToolGroupCap>::const_iterator
			i = groupcaps.begin(); i != groupcaps.end(); i++){
		const std::string *name = &i->first;
		const ToolGroupCap *cap = &i->second;
		os<<serializeString(*name);
		writeS16(os, cap->uses);
		writeS16(os, cap->maxlevel);
		writeU32(os, cap->times.size());
		for(std::map<int, float>::const_iterator
				i = cap->times.begin(); i != cap->times.end(); i++){
			writeS16(os, i->first);
			writeF1000(os, i->second);
		}
	}
	if(protocol_version > 17){
		writeU32(os, damageGroups.size());
		for(std::map<std::string, s16>::const_iterator
				i = damageGroups.begin(); i != damageGroups.end(); i++){
			os<<serializeString(i->first);
			writeS16(os, i->second);
		}
	}
}
开发者ID:0gb-us,项目名称:minetest,代码行数:32,代码来源:tool.cpp

示例3: writeU8

void TileAnimationParams::serialize(std::ostream &os, u16 protocol_version) const
{
	if (protocol_version < 29) {
		if (type == TAT_VERTICAL_FRAMES) {
			writeU8(os, type);
			writeU16(os, vertical_frames.aspect_w);
			writeU16(os, vertical_frames.aspect_h);
			writeF1000(os, vertical_frames.length);
		} else {
			writeU8(os, TAT_NONE);
			writeU16(os, 1);
			writeU16(os, 1);
			writeF1000(os, 1.0);
		}
		return;
	}

	writeU8(os, type);
	if (type == TAT_VERTICAL_FRAMES) {
		writeU16(os, vertical_frames.aspect_w);
		writeU16(os, vertical_frames.aspect_h);
		writeF1000(os, vertical_frames.length);
	} else if (type == TAT_SHEET_2D) {
		writeU8(os, sheet_2d.frames_w);
		writeU8(os, sheet_2d.frames_h);
		writeF1000(os, sheet_2d.frame_length);
	}
}
开发者ID:4Evergreen4,项目名称:minetest,代码行数:28,代码来源:tileanimation.cpp

示例4: os

void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
{
	m_last_sent_move_precision = m_base_position.getDistanceFrom(
			m_last_sent_position);
	m_last_sent_position_timer = 0;
	m_last_sent_yaw = m_yaw;
	m_last_sent_position = m_base_position;
	m_last_sent_velocity = m_velocity;
	//m_last_sent_acceleration = m_acceleration;

	float update_interval = m_env->getSendRecommendedInterval();

	std::ostringstream os(std::ios::binary);
	// command (0 = update position)
	writeU8(os, 0);

	// do_interpolate
	writeU8(os, do_interpolate);
	// pos
	writeV3F1000(os, m_base_position);
	// velocity
	writeV3F1000(os, m_velocity);
	// acceleration
	writeV3F1000(os, m_acceleration);
	// yaw
	writeF1000(os, m_yaw);
	// is_end_position (for interpolation)
	writeU8(os, is_movement_end);
	// update_interval (for interpolation)
	writeF1000(os, update_interval);

	// create message and add to list
	ActiveObjectMessage aom(getId(), false, os.str());
	m_messages_out.push_back(aom);
}
开发者ID:basicinside,项目名称:minetest,代码行数:35,代码来源:content_sao.cpp

示例5: serializeSimpleSoundSpec

static void serializeSimpleSoundSpec(const SimpleSoundSpec &ss,
		std::ostream &os, u8 version)
{
	os<<serializeString(ss.name);
	writeF1000(os, ss.gain);
	writeF1000(os, ss.pitch);
}
开发者ID:EXio4,项目名称:minetest,代码行数:7,代码来源:nodedef.cpp

示例6: writeU8

void ObjectProperties::serialize(std::ostream &os) const
{
	writeU8(os, 1); // version
	writeS16(os, hp_max);
	writeU8(os, physical);
	writeF1000(os, weight);
	writeV3F1000(os, collisionbox.MinEdge);
	writeV3F1000(os, collisionbox.MaxEdge);
	os<<serializeString(visual);
	os<<serializeString(meshfile);
	writeV2F1000(os, visual_size);
	writeU16(os, textures.size());
	for(u32 i=0; i<textures.size(); i++){
		os<<serializeString(textures[i]);
	}
	writeU16(os, textures_3d.size());
	for(u32 i=0; i<textures_3d.size(); i++){
		os<<serializeString(textures_3d[i]);
	}
	writeV2S16(os, spritediv);
	writeV2S16(os, initial_sprite_basepos);
	writeU8(os, is_visible);
	writeU8(os, makes_footstep_sound);
	writeF1000(os, automatic_rotate);
}
开发者ID:Jeija,项目名称:BlockPlanet,代码行数:25,代码来源:object_properties.cpp

示例7: writeU8

void ObjectProperties::serialize(std::ostream &os) const
{
	writeU8(os, 1); // version
	writeS16(os, hp_max);
	writeU8(os, physical);
	writeF1000(os, weight);
	writeV3F1000(os, collisionbox.MinEdge);
	writeV3F1000(os, collisionbox.MaxEdge);
	os<<serializeString(visual);
	writeV2F1000(os, visual_size);
	writeU16(os, textures.size());
	for(u32 i=0; i<textures.size(); i++){
		os<<serializeString(textures[i]);
	}
	writeV2S16(os, spritediv);
	writeV2S16(os, initial_sprite_basepos);
	writeU8(os, is_visible);
	writeU8(os, makes_footstep_sound);
	writeF1000(os, automatic_rotate);
	// Added in protocol version 14
	os<<serializeString(mesh);
	writeU16(os, colors.size());
	for(u32 i=0; i<colors.size(); i++){
		writeARGB8(os, colors[i]);
	}
	writeU8(os, collideWithObjects);
	writeF1000(os,stepheight);
	writeU8(os, automatic_face_movement_dir);
	writeF1000(os, automatic_face_movement_dir_offset);
	// Add stuff only at the bottom.
	// Never remove anything, because we don't want new versions of this
}
开发者ID:0151n,项目名称:minetest,代码行数:32,代码来源:object_properties.cpp

示例8: SerializationError

void MapBlock::serializeNetworkSpecific(std::ostream &os)
{
	if (!data) {
		throw SerializationError("ERROR: Not writing dummy block.");
	}

	writeU8(os, 1); // version
	writeF1000(os, 0); // deprecated heat
	writeF1000(os, 0); // deprecated humidity
}
开发者ID:juhdanad,项目名称:minetest,代码行数:10,代码来源:mapblock.cpp

示例9: gob_cmd_update_animation

std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend)
{
	std::ostringstream os(std::ios::binary);
	// command 
	writeU8(os, GENERIC_CMD_SET_ANIMATION);
	// parameters
	writeV2F1000(os, frames);
	writeF1000(os, frame_speed);
	writeF1000(os, frame_blend);
	return os.str();
}
开发者ID:DaErHuo,项目名称:minetest,代码行数:11,代码来源:genericobject.cpp

示例10: gob_cmd_update_animation

std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend, bool frame_loop)
{
	std::ostringstream os(std::ios::binary);
	// command
	writeU8(os, GENERIC_CMD_SET_ANIMATION);
	// parameters
	writeV2F1000(os, frames);
	writeF1000(os, frame_speed);
	writeF1000(os, frame_blend);
	// these are sent inverted so we get true when the server sends nothing
	writeU8(os, !frame_loop);
	return os.str();
}
开发者ID:EXio4,项目名称:minetest,代码行数:13,代码来源:genericobject.cpp

示例11: SerializationError

void MapBlock::serializeNetworkSpecific(std::ostream &os, u16 net_proto_version)
{
	if(data == NULL)
	{
		throw SerializationError("ERROR: Not writing dummy block.");
	}

	if(net_proto_version >= 21){
		int version = 1;
		writeU8(os, version);
		writeF1000(os, heat); // deprecated heat
		writeF1000(os, humidity); // deprecated humidity
	}
}
开发者ID:daniel-santos,项目名称:freeminer,代码行数:14,代码来源:mapblock.cpp

示例12: gob_cmd_update_physics_override

std::string gob_cmd_update_physics_override(float physics_override_speed, float physics_override_jump,
		float physics_override_gravity, bool sneak, bool sneak_glitch)
{
	std::ostringstream os(std::ios::binary);
	// command 
	writeU8(os, GENERIC_CMD_SET_PHYSICS_OVERRIDE);
	// parameters
	writeF1000(os, physics_override_speed);
	writeF1000(os, physics_override_jump);
	writeF1000(os, physics_override_gravity);
	// these are sent inverted so we get true when the server sends nothing
	writeU8(os, !sneak);
	writeU8(os, !sneak_glitch);
	return os.str();
}
开发者ID:DaErHuo,项目名称:minetest,代码行数:15,代码来源:genericobject.cpp

示例13: writeF1000

void CraftDefinitionCooking::serializeBody(std::ostream &os) const
{
	os<<serializeString(output);
	os<<serializeString(recipe);
	writeF1000(os, cooktime);
	replacements.serialize(os);
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:7,代码来源:craftdef.cpp

示例14: writeU8

void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
{
    if(protocol_version <= 17)
        writeU8(os, 1); // version
    else
        writeU8(os, 2); // version
    writeU8(os, type);
    os<<serializeString(name);
    os<<serializeString(description);
    os<<serializeString(inventory_image);
    os<<serializeString(wield_image);
    writeV3F1000(os, wield_scale);
    writeS16(os, stack_max);
    writeU8(os, usable);
    writeU8(os, liquids_pointable);
    std::string tool_capabilities_s = "";
    if(tool_capabilities) {
        std::ostringstream tmp_os(std::ios::binary);
        tool_capabilities->serialize(tmp_os, protocol_version);
        tool_capabilities_s = tmp_os.str();
    }
    os<<serializeString(tool_capabilities_s);
    writeU16(os, groups.size());
    for(std::map<std::string, int>::const_iterator
            i = groups.begin(); i != groups.end(); i++) {
        os<<serializeString(i->first);
        writeS16(os, i->second);
    }
    os<<serializeString(node_placement_prediction);
    if(protocol_version > 17) {
        //serializeSimpleSoundSpec(sound_place, os);
        os<<serializeString(sound_place.name);
        writeF1000(os, sound_place.gain);
    }
}
开发者ID:AngelCry,项目名称:minetest,代码行数:35,代码来源:itemdef.cpp

示例15: os

std::string LuaEntitySAO::getStaticData()
{
/*
	verbosestream<<FUNCTION_NAME<<std::endl;
*/
	std::ostringstream os(std::ios::binary);
	// version
	writeU8(os, 1);
	// name
	os<<serializeString(m_init_name);
	// state
	if(m_registered){
		std::string state = m_env->getScriptIface()->
			luaentity_GetStaticdata(m_id);
		os<<serializeLongString(state);
	} else {
		os<<serializeLongString(m_init_state);
	}
	// hp
	writeS16(os, m_hp);
	// velocity
	writeV3F1000(os, m_velocity);
	// yaw
	writeF1000(os, m_yaw);
	return os.str();
}
开发者ID:alexxvk,项目名称:freeminer,代码行数:26,代码来源:content_sao.cpp


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