@@ -2458,6 +2458,7 @@ Bool NetPacket::addTimeOutGameStartMessage(NetCommandRef *msg) {
24582458Bool NetPacket::isRoomForTimeOutGameStartMessage (NetCommandRef *msg) {
24592459 Int len = 0 ;
24602460 NetCommandMsg *cmdMsg = static_cast <NetCommandMsg *>(msg->getCommand ());
2461+ Bool needNewCommandID = FALSE ;
24612462 if (m_lastCommandType != cmdMsg->getNetCommandType ()) {
24622463 ++len;
24632464 len += sizeof (UnsignedByte);
@@ -2468,6 +2469,13 @@ Bool NetPacket::isRoomForTimeOutGameStartMessage(NetCommandRef *msg) {
24682469 if (m_lastPlayerID != cmdMsg->getPlayerID ()) {
24692470 ++len;
24702471 len += sizeof (UnsignedByte);
2472+ needNewCommandID = TRUE ;
2473+ }
2474+
2475+ // If necessary, account for the command ID of this command.
2476+ if (((m_lastCommandID + 1 ) != (UnsignedShort)(cmdMsg->getID ())) || (needNewCommandID == TRUE )) {
2477+ len += sizeof (UnsignedByte); // NetPacketFieldTypes::CommandId
2478+ len += sizeof (UnsignedShort); // command ID value
24712479 }
24722480
24732481 ++len; // for NetPacketFieldTypes::Data
@@ -2550,6 +2558,7 @@ Bool NetPacket::addLoadCompleteMessage(NetCommandRef *msg) {
25502558Bool NetPacket::isRoomForLoadCompleteMessage (NetCommandRef *msg) {
25512559 Int len = 0 ;
25522560 NetCommandMsg *cmdMsg = static_cast <NetCommandMsg *>(msg->getCommand ());
2561+ Bool needNewCommandID = FALSE ;
25532562 if (m_lastCommandType != cmdMsg->getNetCommandType ()) {
25542563 ++len;
25552564 len += sizeof (UnsignedByte);
@@ -2560,6 +2569,13 @@ Bool NetPacket::isRoomForLoadCompleteMessage(NetCommandRef *msg) {
25602569 if (m_lastPlayerID != cmdMsg->getPlayerID ()) {
25612570 ++len;
25622571 len += sizeof (UnsignedByte);
2572+ needNewCommandID = TRUE ;
2573+ }
2574+
2575+ // If necessary, account for the command ID of this command.
2576+ if (((m_lastCommandID + 1 ) != (UnsignedShort)(cmdMsg->getID ())) || (needNewCommandID == TRUE )) {
2577+ len += sizeof (UnsignedByte); // NetPacketFieldTypes::CommandId
2578+ len += sizeof (UnsignedShort); // command ID value
25632579 }
25642580
25652581 ++len; // for NetPacketFieldTypes::Data
0 commit comments