@@ -171,7 +171,7 @@ static Int indexFromMask(UnsignedInt mask)
171171/* *
172172 * Construct a new GameMessage object from the data in this object.
173173 */
174- GameMessage *NetGameCommandMsg::constructGameMessage ()
174+ GameMessage *NetGameCommandMsg::constructGameMessage () const
175175{
176176 GameMessage *retval = newInstance (GameMessage)(m_type);
177177
@@ -232,14 +232,11 @@ void NetGameCommandMsg::setGameMessageType(GameMessage::Type type) {
232232 m_type = type;
233233}
234234
235- /* *
236- * Get the byte count for this game command message.
237- */
238235size_t NetGameCommandMsg::getPackedByteCount () const {
239236 UnsignedShort msglen = sizeof (NetPacketGameCommand);
240237
241238 // Variable data portion
242- GameMessage *gmsg = const_cast <NetGameCommandMsg*>( this )-> constructGameMessage ();
239+ GameMessage *gmsg = constructGameMessage ();
243240 GameMessageParser *parser = newInstance (GameMessageParser)(gmsg);
244241
245242 msglen += sizeof (GameMessage::Type);
@@ -882,23 +879,19 @@ void NetChatCommandMsg::setPlayerMask( Int playerMask )
882879 m_playerMask = playerMask;
883880}
884881
885- /* *
886- * Get the byte count for this chat message.
887- */
888882size_t NetChatCommandMsg::getPackedByteCount () const
889883{
890- return sizeof (NetPacketChatCommand) + sizeof (UnsignedByte) /* text length byte */ + m_text.getByteCount () + sizeof (m_playerMask);
884+ return sizeof (NetPacketChatCommand) + sizeof (UnsignedByte) /* text length byte */ + m_text.getByteCount ()
885+ + sizeof (m_playerMask);
891886}
892887
893888// -------------------------
894889// NetDisconnectChatCommandMsg
895890// -------------------------
896- /* *
897- * Get the byte count for this disconnect chat message.
898- */
899891size_t NetDisconnectChatCommandMsg::getPackedByteCount () const
900892{
901- return sizeof (NetPacketDisconnectChatCommand) + sizeof (UnsignedByte) /* text length byte */ + m_text.getByteCount ();
893+ return sizeof (NetPacketDisconnectChatCommand) + sizeof (UnsignedByte) /* text length byte */
894+ + m_text.getByteCount ();
902895}
903896
904897// -------------------------
@@ -1094,13 +1087,11 @@ void NetFileCommandMsg::setFileData(UnsignedByte *data, UnsignedInt dataLength)
10941087 memcpy (m_data, data, dataLength);
10951088}
10961089
1097- /* *
1098- * Get the byte count for this file command message.
1099- */
11001090size_t NetFileCommandMsg::getPackedByteCount () const
11011091{
1102- return sizeof (NetPacketFileCommand) + m_portableFilename.getLength () + 1 // filename + null terminator
1103- + sizeof (UnsignedInt) // file data length
1092+ return sizeof (NetPacketFileCommand)
1093+ + m_portableFilename.getLength () + 1 // filename + null terminator
1094+ + sizeof (m_dataLength) // file data length
11041095 + m_dataLength; // the file data
11051096}
11061097
@@ -1143,9 +1134,6 @@ void NetFileAnnounceCommandMsg::setPlayerMask(UnsignedByte playerMask) {
11431134 m_playerMask = playerMask;
11441135}
11451136
1146- /* *
1147- * Get the byte count for this file announce command message.
1148- */
11491137size_t NetFileAnnounceCommandMsg::getPackedByteCount () const
11501138{
11511139 return sizeof (NetPacketFileAnnounceCommand)
0 commit comments