mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
attempt to fix ghost player issue
This commit is contained in:
committed by
Anonymous275
parent
13f8be5d39
commit
e04a569e33
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
void SetIsSynced(bool NewIsSynced) { mIsSynced = NewIsSynced; }
|
||||
void SetIsConnected(bool NewIsConnected) { mIsConnected = NewIsConnected; }
|
||||
TServer& Server() const;
|
||||
void UpdatePingTime();
|
||||
int SecondsSinceLastPing();
|
||||
|
||||
private:
|
||||
TServer& mServer;
|
||||
@@ -59,4 +62,5 @@ private:
|
||||
std::string mDID;
|
||||
int mStatus = 0;
|
||||
int mID = -1;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> mLastPingTime;
|
||||
};
|
||||
|
||||
@@ -12,9 +12,13 @@ public:
|
||||
void SetInternalPPS(int NewPPS) { mInternalPPS = NewPPS; }
|
||||
void IncrementInternalPPS() { ++mInternalPPS; }
|
||||
[[nodiscard]] int InternalPPS() const { return mInternalPPS; }
|
||||
void SetTCPServer(TTCPServer& Server) { mTCPServer = std::ref(Server); }
|
||||
|
||||
private:
|
||||
TTCPServer& TCPServer() { return mTCPServer->get(); }
|
||||
|
||||
TServer& mServer;
|
||||
std::optional<std::reference_wrapper<TTCPServer>> mTCPServer { std::nullopt };
|
||||
bool mShutdown { false };
|
||||
int mInternalPPS { 0 };
|
||||
};
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
bool CheckBytes(TClient& c, int32_t BytesRcv);
|
||||
void SyncResources(TClient& c);
|
||||
|
||||
void UpdatePlayers();
|
||||
void UpdatePlayer(TClient& Client);
|
||||
|
||||
private:
|
||||
std::optional<std::reference_wrapper<TUDPServer>> mUDPServer { std::nullopt };
|
||||
|
||||
Reference in New Issue
Block a user