diff options
Diffstat (limited to 'source/packets/cPacket_UpdateHealth.cpp')
-rw-r--r-- | source/packets/cPacket_UpdateHealth.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/packets/cPacket_UpdateHealth.cpp b/source/packets/cPacket_UpdateHealth.cpp index c6cec56ae..4380e25d6 100644 --- a/source/packets/cPacket_UpdateHealth.cpp +++ b/source/packets/cPacket_UpdateHealth.cpp @@ -7,19 +7,14 @@ -bool cPacket_UpdateHealth::Send(cSocket & a_Socket)
+void cPacket_UpdateHealth::Serialize(AString & a_Data) const
{
- unsigned int TotalSize = c_Size;
+ AppendByte (a_Data, m_PacketID);
+ AppendShort(a_Data, m_Health);
+ AppendShort(a_Data, m_Food);
+ AppendFloat(a_Data, m_Saturation);
+}
+
- char* Message = new char[TotalSize];
- unsigned int i = 0;
- AppendByte ( (char)m_PacketID, Message, i );
- AppendShort ( m_Health, Message, i );
- AppendShort ( m_Food, Message, i );
- AppendFloat ( m_Saturation, Message, i );
- bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
- delete [] Message;
- return RetVal;
-}
|