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


C++ SerializeBuffer::read方法代码示例

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


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

示例1: deserialize

void GameScreen::deserialize(GameState *gs, SerializeBuffer &serializer) {
    serializer.read_int(index);
    // hud details not serialized as they are ephermal user interface state
    serializer.read(focus_player_id);
    current_level = read_gamemap(gs, serializer);
    serializer.read(last_player_pos);
}
开发者ID:ludamad,项目名称:lanarts,代码行数:7,代码来源:GameScreen.cpp

示例2: deserialize

void ItemInst::deserialize(GameState* gs, SerializeBuffer& serializer) {
	GameInst::deserialize(gs, serializer);
	item.deserialize(serializer);
	serializer.read(quantity);
	serializer.read(dropped_by);
	serializer.read(pickup_by_dropper);
}
开发者ID:Zolomon,项目名称:lanarts,代码行数:7,代码来源:ItemInst.cpp

示例3: net_recv_game_init_data

void net_recv_game_init_data(SerializeBuffer& sb, int sender,
        GameStateInitData& init_data, PlayerData& pd) {
    //Write seed
    sb.read(init_data);
    init_data.received_init_data = true;

    //Read player data
    int localidx;
    sb.read_int(localidx);
    int playern;
    sb.read_int(playern);
    LANARTS_ASSERT(pd.all_players().empty());
    for (int i = 0; i < playern; i++) {
        std::string name;
        std::string classtype;
        int net_id;
        sb.read(name);
        sb.read(classtype);
        sb.read_int(net_id);
        pd.register_player(name, NULL, classtype, LuaValue(), (i == localidx), net_id);
    }

    printf(
            "Received init packet: seed = 0x%X, localid = %d, nplayers = %d, "
                    "frame_action_repeat = %d, regen_level_on_death = %d, network_debug_mode = %d, time_per_step = %f\n",
            init_data.seed, localidx, playern, init_data.frame_action_repeat,
            (int) init_data.regen_on_death,
            (int) init_data.network_debug_mode, init_data.time_per_step);
}
开发者ID:ludamad,项目名称:lanarts,代码行数:29,代码来源:GameNetConnection.cpp

示例4: deserialize

void StoreInst::deserialize(GameState* gs, SerializeBuffer& serializer) {
	GameInst::deserialize(gs, serializer);
	sidebar_display.init(this, gs->game_hud().sidebar_content_area());
	inv.deserialize(serializer);
	serializer.read(last_seen_spr);
	serializer.read(spriteid);
}
开发者ID:Zolomon,项目名称:lanarts,代码行数:7,代码来源:StoreInst.cpp

示例5: net_recv_connection_affirm

// Only the server is concerned with this message
void net_recv_connection_affirm(SerializeBuffer& sb, int sender,
        PlayerData& pd) {
    printf("Recv conn with size=%d\n", sb.size());
    std::string name;
    std::string classtype;
    sb.read(name);
    sb.read(classtype);
    printf("connection affirm read\n");
    pd.register_player(name, NULL, classtype, LuaValue(), /* is local player */ false, sender);
    printf("now there are %d players\n", (int) pd.all_players().size());
}
开发者ID:ludamad,项目名称:lanarts,代码行数:12,代码来源:GameNetConnection.cpp

示例6: net_recv_game_init_data

void net_recv_game_init_data(SerializeBuffer& sb, int sender,
		GameStateInitData& init_data, PlayerData& pd) {
	//Write seed
	sb.read_int(init_data.seed);
	init_data.seed_set_by_network_message = true;

	//Read player data
	int localidx;
	sb.read_int(localidx);
	pd.set_local_player_idx(localidx);
	int playern;
	sb.read_int(playern);
	LANARTS_ASSERT(pd.all_players().empty());
	for (int i = 0; i < playern; i++) {
		std::string name;
		class_id classtype;
		int net_id;
		sb.read(name);
		sb.read_int(classtype);
		sb.read_int(net_id);
		pd.register_player(name, NULL, classtype, net_id);
	}
	printf("Received init packet: seed = 0x%X, localid = %d, nplayers = %d\n",
			init_data.seed, localidx, playern);
}
开发者ID:Zolomon,项目名称:lanarts,代码行数:25,代码来源:GameNetConnection.cpp

示例7: net_recv_connection_affirm

// Only the server is concerned with this message
void net_recv_connection_affirm(SerializeBuffer& sb, int sender,
		PlayerData& pd) {
	std::string name;
	class_id classtype;
	sb.read(name);
	sb.read_int(classtype);
	printf("connection affirm read\n");
	pd.register_player(name, NULL, classtype, sender);
	printf("now there are %d players\n", (int)pd.all_players().size());
	pd.set_local_player_idx(0);
}
开发者ID:Zolomon,项目名称:lanarts,代码行数:12,代码来源:GameNetConnection.cpp

示例8: write_or_assert_hash

static void write_or_assert_hash(SerializeBuffer& sb, unsigned int hash,
        bool is_writing) {
    if (is_writing) {
        sb.write_int(hash);
    } else {
        unsigned int val;
        sb.read(val);
        if (val != hash) {
            printf("Values 0x%X and 0x%X do not match!\n", val, hash);
            LANARTS_ASSERT(false);
        }
    }
}
开发者ID:ludamad,项目名称:lanarts,代码行数:13,代码来源:GameNetConnection.cpp

示例9: deserialize

void ChatMessage::deserialize(SerializeBuffer& serializer) {
	serializer.read(sender);
	serializer.read(message);
	serializer.read(sender_colour);
	serializer.read(message_colour);
}
开发者ID:gigimoi,项目名称:lanarts,代码行数:6,代码来源:GameChat.cpp

示例10: deserialize

void AnimatedInst::deserialize(GameState* gs, SerializeBuffer& serializer) {
	GameInst::deserialize(gs, serializer);
	DESERIALIZE_POD_REGION(serializer, this, textcol, animatetime);
	serializer.read(text);
}
开发者ID:Zolomon,项目名称:lanarts,代码行数:5,代码来源:AnimatedInst.cpp

示例11: deserialize

void MonsterController::deserialize(SerializeBuffer& serializer) {
	serializer.read_container(mids);
	serializer.read(monsters_wandering_flag);
}
开发者ID:yi-juchung,项目名称:lanarts,代码行数:4,代码来源:MonsterController.cpp


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