forked from 0ad/0ad
This was SVN commit r13861.
This commit is contained in:
parent
2a5ec404d1
commit
1b6a5fa802
@ -843,13 +843,10 @@ public:
|
||||
results.clear();
|
||||
results.reserve(query.lastMatch.size());
|
||||
PerformQuery(query, results);
|
||||
if (results.empty())
|
||||
continue;
|
||||
|
||||
// Compute the changes vs the last match
|
||||
added.clear();
|
||||
removed.clear();
|
||||
|
||||
// Return the 'added' list sorted by distance from the entity
|
||||
// (Don't bother sorting 'removed' because they might not even have positions or exist any more)
|
||||
std::set_difference(results.begin(), results.end(), query.lastMatch.begin(), query.lastMatch.end(),
|
||||
|
@ -126,11 +126,17 @@ public:
|
||||
{
|
||||
if (key >= m_BufferCapacity) // do we need to resize buffer?
|
||||
{
|
||||
do { m_BufferCapacity += 4096; } while (key >= m_BufferCapacity);
|
||||
|
||||
int newCapacity = m_BufferCapacity + 4096;
|
||||
while (key >= newCapacity) newCapacity += 4096;
|
||||
// always allocate +1 behind the scenes, because end() must have a 0xFFFFFFFF key
|
||||
m_Buffer = (value_type*)realloc(m_Buffer, sizeof(value_type) * (m_BufferCapacity + 1));
|
||||
|
||||
value_type* mem = (value_type*)realloc(m_Buffer, sizeof(value_type) * (newCapacity + 1));
|
||||
if (!mem)
|
||||
{
|
||||
debug_warn("EntityMap::insert() realloc failed! Out of memory.");
|
||||
throw std::bad_alloc(); // fail to expand and insert
|
||||
}
|
||||
m_BufferCapacity = newCapacity;
|
||||
m_Buffer = mem;
|
||||
goto fill_gaps;
|
||||
}
|
||||
else if (key > m_BufferSize) // weird insert far beyond the end
|
||||
|
Loading…
Reference in New Issue
Block a user