2023-09-24 11:07:03 -04:00
|
|
|
#ifndef CONNECTION_H__
|
|
|
|
#define CONNECTION_H__
|
2023-09-30 14:54:39 -04:00
|
|
|
|
2023-09-24 08:45:40 -04:00
|
|
|
#include <deque>
|
2023-09-24 11:07:03 -04:00
|
|
|
#include <map>
|
2023-09-24 08:45:40 -04:00
|
|
|
#include "../SQCSim-common/player.h"
|
|
|
|
#include "../SQCSim-common/vector3.h"
|
2023-09-25 16:30:03 -04:00
|
|
|
#include "../SQCSim-common/netprotocol.h"
|
2023-09-24 08:45:40 -04:00
|
|
|
#include "define.h"
|
|
|
|
|
|
|
|
class Connection {
|
|
|
|
public:
|
|
|
|
Connection(
|
2023-09-27 17:34:25 -04:00
|
|
|
SOCKET sock,
|
|
|
|
sockaddr_in sockaddr,
|
|
|
|
netprot::LoginInfo log,
|
|
|
|
netprot::PlayerInfo play);
|
2023-09-24 08:45:40 -04:00
|
|
|
~Connection();
|
|
|
|
|
|
|
|
Player* player = nullptr;
|
|
|
|
|
2023-09-25 08:23:52 -04:00
|
|
|
uint64_t GetHash(bool self = true) const;
|
|
|
|
uint64_t GetTeamHash() const;
|
2023-09-24 08:45:40 -04:00
|
|
|
std::string GetName() const;
|
|
|
|
|
2023-09-25 16:30:03 -04:00
|
|
|
void AddInput(netprot::Input in);
|
|
|
|
netprot::Output* getOutput(Timestamp time);
|
|
|
|
netprot::Sync getSync(Timestamp time);
|
2023-09-24 11:07:03 -04:00
|
|
|
|
|
|
|
void CleanInputManifest(Timestamp time);
|
2023-09-24 08:45:40 -04:00
|
|
|
private:
|
2023-09-25 16:30:03 -04:00
|
|
|
std::map<Timestamp, netprot::Input> m_input_manifest;
|
|
|
|
std::map<Timestamp, netprot::Output> m_output_manifest;
|
2023-09-27 17:34:25 -04:00
|
|
|
std::map<Timestamp, netprot::Chat> m_chatlog;
|
|
|
|
|
|
|
|
SOCKET m_sock;
|
|
|
|
sockaddr_in m_addr;
|
|
|
|
netprot::LoginInfo m_loginfo;
|
|
|
|
netprot::PlayerInfo m_playinfo;
|
2023-09-24 08:45:40 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|