[General] Remove useless PacketSendMyID

This commit is contained in:
Koncord 2017-05-26 02:40:49 +08:00
parent 7a6c12bc2a
commit 24d4e1c222
6 changed files with 2 additions and 63 deletions

View file

@ -244,9 +244,6 @@ void Networking::update(RakNet::Packet *packet)
playerPacketController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid); playerPacketController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
Players::newPlayer(packet->guid); Players::newPlayer(packet->guid);
player = Players::getPlayer(packet->guid); player = Players::getPlayer(packet->guid);
playerPacketController->GetPacket(ID_USER_MYID)->setPlayer(player);
playerPacketController->GetPacket(ID_USER_MYID)->Send(false);
return; return;
} }
else if (playerPacketController->ContainsPacket(packet->data[0])) else if (playerPacketController->ContainsPacket(packet->data[0]))

View file

@ -310,6 +310,8 @@ void Networking::connect(const std::string &ip, unsigned short port, std::vector
} }
else else
preInit(content, collections); preInit(content, collections);
getLocalPlayer()->guid = peer->GetMyGUID();
} }
void Networking::preInit(std::vector<std::string> &content, Files::Collections &collections) void Networking::preInit(std::vector<std::string> &content, Files::Collections &collections)

View file

@ -12,7 +12,6 @@
#include "processors/player/ProcessorGUIMessageBox.hpp" #include "processors/player/ProcessorGUIMessageBox.hpp"
#include "processors/player/ProcessorHandshake.hpp" #include "processors/player/ProcessorHandshake.hpp"
#include "processors/player/ProcessorUserDisconnected.hpp" #include "processors/player/ProcessorUserDisconnected.hpp"
#include "processors/player/ProcessorUserMyID.hpp"
#include "processors/player/ProcessorPlayerBaseInfo.hpp" #include "processors/player/ProcessorPlayerBaseInfo.hpp"
#include "processors/player/ProcessorPlayerCharGen.hpp" #include "processors/player/ProcessorPlayerCharGen.hpp"
#include "processors/player/ProcessorPlayerAnimFlags.hpp" #include "processors/player/ProcessorPlayerAnimFlags.hpp"
@ -75,7 +74,6 @@ void ProcessorInitializer()
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox()); PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
PlayerProcessor::AddProcessor(new ProcessorHandshake()); PlayerProcessor::AddProcessor(new ProcessorHandshake());
PlayerProcessor::AddProcessor(new ProcessorUserDisconnected()); PlayerProcessor::AddProcessor(new ProcessorUserDisconnected());
PlayerProcessor::AddProcessor(new ProcessorUserMyID());
PlayerProcessor::AddProcessor(new ProcessorPlayerBaseInfo()); PlayerProcessor::AddProcessor(new ProcessorPlayerBaseInfo());
PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen()); PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen());
PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags());

View file

@ -1,31 +0,0 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORUSERMYID_HPP
#define OPENMW_PROCESSORUSERMYID_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorUserMyID : public PlayerProcessor
{
public:
ProcessorUserMyID()
{
BPP_INIT(ID_USER_MYID)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_USER_MYID from server");
myGuid = guid;
getLocalPlayer()->guid = guid;
}
};
}
#endif //OPENMW_PROCESSORUSERMYID_HPP

View file

@ -2,7 +2,6 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include "../Packets/Player/PacketSendMyID.hpp"
#include "../Packets/Player/PacketDisconnect.hpp" #include "../Packets/Player/PacketDisconnect.hpp"
#include "../Packets/Player/PacketChatMessage.hpp" #include "../Packets/Player/PacketChatMessage.hpp"
#include "../Packets/Player/PacketPlayerCharGen.hpp" #include "../Packets/Player/PacketPlayerCharGen.hpp"
@ -45,7 +44,6 @@ inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet::
mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer)
{ {
AddPacket<PacketSendMyID>(&packets, peer);
AddPacket<PacketDisconnect>(&packets, peer); AddPacket<PacketDisconnect>(&packets, peer);
AddPacket<PacketChatMessage>(&packets, peer); AddPacket<PacketChatMessage>(&packets, peer);
AddPacket<PacketHandshake>(&packets, peer); AddPacket<PacketHandshake>(&packets, peer);

View file

@ -1,25 +0,0 @@
//
// Created by koncord on 12.01.16.
//
#ifndef OPENMW_PACKETSENDMYID_HPP
#define OPENMW_PACKETSENDMYID_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
#include <components/openmw-mp/NetworkMessages.hpp>
namespace mwmp
{
class PacketSendMyID : public PlayerPacket
{
public:
PacketSendMyID(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_USER_MYID;
orderChannel = CHANNEL_SYSTEM;
}
};
}
#endif //OPENMW_PACKETSENDMYID_HPP