SQCSimulator2023/SQCSim-srv/connection.h

48 lines
967 B
C
Raw Normal View History

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"
2023-10-25 12:16:14 -04:00
using namespace netprot;
2023-09-24 08:45:40 -04:00
class Connection {
public:
Connection(
SOCKET sock,
sockaddr_in sockaddr,
2023-10-25 12:16:14 -04:00
LoginInfo log,
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-10-25 12:16:14 -04:00
void AddInput(Input in);
Output* getOutput(Timestamp time);
Sync getSync(Timestamp time);
SOCKET getSock() const;
PlayerInfo* getInfo() const;
2023-10-26 17:57:42 -04:00
sockaddr_in* getAddr() const;
2023-09-24 11:07:03 -04:00
void CleanInputManifest(Timestamp time);
2023-09-24 08:45:40 -04:00
private:
2023-10-25 12:16:14 -04:00
std::map<Timestamp, Input> m_input_manifest;
std::map<Timestamp, Output> m_output_manifest;
std::map<Timestamp, Chat> m_chatlog;
2023-10-23 16:21:15 -04:00
SOCKET m_sock;
sockaddr_in m_addr;
2023-10-25 12:16:14 -04:00
LoginInfo m_loginfo;
PlayerInfo m_playinfo;
2023-09-24 08:45:40 -04:00
};
2023-10-26 17:57:42 -04:00
#endif