Extend sanity checks in ActiveBlockList::update

also fixes the space indentation
This commit is contained in:
sfan5 2023-12-30 00:29:09 +01:00
parent c99196d363
commit 431444ba9f

@ -394,19 +394,23 @@ void ActiveBlockList::update(std::vector<PlayerSAO*> &active_players,
std::inserter(blocks_removed, blocks_removed.end()));
/*
Some sanity checks
*/
Do some least-effort sanity checks to hopefully catch code bugs.
*/
assert(newlist.size() >= extralist.size());
assert(blocks_removed.size() <= m_list.size());
if (!blocks_added.empty())
assert(newlist.count(*blocks_added.begin()) > 0);
if (!blocks_added.empty()) {
assert(newlist.count(*blocks_added.begin()) > 0);
assert(blocks_removed.count(*blocks_added.begin()) == 0);
}
if (!extra_blocks_added.empty()) {
assert(newlist.count(*extra_blocks_added.begin()) > 0);
assert(blocks_added.count(*extra_blocks_added.begin()) == 0);
assert(newlist.count(*extra_blocks_added.begin()) > 0);
assert(extralist.count(*extra_blocks_added.begin()) > 0);
assert(blocks_added.count(*extra_blocks_added.begin()) == 0);
}
if (!blocks_removed.empty()) {
assert(newlist.count(*blocks_removed.begin()) == 0);
assert(m_list.count(*blocks_removed.begin()) > 0);
assert(newlist.count(*blocks_removed.begin()) == 0);
assert(extralist.count(*blocks_removed.begin()) == 0);
assert(m_list.count(*blocks_removed.begin()) > 0);
}
/*