Further reverted RangeManager sorting to stable_sort, since possibly with different STL implementations, the order of entities might change and cause OOS.
Overflowing elements in SpatialQueryArray are now reported with debug_warn, but can be ignored and the program will continue working, but further entities will be truncated. This was SVN commit r13860.
This commit is contained in:
parent
bb799bdd53
commit
2a5ec404d1
@ -859,7 +859,7 @@ public:
|
||||
if (added.empty() && removed.empty())
|
||||
continue;
|
||||
|
||||
std::sort(added.begin(), added.end(), EntityDistanceOrdering(m_EntityData, cmpSourcePosition->GetPosition2D()));
|
||||
std::stable_sort(added.begin(), added.end(), EntityDistanceOrdering(m_EntityData, cmpSourcePosition->GetPosition2D()));
|
||||
|
||||
messages.resize(messages.size() + 1);
|
||||
std::pair<entity_id_t, CMessageRangeUpdate>& back = messages.back();
|
||||
|
@ -86,8 +86,10 @@ class SpatialSubdivision
|
||||
int dsti = out.count; // the index in [out] where to start copying
|
||||
int count = (int)items.size();
|
||||
if ((dsti + count) > SpatialQueryArray::MAX_COUNT)
|
||||
count = SpatialQueryArray::MAX_COUNT - dsti; // silently fail to copy overflowing items
|
||||
|
||||
{
|
||||
debug_warn("SpatialSubdivision Query too large. Results truncated.");
|
||||
count = SpatialQueryArray::MAX_COUNT - dsti; // don't copy overflowing items
|
||||
}
|
||||
uint32_t* dst = &out.items[dsti];
|
||||
uint32_t* src = &items[0];
|
||||
for (int i = 0; i < count; ++i) // copy all items
|
||||
|
Loading…
Reference in New Issue
Block a user