Updated TODO list

Added IS_HANDSHAKE macro to check if a NetworkMessage is a handshake easier
Utility: All From... methods are now ToBytes
replaced emplace_back to insert since it was not compiling correcly
This commit is contained in:
xX-TheDoctor-Xx
2016-08-18 22:23:43 +01:00
parent 9d1c518610
commit 996b88c0f6
16 changed files with 59 additions and 48 deletions

View File

@ -21,12 +21,13 @@ const std::vector<byte>& Handshake::EncodeHandshake(const Handshake & handshake)
{
std::vector<byte> handshake_bytes;
std::vector<byte> id = Utility::BitConverter::FromUint16(handshake.id);
std::vector<byte> con_mode = Utility::BitConverter::FromUint8(handshake.con_code);
handshake_bytes.emplace_back(Utility::BitConverter::FromUint8(1));
handshake_bytes.emplace_back(id.begin(), id.end());
handshake_bytes.emplace_back(con_mode.begin(), con_mode.end());
std::vector<byte> id = Utility::BitConverter::ToBytes(handshake.id);
std::vector<byte> con_mode = Utility::BitConverter::ToBytes(handshake.con_code);
std::vector<byte> type = Utility::BitConverter::ToBytes(static_cast<uint8>(1));
handshake_bytes.insert(handshake_bytes.begin(), type.begin(), type.end());
handshake_bytes.insert(handshake_bytes.begin(), id.begin(), id.end());
handshake_bytes.insert(handshake_bytes.begin(), con_mode.begin(), con_mode.end());
return handshake_bytes;
}