@@ -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,22 @@ 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)
885+ + sizeof (UnsignedByte) // text length byte
886+ + m_text.getByteCount ()
887+ + sizeof (m_playerMask);
891888}
892889
893890// -------------------------
894891// NetDisconnectChatCommandMsg
895892// -------------------------
896- /* *
897- * Get the byte count for this disconnect chat message.
898- */
899893size_t NetDisconnectChatCommandMsg::getPackedByteCount () const
900894{
901- return sizeof (NetPacketDisconnectChatCommand) + sizeof (UnsignedByte) /* text length byte */ + m_text.getByteCount ();
895+ return sizeof (NetPacketDisconnectChatCommand)
896+ + sizeof (UnsignedByte) // text length byte
897+ + m_text.getByteCount ();
902898}
903899
904900// -------------------------
@@ -1094,13 +1090,11 @@ void NetFileCommandMsg::setFileData(UnsignedByte *data, UnsignedInt dataLength)
10941090 memcpy (m_data, data, dataLength);
10951091}
10961092
1097- /* *
1098- * Get the byte count for this file command message.
1099- */
11001093size_t NetFileCommandMsg::getPackedByteCount () const
11011094{
1102- return sizeof (NetPacketFileCommand) + m_portableFilename.getLength () + 1 // filename + null terminator
1103- + sizeof (UnsignedInt) // file data length
1095+ return sizeof (NetPacketFileCommand)
1096+ + m_portableFilename.getLength () + 1 // filename + null terminator
1097+ + sizeof (m_dataLength) // file data length
11041098 + m_dataLength; // the file data
11051099}
11061100
@@ -1143,9 +1137,6 @@ void NetFileAnnounceCommandMsg::setPlayerMask(UnsignedByte playerMask) {
11431137 m_playerMask = playerMask;
11441138}
11451139
1146- /* *
1147- * Get the byte count for this file announce command message.
1148- */
11491140size_t NetFileAnnounceCommandMsg::getPackedByteCount () const
11501141{
11511142 return sizeof (NetPacketFileAnnounceCommand)
0 commit comments