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


C++ PacketReader::packet_type方法代码示例

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


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

示例1:

void	ServerNetwork::process_packet(const IPAddress& address, PacketReader& reader) {
	switch (reader.packet_type()) {
	case ACK_PACKET:
		process_ack(address, reader);
		break;

	case WEAPON_DISCHARGED_PACKET:
		m_server.weapon_discharged(address, reader);
		break;

	case PLAYER_HIT_PACKET:
		m_server.player_hit(address, reader);
		break;

	case MESSAGE_PACKET:
		m_server.message(address, reader);
		break;

	case GATE_UPDATE_PACKET:
		m_server.gate_update(address, reader);
		break;

	case JOIN_PACKET:
		m_server.join(address, reader);
		break;

	case INFO_client_PACKET:
		m_server.info(address, reader);
		break;

	case LEAVE_PACKET:
		m_server.leave(address, reader);
		break;

	case PLAYER_ANIMATION_PACKET:
		m_server.player_animation(address, reader);
		break;

	case NAME_CHANGE_PACKET:
		m_server.name_change(address, reader);
		break;

	case TEAM_CHANGE_PACKET:
		m_server.team_change(address, reader);
		break;

	case REGISTER_SERVER_metaserver_PACKET:
		m_server.register_server_packet(address, reader);
		break;

	case MAP_INFO_PACKET:
		m_server.map_info_packet(address, reader);
		break;

	case HOLE_PUNCH_PACKET:
		m_server.hole_punch_packet(address, reader);
		break;

	case PLAYER_DIED_PACKET:
		m_server.player_died(address, reader);
		break;
		
	case PLAYER_JUMPED_PACKET:
		m_server.player_jumped(address, reader);
		break;
		
	case PLAYER_TO_SERVER_UPDATE_PACKET:
		m_server.player_to_server_update(address, reader);
		break;
	}
}
开发者ID:jehawley,项目名称:legesmotus,代码行数:71,代码来源:ServerNetwork.cpp


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