Skip to content
Commit 849a54a7 authored by Igor Kushnir's avatar Igor Kushnir
Browse files

ItemRepository::index: fix off-by-one error

Several member functions of ItemRepository access elements of m_buckets
at indices up to and including m_currentBucket. Presumably
m_currentBucket < m_buckets.size() is an invariant.
needMonsterExtent + 1 is added to m_currentBucket a few lines below the
modified line. So when
m_currentBucket + needMonsterExtent + 1 == m_buckets.size(), the size of
m_buckets must be increased.

The bug fixed in this commit caused frequent assertion failures in
ItemRepository when TestItemRepository::testItemRepository() randomly
picked a large item size - `if (itemDecision < largeItemsFraction)`.
parent f756798a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment