From b5c586d5b78d73d5147555b9b5b72de516e9f6f0 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 10 Jan 2017 18:33:02 +0800 Subject: [PATCH] Add and implement ID_MASTER_QUERY --- apps/openmw-mp/Networking.cpp | 13 +++++++++++++ components/openmw-mp/NetworkMessages.hpp | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index f3f794410..a485d01be 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -865,6 +865,19 @@ int Networking::mainLoop() case ID_CONNECTED_PING: case ID_UNCONNECTED_PING: break; + case ID_MASTER_QUERY: + { + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Query request from %s", + packet->systemAddress.ToString()); + RakNet::BitStream bs; + bs.Write((unsigned char) ID_MASTER_QUERY); + bs.Write(Players::getPlayers()->size()); + for(auto player : *Players::getPlayers()) + bs.Write(RakNet::RakString(player.second->Npc()->mName.c_str())); + bs.Write(0); // plugins + peer->Send(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false); + break; + } default: update(packet); break; diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 8a200cd9c..6f3943def 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -9,7 +9,8 @@ enum GameMessages { - ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1, + ID_MASTER_QUERY = ID_USER_PACKET_ENUM+1, + ID_GAME_BASE_INFO, ID_GAME_CHARGEN, ID_GAME_POS, ID_GAME_DYNAMICSTATS,