Début sockets.
This commit is contained in:
42
SQCSim-srv/connection.h
Normal file
42
SQCSim-srv/connection.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef _CONNECTION_H__
|
||||
#define _CONNECTION_H__
|
||||
#include <deque>
|
||||
#include <chrono>
|
||||
#include "../SQCSim-common/player.h"
|
||||
#include "../SQCSim-common/vector3.h"
|
||||
#include "define.h"
|
||||
|
||||
struct Input {
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
UINT8 keys; // 0bFBLRJS__
|
||||
Vector3f direction;
|
||||
};
|
||||
|
||||
class Connection {
|
||||
public:
|
||||
Connection(
|
||||
in_addr addr,
|
||||
std::string name,
|
||||
UINT64 hash,
|
||||
UINT64 self_hash,
|
||||
UINT64 team_hash);
|
||||
~Connection();
|
||||
|
||||
Player* player = nullptr;
|
||||
|
||||
in_addr GetAddr() const;
|
||||
UINT64 GetHash(bool self = true) const;
|
||||
UINT64 GetTeamHash() const;
|
||||
std::string GetName() const;
|
||||
|
||||
void Clean(std::chrono::system_clock::time_point time);
|
||||
private:
|
||||
std::deque<Input> m_input_manifest;
|
||||
in_addr m_addr;
|
||||
UINT64 m_hash,
|
||||
m_shash,
|
||||
m_thash;
|
||||
std::string m_name;
|
||||
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user