NetCommandList::addMessage sorts messages chronologically in two different ways, using getID and getSortNumber, but it's not clear why that is.
|
// Messages that are inserted in order should just be put in one right after the other. |
|
// So saving the placement of the last message inserted can give us a huge boost in |
|
// efficiency. |
|
NetCommandRef *theNext = m_lastMessageInserted->getNext(); |
|
if ((m_lastMessageInserted->getCommand()->getNetCommandType() == msg->getCommand()->getNetCommandType()) && |
|
(m_lastMessageInserted->getCommand()->getPlayerID() == msg->getCommand()->getPlayerID()) && |
|
(m_lastMessageInserted->getCommand()->getID() < msg->getCommand()->getID()) && |
|
((theNext == nullptr) || ((theNext->getCommand()->getNetCommandType() > msg->getCommand()->getNetCommandType()) || |
|
(theNext->getCommand()->getPlayerID() > msg->getCommand()->getPlayerID()) || |
|
(theNext->getCommand()->getID() > msg->getCommand()->getID())))) { |
|
// Find the position within the player's section based on the command ID. |
|
// If the command type doesn't require a command ID, sort by whatever it should be sorted by. |
|
while ((tempmsg != nullptr) && (msg->getCommand()->getNetCommandType() == tempmsg->getCommand()->getNetCommandType()) && (msg->getCommand()->getPlayerID() == tempmsg->getCommand()->getPlayerID()) && (msg->getCommand()->getSortNumber() > tempmsg->getCommand()->getSortNumber())) { |
|
tempmsg = tempmsg->getNext(); |
|
} |
NetCommandList::addMessagesorts messages chronologically in two different ways, usinggetIDandgetSortNumber, but it's not clear why that is.GeneralsGameCode/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp
Lines 154 to 163 in 4b0243f
GeneralsGameCode/Core/GameEngine/Source/GameNetwork/NetCommandList.cpp
Lines 282 to 286 in 4b0243f