Use existing free slots before adding them to the back

This commit is contained in:
Maschell 2020-02-22 22:50:56 +01:00
parent 3e37d5aa46
commit 4d2f1aea3e
1 changed files with 10 additions and 0 deletions

View File

@ -476,7 +476,17 @@ void GuiIconGrid::OnGameTitleAdded(gameInfo * info) {
this->append(button);
positionMutex.lock();
bool foundFreePlace = false;
for(uint32_t i = 0; i < position.size(); i++) {
if(position[i] == 0) {
position[i] = info->titleId;
foundFreePlace = true;
break;
}
}
if(!foundFreePlace) {
position.push_back(info->titleId);
}
positionMutex.unlock();
bUpdatePositions = true;