mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	Extend sanity checks in ActiveBlockList::update
also fixes the space indentation
This commit is contained in:
		@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user