Skip to content

Commit

Permalink
Merge pull request mapeditor#1100 from henu/master
Browse files Browse the repository at this point in the history
RandomPicker no longer accepts things that have probability zero or less
  • Loading branch information
bjorn committed Sep 28, 2015
2 parents 38b1943 + 8448599 commit 9c2be76
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tiled/randompicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ class RandomPicker

void add(const T &value, qreal probability = 1.0)
{
mSum += probability;
mThresholds.insert(mSum, value);
if (probability > 0) {
mSum += probability;
mThresholds.insert(mSum, value);
}
}

bool isEmpty() const
Expand Down

0 comments on commit 9c2be76

Please sign in to comment.