48 lines
967 B
C++
48 lines
967 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"
|
|
|
|
using namespace netprot;
|
|
|
|
class Connection {
|
|
public:
|
|
Connection(
|
|
SOCKET sock,
|
|
sockaddr_in sockaddr,
|
|
LoginInfo log,
|
|
PlayerInfo play);
|
|
~Connection();
|
|
|
|
Player* player = nullptr;
|
|
|
|
uint64_t GetHash(bool self = true) const;
|
|
uint64_t GetTeamHash() const;
|
|
std::string GetName() const;
|
|
|
|
void AddInput(Input in);
|
|
Output* getOutput(Timestamp time);
|
|
Sync getSync(Timestamp time);
|
|
SOCKET getSock() const;
|
|
PlayerInfo* getInfo() const;
|
|
sockaddr_in* getAddr() const;
|
|
|
|
void CleanInputManifest(Timestamp time);
|
|
private:
|
|
std::map<Timestamp, Input> m_input_manifest;
|
|
std::map<Timestamp, Output> m_output_manifest;
|
|
std::map<Timestamp, Chat> m_chatlog;
|
|
|
|
SOCKET m_sock;
|
|
sockaddr_in m_addr;
|
|
LoginInfo m_loginfo;
|
|
PlayerInfo m_playinfo;
|
|
|
|
};
|
|
#endif
|