SQCSimulator2023/SQCSim-srv/connection.h

42 lines
799 B
C
Raw Normal View History

2023-09-24 08:45:40 -04:00
#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