Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Revisions: Issue #3314 All Revisions ] Back to Issue ]
Summary 0003314: The ticbuffer isn't completely processed in some cases
Revision 2017-10-28 01:09 by Leonard
Description The loop that is supposed to process it is wrong:
for ( unsigned int i = 0; i < g_aClients[ulIdx].MoveCMDs.Size(); ++i )
             {
                 g_aClients[ulIdx].MoveCMDs[0]->process ( ulIdx );
 
                 // [BB] Only limit the amount of movement commands.
                 if ( g_aClients[ulIdx].MoveCMDs[0]->isMoveCmd() )
                     ++numMoveCMDs;
 
                 delete g_aClients[ulIdx].MoveCMDs[0];
                 g_aClients[ulIdx].MoveCMDs.Delete(0);
 
                 if ( numMoveCMDs == 2 )
                     break;
             }

As you can see, i increases each step however Size() decreases since we deleted one entry from the TArray.
This becomes problematic if for example there are 2 movement commands left in the buffer, only one will be processed and then the condition (i < Size()) will no longer be true.
Revision 2017-10-28 01:06 by Leonard
Description The loop that is supposed to process it is wrong:
for ( unsigned int i = 0; i < g_aClients[ulIdx].MoveCMDs.Size(); ++i )
             {
                 g_aClients[ulIdx].MoveCMDs[0]->process ( ulIdx );
 
                 // [BB] Only limit the amount of movement commands.
                 if ( g_aClients[ulIdx].MoveCMDs[0]->isMoveCmd() )
                     ++numMoveCMDs;
 
                 delete g_aClients[ulIdx].MoveCMDs[0];
                 g_aClients[ulIdx].MoveCMDs.Delete(0);
 
                 if ( numMoveCMDs == 2 )
                     break;
             }

As you can see, i increases each step however Size() decreases since we deleted one entry from the TArray.
This becomes problematic if for example there are 2 movement commands left in the buffer, only one will be processed and then the condition (i < Size()) will no longer be true.






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker