일단 이제 자잘한 버그만 고치면 될 듯?
This commit is contained in:
@@ -84,26 +84,61 @@ public:
|
||||
RequestType requestType;
|
||||
DataType dataType;
|
||||
std::uint16_t packetLength;
|
||||
std::uint16_t destId[4];
|
||||
std::uint16_t myId[4];
|
||||
std::uint16_t roomId[4];
|
||||
std::uint8_t name[];
|
||||
} __data;
|
||||
std::uint8_t serialized[1500] = "";
|
||||
};
|
||||
std::uint8_t* convToN() {
|
||||
__data.packetLength = ::htons(__data.packetLength);
|
||||
for (int i = 0; i < 4; i++)
|
||||
__data.destId[i] = ::htons(__data.destId[i]);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
__data.myId[i] = ::htons(__data.myId[i]);
|
||||
__data.roomId[i] = ::htons(__data.roomId[i]);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
std::uint8_t* convToH() {
|
||||
__data.packetLength = ::ntohs(__data.packetLength);
|
||||
for (int i = 0; i < 4; i++)
|
||||
__data.destId[i] = ::ntohs(__data.destId[i]);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
__data.myId[i] = ::ntohs(__data.myId[i]);
|
||||
__data.roomId[i] = ::ntohs(__data.roomId[i]);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
};
|
||||
|
||||
class alignas(4) RoomExitRequestPacket : public Packet {};
|
||||
class alignas(4) RoomExitRequestPacket : public Packet {
|
||||
public:
|
||||
union {
|
||||
struct {
|
||||
PacketCategory packetType;
|
||||
RequestType requestType;
|
||||
DataType dataType;
|
||||
std::uint16_t packetLength;
|
||||
std::uint16_t myId[4];
|
||||
std::uint16_t roomId[4];
|
||||
std::uint8_t name[];
|
||||
} __data;
|
||||
std::uint8_t serialized[1500] = "";
|
||||
};
|
||||
std::uint8_t* convToN() {
|
||||
__data.packetLength = ::htons(__data.packetLength);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
__data.myId[i] = ::htons(__data.myId[i]);
|
||||
__data.roomId[i] = ::htons(__data.roomId[i]);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
std::uint8_t* convToH() {
|
||||
__data.packetLength = ::ntohs(__data.packetLength);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
__data.myId[i] = ::ntohs(__data.myId[i]);
|
||||
__data.roomId[i] = ::ntohs(__data.roomId[i]);
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
};
|
||||
|
||||
class alignas(4) UsersListRequestPacket : public Packet {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user