ajout errlog
This commit is contained in:
parent
20d15a1559
commit
035436c639
@ -11,7 +11,7 @@ namespace netprot {
|
||||
ERR, INPUT, OUTPUT, SYNC,
|
||||
TEAMINF, SELFINF, PLAYINF,
|
||||
CHUNKMOD, PLAYERMOD, PICKUPMOD,
|
||||
GAMEINFO, ENDINFO , CHAT
|
||||
GAMEINFO, ENDINFO , CHAT, ERRLOG
|
||||
};
|
||||
|
||||
typedef struct { // cli -> srv UDP ~frame
|
||||
@ -31,10 +31,10 @@ namespace netprot {
|
||||
|
||||
typedef struct { // srv -> cli TCP ~second
|
||||
Timestamp timestamp;
|
||||
uint64_t sid = 0,
|
||||
timer = 0;
|
||||
uint8_t hp = 0;
|
||||
uint64_t sid = 0;
|
||||
uint32_t timer = 0;
|
||||
uint16_t ammo = 0;
|
||||
uint8_t hp = 0;
|
||||
Vector3f position;
|
||||
} Sync;
|
||||
|
||||
@ -55,10 +55,10 @@ namespace netprot {
|
||||
tid = 0;
|
||||
} PlayerInfo;
|
||||
|
||||
typedef struct {
|
||||
typedef struct { // cli <-> srv TCP event (before game start)/ once
|
||||
uint64_t seed;
|
||||
// uint8_t gameType;
|
||||
// uint8_t time;
|
||||
uint32_t countdown;
|
||||
uint8_t gameType; // TOOD: enum.
|
||||
} GameInfo;
|
||||
|
||||
typedef struct { // cli <-> srv TCP event
|
||||
@ -68,21 +68,30 @@ namespace netprot {
|
||||
char mess[140]; // Good 'nough for twitr, good 'nough for me.
|
||||
} Chat;
|
||||
|
||||
typedef struct { // srv -> cli TCP event
|
||||
char mess[140];
|
||||
bool is_fatal;
|
||||
} ErrorLog;
|
||||
|
||||
inline void Serialize(Input* in, char* buf, uint32_t* buflen); // cli
|
||||
inline void Serialize(Output* out, char* buf, uint32_t* buflen); // srv
|
||||
inline void Serialize(Sync* sync, char* buf, uint32_t* buflen); // srv
|
||||
inline void Serialize(TeamInfo* tinfo, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Serialize(SelfInfo* sinfo, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Serialize(PlayerInfo* pinfo, char* buf, uint32_t* buflen); // srv
|
||||
inline void Serialize(GameInfo* ginfo, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Serialize(Chat* chat, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Serialize(ErrorLog* errlog, char* buf, uint32_t* buflen); // srv
|
||||
|
||||
inline void Deserialize(Input* in, char* buf, uint32_t* buflen); // srv
|
||||
inline void Deserialize(Output* out, char* buf, uint32_t* buflen); // cli
|
||||
inline void Deserialize(Sync* sync, char* buf, uint32_t* buflen); // cli
|
||||
inline void Deserialize(TeamInfo* tinfo, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Deserialize(SelfInfo* sinfo, char* buf, uint32_t* buflen); // cli/srv
|
||||
inline void Deserialize(PlayerInfo* spinfoync, char* buf, uint32_t* buflen); // cli
|
||||
inline void Deserialize(PlayerInfo* pinfo, char* buf, uint32_t* buflen); // cli
|
||||
inline void Deserialize(GameInfo* ginfo, char* buf, uint32_t* buflen); // cli
|
||||
inline void Deserialize(Chat* chat, char* buf, uint32_t* buflen); // srv/cli
|
||||
inline void Deserialize(ErrorLog* errlog, char* buf, uint32_t* buflen); // srv
|
||||
|
||||
inline PacketType getType(char* buf, uint32_t* buflen); // srv/cli
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user