assertions added to inspect potential bug in playlist item deletion code

formatting cleanups in random number generators 


git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@857 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2008-02-29 06:13:23 +00:00
parent 8eb49cca01
commit e1193bc05b
2 changed files with 5 additions and 5 deletions

View File

@ -61,11 +61,10 @@ inline std::size_t uniformInteger(std::size_t upperBound=1) {
inline std::size_t weightedRandom(const std::vector<int> & weights, int weightTotalHint = 0) {
if (weightTotalHint == 0)
for (std::size_t i = 0; i < weights.size();i++) {
if (weightTotalHint <= 0)
for (std::size_t i = 0; i < weights.size();i++)
weightTotalHint += weights[i];
}
int sampledSum = uniformInteger(weightTotalHint);
int sum = 0;

View File

@ -509,6 +509,7 @@ void QProjectM_MainWindow::removePlaylistItems(const QModelIndexList & items) {
}
PlaylistItemVector & lastCachedItems = *historyHash[previousFilter];
assert (lastCachedItems.size() == playlistModel->rowCount());
QVector<long> zombieItems;
@ -531,7 +532,7 @@ void QProjectM_MainWindow::removePlaylistItems(const QModelIndexList & items) {
int index = cachedItems.indexOf(id);
if (index >= 0)
cachedItems.remove(index);
}
}
}
foreach (int key, reverseOrderKeys) {