123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #ifndef __SYS_LOCALUSER_H__
- #define __SYS_LOCALUSER_H__
- #include "sys_profile.h"
- struct achievementDescription_t;
- class idPlayerProfile;
- class idProfileMgr;
- enum onlineCaps_t {
- CAP_IS_ONLINE = BIT( 0 ),
- CAP_BLOCKED_PERMISSION = BIT( 1 ),
- CAP_CAN_PLAY_ONLINE = BIT( 2 ),
- };
- class idSerializer;
- struct localUserHandle_t {
- public:
- typedef uint32 userHandleType_t;
- localUserHandle_t() : handle( 0 ) {}
- explicit localUserHandle_t( userHandleType_t handle_ ) : handle( handle_ ) {}
- bool operator == ( const localUserHandle_t & other ) const {
- return handle == other.handle;
- }
- bool operator < ( const localUserHandle_t & other ) const {
- return handle < other.handle;
- }
- bool IsValid() const { return handle > 0; }
- void WriteToMsg( idBitMsg & msg ) {
- msg.WriteLong( handle );
- }
- void ReadFromMsg( const idBitMsg & msg ) {
- handle = msg.ReadLong();
- }
- void Serialize( idSerializer & ser );
- private:
- userHandleType_t handle;
- };
- class idLocalUser {
- public:
- idLocalUser();
- virtual ~idLocalUser() {}
- void Pump();
- virtual void PumpPlatform() = 0;
- virtual bool IsPersistent() const { return IsProfileReady(); }
- virtual bool IsProfileReady() const = 0;
- virtual bool IsOnline() const = 0;
- virtual uint32 GetOnlineCaps() const = 0;
- virtual bool HasOwnerChanged() const { return false; }
- virtual int GetInputDevice() const = 0;
- virtual const char * GetGamerTag() const = 0;
- virtual bool IsInParty() const = 0;
- virtual int GetPartyCount() const = 0;
-
- virtual bool IsStorageDeviceAvailable() const;
- virtual void ResetStorageDevice();
- virtual bool StorageSizeAvailable( uint64 minSizeInBytes, int64 & neededBytes );
-
- virtual void SetStatInt( int stat, int value );
- virtual void SetStatFloat( int stat, float value );
- virtual int GetStatInt( int stat );
- virtual float GetStatFloat( int stat);
- virtual idPlayerProfile * GetProfile() { return GetProfileMgr().GetProfile(); }
- const idPlayerProfile * GetProfile() const { return const_cast< idLocalUser * >( this )->GetProfile(); }
- idProfileMgr & GetProfileMgr() { return profileMgr; }
-
- void SetJoiningLobby( int lobbyType, bool value ) { joiningLobby[lobbyType] = value; }
- bool IsJoiningLobby( int lobbyType ) const { return joiningLobby[lobbyType]; }
- bool CanPlayOnline() const { return ( GetOnlineCaps() & CAP_CAN_PLAY_ONLINE ) > 0; }
- localUserHandle_t GetLocalUserHandle() const { return localUserHandle; }
- void SetLocalUserHandle( localUserHandle_t newHandle ) { localUserHandle = newHandle; }
-
- void LoadProfileSettings();
- void SaveProfileSettings();
-
- void RequestSyncAchievements() { syncAchievementsRequested = true; }
- private:
- bool joiningLobby[2];
- localUserHandle_t localUserHandle;
- idProfileMgr profileMgr;
- bool syncAchievementsRequested;
- };
- #endif // __SYS_LOCALUSER_H__
|