Worked the new protocol into the client (read more)
I've added the handle and avatar fields back into the PlayerInfo section in the network code, because I need to be able to load a specific file when a new player is created. This wasn't forseen, but it's fine. i'm leaving the fields in ClientInfo as well, because LobbyMenu is using them to login to the server. PlayerIndex is now a shared parameter. I've shifted some code around in InWorld, however the overall logic is the same. This build (as well as the last) does not compile.
This commit is contained in:
@@ -97,6 +97,10 @@ void serializePlayer(SerialPacket* packet, char* buffer) {
|
||||
SERIALIZE(buffer, &packet->playerInfo.clientIndex, sizeof(int));
|
||||
SERIALIZE(buffer, &packet->playerInfo.playerIndex, sizeof(int));
|
||||
|
||||
//texts
|
||||
SERIALIZE(buffer, packet->clientInfo.handle, PACKET_STRING_SIZE);
|
||||
SERIALIZE(buffer, packet->clientInfo.avatar, PACKET_STRING_SIZE);
|
||||
|
||||
//vectors
|
||||
SERIALIZE(buffer, &packet->playerInfo.position.x, sizeof(double));
|
||||
SERIALIZE(buffer, &packet->playerInfo.position.y, sizeof(double));
|
||||
@@ -176,6 +180,10 @@ void deserializePlayer(SerialPacket* packet, char* buffer) {
|
||||
DESERIALIZE(buffer, &packet->playerInfo.clientIndex, sizeof(int));
|
||||
DESERIALIZE(buffer, &packet->playerInfo.playerIndex, sizeof(int));
|
||||
|
||||
//texts
|
||||
DESERIALIZE(buffer, packet->clientInfo.handle, PACKET_STRING_SIZE);
|
||||
DESERIALIZE(buffer, packet->clientInfo.avatar, PACKET_STRING_SIZE);
|
||||
|
||||
//vectors
|
||||
DESERIALIZE(buffer, &packet->playerInfo.position.x, sizeof(double));
|
||||
DESERIALIZE(buffer, &packet->playerInfo.position.y, sizeof(double));
|
||||
|
||||
@@ -108,6 +108,8 @@ union SerialPacket {
|
||||
Metadata meta;
|
||||
int clientIndex;
|
||||
int playerIndex;
|
||||
char handle[PACKET_STRING_SIZE];
|
||||
char avatar[PACKET_STRING_SIZE];
|
||||
Vector2 position;
|
||||
Vector2 motion;
|
||||
}playerInfo;
|
||||
|
||||
Reference in New Issue
Block a user