File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
GeneralsMD/Code/GameEngine/Source/GameNetwork
Generals/Code/GameEngine/Source/GameNetwork Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -217,18 +217,19 @@ void Connection::clearCommandsExceptFrom( Int playerIndex )
217217 NetCommandRef *tmp = m_netCommandList->getFirstMessage ();
218218 while (tmp)
219219 {
220+ NetCommandRef *next = tmp->getNext ();
220221 NetCommandMsg *msg = tmp->getCommand ();
222+
221223 if (msg->getPlayerID () != playerIndex)
222224 {
223- DEBUG_LOG ((" Connection::clearCommandsExceptFrom(%d) - clearing a command from %d for frame %d" ,
225+ DEBUG_LOG ((" Connection::clearCommandsExceptFrom(%d) - clearing a command from player %d for frame %d" ,
224226 playerIndex, tmp->getCommand ()->getPlayerID (), tmp->getCommand ()->getExecutionFrame ()));
227+
225228 m_netCommandList->removeMessage (tmp);
226- NetCommandRef *toDelete = tmp;
227- tmp = tmp->getNext ();
228- deleteInstance (toDelete);
229- } else {
230- tmp = tmp->getNext ();
229+ deleteInstance (tmp);
231230 }
231+
232+ tmp = next;
232233 }
233234}
234235
Original file line number Diff line number Diff line change @@ -217,18 +217,19 @@ void Connection::clearCommandsExceptFrom( Int playerIndex )
217217 NetCommandRef *tmp = m_netCommandList->getFirstMessage ();
218218 while (tmp)
219219 {
220+ NetCommandRef *next = tmp->getNext ();
220221 NetCommandMsg *msg = tmp->getCommand ();
222+
221223 if (msg->getPlayerID () != playerIndex)
222224 {
223- DEBUG_LOG ((" Connection::clearCommandsExceptFrom(%d) - clearing a command from %d for frame %d" ,
225+ DEBUG_LOG ((" Connection::clearCommandsExceptFrom(%d) - clearing a command from player %d for frame %d" ,
224226 playerIndex, tmp->getCommand ()->getPlayerID (), tmp->getCommand ()->getExecutionFrame ()));
227+
225228 m_netCommandList->removeMessage (tmp);
226- NetCommandRef *toDelete = tmp;
227- tmp = tmp->getNext ();
228- deleteInstance (toDelete);
229- } else {
230- tmp = tmp->getNext ();
229+ deleteInstance (tmp);
231230 }
231+
232+ tmp = next;
232233 }
233234}
234235
You can’t perform that action at this time.
0 commit comments