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


C++ InPacket::read_string方法代码示例

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


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

示例1: parse_world

	World LoginParser::parse_world(InPacket& recv)
	{
		int8_t wid = recv.read_byte();
		if (wid == -1)
			return{ {}, {}, {}, 0, 0, wid };

		std::string name = recv.read_string();
		uint8_t flag = recv.read_byte();
		std::string message = recv.read_string();

		recv.skip(5);

		std::vector<int32_t> chloads;
		uint8_t channelcount = recv.read_byte();
		for (uint8_t i = 0; i < channelcount; ++i)
		{
			recv.read_string(); // channel name
			chloads.push_back(recv.read_int());
			recv.skip(1);
			recv.skip(2);
		}

		recv.skip(2);

		return{ name, message, chloads, channelcount, flag, wid };
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:26,代码来源:LoginParser.cpp

示例2: parse_questlog

	void SetfieldHandler::parse_questlog(InPacket& recv, Questlog& quests) const
	{
		int16_t size = recv.read_short();
		for (int16_t i = 0; i < size; i++)
		{
			int16_t qid = recv.read_short();
			std::string qdata = recv.read_string();
			if (quests.is_started(qid))
			{
				int16_t qidl = quests.get_last_started();
				quests.add_in_progress(qidl, qid, qdata);
				i--;
			}
			else
			{
				quests.add_started(qid, qdata);
			}
		}

		std::map<int16_t, int64_t> completed;
		size = recv.read_short();
		for (int16_t i = 0; i < size; i++)
		{
			int16_t qid = recv.read_short();
			int64_t time = recv.read_long();
			quests.add_completed(qid, time);
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:28,代码来源:SetfieldHandlers.cpp

示例3: parseareainfo

	void SetfieldHandler::parseareainfo(InPacket& recv) const
	{
		std::map<int16_t, std::string> areainfo;
		int16_t arsize = recv.read_short();
		for (int16_t i = 0; i < arsize; i++)
		{
			int16_t area = recv.read_short();
			areainfo[area] = recv.read_string();
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:10,代码来源:SetfieldHandlers.cpp

示例4: handle

	void SkillMacrosHandler::handle(InPacket& recv) const
	{
		uint8_t size = recv.read_byte();
		for (uint8_t i = 0; i < size; i++)
		{
			recv.read_string(); // name
			recv.read_byte(); // 'shout' byte
			recv.read_int(); // skill 1
			recv.read_int(); // skill 2
			recv.read_int(); // skill 3
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:12,代码来源:PlayerHandlers.cpp

示例5: handle

	void CharnameResponseHandler::handle(InPacket& recv) const
	{
		// Read the name and if it is already in use.
		std::string name = recv.read_string();
		bool used = recv.read_bool();

		if (used)
		{
			UI::get().emplace<UILoginNotice>(UILoginNotice::NAME_IN_USE);
		}

		// Notify the character creation screen.
		if (auto charcreation = UI::get().get_element<UICharcreation>())
			charcreation->send_naming_result(used);

		UI::get().enable();
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:17,代码来源:LoginHandlers.cpp

示例6: set_field

	void SetfieldHandler::set_field(InPacket& recv) const
	{
		recv.skip(23);

		int32_t cid = recv.read_int();

		const CharEntry& playerentry = Session::get().getlogin().getcharbyid(cid);
		if (playerentry.cid != cid)
		{
			Console::get().print("Nonexisting cid: " + std::to_string(cid));
		}

		Stage::get().loadplayer(playerentry);

		Session::get().getlogin().parsestats(recv);

		Player& player = Stage::get().getplayer();

		recv.read_byte(); // 'buddycap'
		if (recv.read_bool())
		{
			recv.read_string(); // 'linkedname'
		}

		parse_inventory(recv, player.getinvent());
		parse_skillbook(recv, player.getskills());
		parse_questlog(recv, player.getquests());
		parseminigame(recv);
		parsering1(recv);
		parsering2(recv);
		parsering3(recv);
		parsetelerock(recv, player.gettrock());
		parsemonsterbook(recv, player.getmonsterbook());
		parsenewyear(recv);
		parseareainfo(recv);

		recv.skip(10);

		player.recalcstats(true);

		stagetransition(player.getstats().getportal(), player.getstats().getmapid());

		Sound(Sound::GAMESTART).play();

		UI::get().changestate(UI::GAME);
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:46,代码来源:SetfieldHandlers.cpp

示例7: parse_account

	Account LoginParser::parse_account(InPacket & recv)
	{
		Account account;

		recv.skip(2);
		account.accid = recv.read_int();
		account.female = recv.read_bool();
		recv.read_bool(); //is admin
		account.gmlevel = recv.read_byte();
		recv.skip(1);
		account.name = recv.read_string();
		recv.skip(1);
		account.muted = recv.read_bool();
		recv.read_long(); //muted until
		recv.read_long(); //creation date
		recv.skip(4);
		account.pin = recv.read_short();

		return account;
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:20,代码来源:LoginParser.cpp

示例8: handle

	void CharnameResponseHandler::handle(InPacket& recv) const
	{
		// Read the name and if it is already in use.
		std::string name = recv.read_string();
		bool used = recv.read_bool();

		if (used)
		{
			UI::get().add(
				ElementTag<UILoginNotice, UILoginNotice::Message>(
					UILoginNotice::NAME_IN_USE
					)
			);
		}

		// Notify character creation screen.
		UI::get().with_element<UICharcreation>([&used](auto& cc) {
			cc.nameresult(used);
		});

		UI::get().enable();
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:22,代码来源:LoginHandlers.cpp


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