SQCSimulator2023/SQCSim-srv/connection.h
2023-09-27 17:34:25 -04:00

41 lines
943 B
C++

#ifndef CONNECTION_H__
#define CONNECTION_H__
#include <deque>
#include <map>
#include "../SQCSim-common/player.h"
#include "../SQCSim-common/vector3.h"
#include "../SQCSim-common/netprotocol.h"
#include "define.h"
class Connection {
public:
Connection(
SOCKET sock,
sockaddr_in sockaddr,
netprot::LoginInfo log,
netprot::PlayerInfo play);
~Connection();
Player* player = nullptr;
uint64_t GetHash(bool self = true) const;
uint64_t GetTeamHash() const;
std::string GetName() const;
void AddInput(netprot::Input in);
netprot::Output* getOutput(Timestamp time);
netprot::Sync getSync(Timestamp time);
void CleanInputManifest(Timestamp time);
private:
std::map<Timestamp, netprot::Input> m_input_manifest;
std::map<Timestamp, netprot::Output> m_output_manifest;
std::map<Timestamp, netprot::Chat> m_chatlog;
SOCKET m_sock;
sockaddr_in m_addr;
netprot::LoginInfo m_loginfo;
netprot::PlayerInfo m_playinfo;
};
#endif