the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 65 lines 2.6 kB view raw
1#pragma once 2#include "DQRNetworkManager.h" 3#include <queue> 4 5// This is the lowest level class for handling the concept of a player on Durango. This is managed by DQRNetworkManager. The game shouldn't directly communicate 6// with this class, as it is wrapped by NetworkPlayerDurango which is an implementation of a platform-independent interface INetworkPlayer. 7 8class DQRNetworkPlayer 9{ 10public: 11 friend class DQRNetworkManager; 12 13 typedef enum 14 { 15 DNP_TYPE_HOST, // This player represents the host 16 DNP_TYPE_LOCAL, // On host - this player is a local player that needs communicated with specially not using rudp. On clients - this is a local player, where network communications can be used to communicate with the host 17 DNP_TYPE_REMOTE, // On host - this player can be used to communicate from between the host and this player. On clients - this is a remote player that cannot be communicated with 18 } eDQRNetworkPlayerType; 19 20 DQRNetworkPlayer(); 21 DQRNetworkPlayer(DQRNetworkManager *manager, eDQRNetworkPlayerType playerType, bool onHost, int localPlayerIdx, unsigned int sessionAddress); 22 ~DQRNetworkPlayer(); 23 24 PlayerUID GetUID(); 25 void SetUID(PlayerUID UID); 26 int GetLocalPlayerIndex(); 27 uintptr_t GetCustomDataValue(); 28 void SetCustomDataValue(uintptr_t data); 29 bool IsRemote(); 30 bool IsHost(); 31 bool IsLocal(); 32 bool IsSameSystem(DQRNetworkPlayer *other); 33 bool HasVoice(); 34 bool IsTalking(); 35 bool HasCamera(); 36 LPCWSTR GetGamertag(); 37 int GetSmallId(); 38 void SetSmallId(unsigned char smallId); 39 int GetSessionIndex(); 40 void SendData( DQRNetworkPlayer *pPlayerTarget, const void *data, unsigned int dataSize ); 41 42 int GetSendQueueSizeBytes(); 43 int GetSendQueueSizeMessages(); 44 45 wchar_t *GetName(); 46 void SetName(const wchar_t *name); 47 48 std::wstring GetDisplayName(); 49 void SetDisplayName(std::wstring displayName); 50private: 51 void SendInternal(const void *data, unsigned int dataSize); 52 53 eDQRNetworkPlayerType m_type; // The player type 54 bool m_host; // Whether this actual player class is stored on a host (not whether it represents the host, or a player on the host machine) 55 int m_localPlayerIdx; // Index of this player on the machine to which it belongs 56 DQRNetworkManager *m_manager; // Pointer back to the manager that is managing this player 57 58 PlayerUID m_UID; 59 uintptr_t m_customData; 60 unsigned char m_smallId; 61 unsigned int m_sessionAddress; 62 63 wchar_t m_name[21]; 64 std::wstring m_displayName; 65};