diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 05d2035c4..0981914c9 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -58,7 +58,7 @@ void Networking::Update(RakNet::Packet *packet) return; } - RakNet::BitStream bsIn(&packet->data[2], packet->length, false); + RakNet::BitStream bsIn(&packet->data[1], packet->length, false); { RakNet::RakNetGUID ignoredGUID; @@ -68,9 +68,9 @@ void Networking::Update(RakNet::Packet *packet) controller->SetStream(&bsIn, 0); - BasePacket *myPacket = controller->GetPacket(packet->data[1]); + BasePacket *myPacket = controller->GetPacket(packet->data[0]); - if(packet->data[1] == ID_HANDSHAKE) + if(packet->data[0] == ID_HANDSHAKE) { DEBUG_PRINTF("ID_HANDSHAKE\n"); string passw = "SuperPassword"; @@ -114,7 +114,7 @@ void Networking::Update(RakNet::Packet *packet) return; } - switch(packet->data[1]) + switch(packet->data[0]) { case ID_GAME_BASE_INFO: { @@ -283,7 +283,7 @@ void Networking::Update(RakNet::Packet *packet) } default: - printf("Message with identifier %i has arrived.\n", packet->data[1]); + printf("Message with identifier %i has arrived.\n", packet->data[0]); break; } } @@ -385,11 +385,8 @@ int Networking::MainLoop() printf("A client lost the connection.\n"); DisconnectPlayer(packet->guid); break; - case ID_CUSTOM_MESSAGE: - Update(packet); - break; default: - printf("Message with identifier %i has arrived.\n", packet->data[0]); + Update(packet); break; } } diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 346c9bd2f..3c8149e1c 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -75,11 +75,9 @@ void Networking::Update() printf("Connection lost.\n"); MWBase::Environment::get().getStateManager()->requestQuit(); break; - case ID_CUSTOM_MESSAGE: - ReciveMessage(packet); - break; default: - printf("Message with identifier %i has arrived.\n", packet->data[0]); + ReciveMessage(packet); + //printf("Message with identifier %i has arrived.\n", packet->data[0]); break; } } @@ -166,7 +164,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet) if(packet->length < 3) return; - RakNet::BitStream bsIn(&packet->data[2], packet->length, false); + RakNet::BitStream bsIn(&packet->data[1], packet->length, false); bsIn.Read(id); DedicatedPlayer *pl = 0; @@ -174,9 +172,9 @@ void Networking::ReciveMessage(RakNet::Packet *packet) if(id != myid) pl = Players::GetPlayer(id); - BasePacket *myPacket = controller.GetPacket(packet->data[1]); + BasePacket *myPacket = controller.GetPacket(packet->data[0]); - switch(packet->data[1]) + switch(packet->data[0]) { case ID_HANDSHAKE: { @@ -552,7 +550,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet) break; } default: - printf("Custom message with identifier %i has arrived in initialization.\n", packet->data[1]); + printf("Custom message with identifier %i has arrived in initialization.\n", packet->data[0]); } } diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 2b3ed3399..14b23ea8c 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -9,12 +9,7 @@ enum GameMessages { - ID_CUSTOM_MESSAGE = ID_USER_PACKET_ENUM+1 -}; - -enum MyGameMesages -{ - ID_GAME_BASE_INFO = 0, + ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1, ID_GAME_CHARGEN, ID_GAME_UPDATE_POS, ID_GAME_UPDATE_BASESTATS, diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/BasePacket.cpp index 6becccd06..b32680650 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/BasePacket.cpp @@ -16,7 +16,6 @@ void BasePacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) if(send) { - bs->Write((RakNet::MessageID) ID_CUSTOM_MESSAGE); bs->Write((RakNet::MessageID) packetID); bs->Write(player->guid); } @@ -67,7 +66,6 @@ void BasePacket::SetSendStream(RakNet::BitStream *bitStream) void BasePacket::RequestData(RakNet::RakNetGUID player) { bsSend->ResetWritePointer(); - bsSend->Write((RakNet::MessageID) ID_CUSTOM_MESSAGE); bsSend->Write((RakNet::MessageID) packetID); bsSend->Write(player); peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, player, false);