File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -568,14 +568,18 @@ void PopulateLobbyPlayerListbox(void)
568
568
// restore selection
569
569
if (indicesToSelect.size ())
570
570
{
571
- std::set<Int>::const_iterator indexIt;
572
- Int *newIndices = NEW Int[indicesToSelect.size ()];
573
- for (i=0 , indexIt = indicesToSelect.begin (); indexIt != indicesToSelect.end (); ++i, ++indexIt)
571
+ std::set<Int>::const_iterator indexIt = indicesToSelect.begin ();
572
+ const size_t count = indicesToSelect.size ();
573
+ size_t index = 0 ;
574
+ Int *newIndices = NEW Int[count];
575
+ while (index < count)
574
576
{
575
- newIndices[i ] = *indexIt;
577
+ newIndices[index ] = *indexIt;
576
578
DEBUG_LOG ((" Queueing up index %d to re-select\n " , *indexIt));
579
+ ++index;
580
+ ++indexIt;
577
581
}
578
- GadgetListBoxSetSelected (listboxLobbyPlayers, newIndices, indicesToSelect. size () );
582
+ GadgetListBoxSetSelected (listboxLobbyPlayers, newIndices, count );
579
583
delete[] newIndices;
580
584
}
581
585
Original file line number Diff line number Diff line change @@ -585,14 +585,18 @@ void PopulateLobbyPlayerListbox(void)
585
585
// restore selection
586
586
if (indicesToSelect.size ())
587
587
{
588
- std::set<Int>::const_iterator indexIt;
589
- Int *newIndices = NEW Int[indicesToSelect.size ()];
590
- for (i=0 , indexIt = indicesToSelect.begin (); indexIt != indicesToSelect.end (); ++i, ++indexIt)
588
+ std::set<Int>::const_iterator indexIt = indicesToSelect.begin ();
589
+ const size_t count = indicesToSelect.size ();
590
+ size_t index = 0 ;
591
+ Int *newIndices = NEW Int[count];
592
+ while (index < count)
591
593
{
592
- newIndices[i ] = *indexIt;
594
+ newIndices[index ] = *indexIt;
593
595
DEBUG_LOG ((" Queueing up index %d to re-select\n " , *indexIt));
596
+ ++index;
597
+ ++indexIt;
594
598
}
595
- GadgetListBoxSetSelected (listboxLobbyPlayers, newIndices, indicesToSelect. size () );
599
+ GadgetListBoxSetSelected (listboxLobbyPlayers, newIndices, count );
596
600
delete[] newIndices;
597
601
}
598
602
You can’t perform that action at this time.
0 commit comments