mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
* Improve the DirectConnectScreen, among other things.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include "NetEventCallback.hpp"
|
||||
#include "Minecraft.hpp"
|
||||
#include "RakNetInstance.hpp"
|
||||
@@ -15,6 +16,21 @@
|
||||
|
||||
class Minecraft;
|
||||
|
||||
struct OnlinePlayer
|
||||
{
|
||||
Player* m_pPlayer; // The player avatar this online player controls
|
||||
|
||||
OnlinePlayer(Player* p) : m_pPlayer(p) {}
|
||||
};
|
||||
|
||||
struct RakNetGUIDHasher
|
||||
{
|
||||
size_t operator()(const RakNet::RakNetGUID& guid) const
|
||||
{
|
||||
return size_t(guid.g);
|
||||
}
|
||||
};
|
||||
|
||||
class ServerSideNetworkHandler : public NetEventCallback, public LevelListener
|
||||
{
|
||||
public:
|
||||
@@ -39,13 +55,18 @@ public:
|
||||
|
||||
void allowIncomingConnections(bool b);
|
||||
void displayGameMessage(const std::string&);
|
||||
void sendMessage(const RakNet::RakNetGUID& guid, const std::string&);
|
||||
void redistributePacket(Packet* packet, const RakNet::RakNetGUID& source);
|
||||
|
||||
OnlinePlayer* getPlayerByGUID(const RakNet::RakNetGUID& guid);
|
||||
|
||||
public:
|
||||
Minecraft* m_pMinecraft = nullptr;
|
||||
Level* m_pLevel = nullptr;
|
||||
RakNetInstance* m_pRakNetInstance = nullptr;
|
||||
RakNet::RakPeerInterface* m_pRakNetPeer = nullptr;
|
||||
bool m_bAllowIncoming = false;
|
||||
bool m_bAllowIncoming = false;
|
||||
|
||||
std::unordered_map<RakNet::RakNetGUID, OnlinePlayer*, RakNetGUIDHasher> m_onlinePlayers;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user