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

View File

@ -476,7 +476,17 @@ void GuiIconGrid::OnGameTitleAdded(gameInfo * info) {
this->append(button); this->append(button);
positionMutex.lock(); 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); position.push_back(info->titleId);
}
positionMutex.unlock(); positionMutex.unlock();
bUpdatePositions = true; bUpdatePositions = true;