77 lines
1.3 KiB
C++
77 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <td/Types.h>
|
|
#include <vector>
|
|
#include <td/protocol/command/Commands.h>
|
|
|
|
// Make it dynamic ?
|
|
#define LOCKSTEP_BUFFER_SIZE 10
|
|
|
|
namespace td {
|
|
namespace protocol {
|
|
|
|
struct PlayerInfo {
|
|
PlayerID m_PlayerId;
|
|
std::string m_PlayerName;
|
|
};
|
|
|
|
struct MapData {
|
|
|
|
};
|
|
|
|
namespace pdata {
|
|
|
|
/** Client attempts to login (very basic) */
|
|
struct PlayerLogin {
|
|
std::string m_PlayerName;
|
|
};
|
|
|
|
/** Server indicates success */
|
|
struct LoggingSuccess {
|
|
PlayerID m_PlayerId;
|
|
};
|
|
|
|
/** Player joins the lobby */
|
|
struct PlayerJoin {
|
|
PlayerInfo m_Player;
|
|
};
|
|
|
|
/** Player leaves the lobby */
|
|
struct PlayerLeave {
|
|
PlayerID m_PlayerId;
|
|
};
|
|
|
|
/** Keep alive */
|
|
struct KeepAlive {
|
|
std::uint64_t m_KeepAliveId;
|
|
};
|
|
|
|
/** Can be used by both client and server */
|
|
struct Disconnect {
|
|
std::string m_Reason;
|
|
};
|
|
|
|
/** Chat message */
|
|
struct ChatMessage {
|
|
std::string m_Text;
|
|
};
|
|
|
|
// TODO: handle players joining in the first second
|
|
|
|
struct BeginGame {
|
|
MapData m_Map;
|
|
std::vector<PlayerInfo> m_BlueTeam;
|
|
std::vector<PlayerInfo> m_RedTeam;
|
|
// optional, used for players joining mid game
|
|
std::vector<LockStep> m_FirstLocksteps;
|
|
};
|
|
|
|
struct LockSteps {
|
|
std::uint16_t m_FirstFrameNumber;
|
|
std::array<LockStep, LOCKSTEP_BUFFER_SIZE> m_LockSteps;
|
|
};
|
|
|
|
} // namespace pdata
|
|
} // namespace protocol
|
|
} // namespace td
|