Пример #1
0
void CNetGame::UpdateNetwork()
{
	Packet* p;
	unsigned char packetId;

	while(p = this->rakServerInterface->Receive())
	{
		packetId = p->data[0];
		
		switch(packetId) 
		{
		case ID_NEW_INCOMING_CONNECTION:
			Packet_NewIncomingConnection(p);
			break;
		case ID_DISCONNECTION_NOTIFICATION:
			Packet_DisconnectionNotification(p);
			break;
		case ID_CONNECTION_LOST:
			Packet_ConnectionLost(p);
			break;
		/*case ID_MODIFIED_PACKET: //unused?
			Packet_ModifiedPacket(p);
			break;*/
		case ID_UNOCCUPIED_SYNC:
			Packet_UnoccupiedSync(p);
			break;
		case ID_TRAILER_SYNC:
			Packet_TrailerSync(p);
			break;
		case ID_PASSENGER_SYNC:
			Packet_PassengerSync(p);
			break;
		case ID_PLAYER_SYNC:
			Packet_PlayerSync(p);
			break;
		case ID_WEAPONS_UPDATE:
			Packet_WeaponsUpdate(p);
			break;
		case ID_SPECTATOR_SYNC:
			Packet_SpectatorSync(p);
			break;
		case ID_AIM_SYNC:
			Packet_AimSync(p);
			break;
		case ID_VEHICLE_SYNC:
			Packet_VehicleSync(p);
			break;
		case ID_RCON_COMMAND:
			Packet_InGameRcon(p);
			break;
		case ID_STATS_UPDATE:
			Packet_StatsUpdate(p);
			break;
		}

		this->rakServerInterface->DeallocatePacket(p);		
	}
}
Пример #2
0
void CRcon::Process(void)
{
	if (!m_pRakServer) return;

	Packet *pPacket;
	while (pPacket = m_pRakServer->Receive())
	{
		switch (pPacket->data[0])
		{
			case ID_NEW_INCOMING_CONNECTION:
				Packet_NewIncomingConnection(pPacket);
				break;
			case ID_DISCONNECTION_NOTIFICATION:
				Packet_DisconnectionNotification(pPacket);
				break;
			case ID_CONNECTION_LOST:
				Packet_ConnectionLost(pPacket);
				break;
		}
		m_pRakServer->DeallocatePacket(pPacket);  
	}
}
Пример #3
0
void CNetGame::UpdateNetwork()
{
	Packet* p;
	unsigned char packetIdentifier;

	while(p=m_pRak->Receive())
	{
		packetIdentifier = GetPacketID(p);
		//printf("Raw Packet ID: %u\n",packetIdentifier);
		
		switch(packetIdentifier) {

		case ID_NEW_INCOMING_CONNECTION:
			Packet_NewIncomingConnection(p);
			break;
		case ID_DISCONNECTION_NOTIFICATION:
			Packet_DisconnectionNotification(p);
			break;
		case ID_CONNECTION_LOST:
			Packet_ConnectionLost(p);
			break;
		case ID_MODIFIED_PACKET:
			Packet_ModifiedPacket(p);
			break;
		/*
		// Not in latest RakNet, so not going to support it.
		case ID_REMOTE_PORT_REFUSED:
			Packet_RemotePortRefused(p);
			break;
		*/
		case ID_PLAYER_SYNC:
			Packet_PlayerSync(p);
			break;
		case ID_VEHICLE_SYNC:
			Packet_VehicleSync(p);
			break;
		case ID_PASSENGER_SYNC:
			Packet_PassengerSync(p);
			break;
		case ID_SPECTATOR_SYNC:
			Packet_SpectatorSync(p);
			break;
		case ID_AIM_SYNC:
			Packet_AimSync(p);
			break;
		case ID_RCON_COMMAND:
			Packet_InGameRcon(p);
			break;
		case ID_STATS_UPDATE:
			Packet_StatsUpdate(p);
			break;
		case ID_WEAPONS_UPDATE:
			Packet_WeaponsUpdate(p);
			break;
		case ID_TRAILER_SYNC:
			Packet_TrailerSync(p);
			break;
		}

		m_pRak->DeallocatePacket(p);		
	}
}