mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 14:56:04 +00:00
rework GetClient to use new ForEachClient, return shared_ptr
this simplifies a lot of functions, and removes a lot of potential errors when using the function. You now only check whether the return value is null, and if it's not, you have a valid, reference-counted, client pointer.
This commit is contained in:
@@ -129,4 +129,5 @@ private:
|
||||
std::chrono::time_point<TimeType> mLastPingTime;
|
||||
};
|
||||
|
||||
std::optional<std::weak_ptr<TClient>> GetClient(class TServer& Server, int ID);
|
||||
// Returns a valid client, or nullptr if no such client exists
|
||||
std::shared_ptr<TClient> GetClient(class TServer& Server, int ID);
|
||||
|
||||
Reference in New Issue
Block a user