Try out Cursor
This commit is contained in:
1 parent
d883b58260
commit
f6cc30a30c
4 files changed
+85
-119
No files matched your search
@@ -1,34 +1,25 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "NetworkInterface.h"
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
|
||||
// All state in WebSocketClientBase is only accessed from the main thread:
|
||||
// HandlePollMessage() runs from Poll(), and get*() are called from Game/Space on the main thread.
|
||||
// No mutexes needed.
|
||||
class WebSocketClientBase : public INetworkClient {
|
||||
protected:
|
||||
|
||||
|
||||
std::unordered_map<int, ClientStateInterval> remotePlayers;
|
||||
std::mutex playersMutex;
|
||||
|
||||
// Серверные коробки
|
||||
std::vector<std::pair<Eigen::Vector3f, Eigen::Matrix3f>> serverBoxes_;
|
||||
std::mutex boxesMutex;
|
||||
|
||||
std::vector<ProjectileInfo> pendingProjectiles_;
|
||||
std::mutex projMutex_;
|
||||
|
||||
std::vector<DeathInfo> pendingDeaths_;
|
||||
std::mutex deathsMutex_;
|
||||
|
||||
std::vector<int> pendingRespawns_;
|
||||
std::mutex respawnMutex_;
|
||||
|
||||
std::vector<BoxDestroyedInfo> pendingBoxDestructions_;
|
||||
std::mutex boxDestructionsMutex_;
|
||||
int clientId = -1;
|
||||
int64_t timeOffset = 0;
|
||||
|
||||
@@ -42,12 +33,10 @@ namespace ZL {
|
||||
std::string SignMessage(const std::string& msg);
|
||||
|
||||
std::unordered_map<int, ClientStateInterval> getRemotePlayers() override {
|
||||
std::lock_guard<std::mutex> lock(playersMutex);
|
||||
return remotePlayers;
|
||||
}
|
||||
|
||||
std::vector<std::pair<Eigen::Vector3f, Eigen::Matrix3f>> getServerBoxes() override {
|
||||
std::lock_guard<std::mutex> lock(boxesMutex);
|
||||
return serverBoxes_;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user