mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:52:26 +02:00
cr cleanup
This commit is contained in:
parent
4cea0ffa10
commit
778d3715ce
1 changed files with 3 additions and 2 deletions
|
@ -61,12 +61,13 @@ void VoxelNodeBag::insert(VoxelNode* node) {
|
||||||
// copy old elements into the new bag, but leave a space where we need to
|
// copy old elements into the new bag, but leave a space where we need to
|
||||||
// insert the new node
|
// insert the new node
|
||||||
memcpy(_bagElements, oldBag, insertAt * sizeof(VoxelNode*));
|
memcpy(_bagElements, oldBag, insertAt * sizeof(VoxelNode*));
|
||||||
memcpy(&_bagElements[insertAt+1], &oldBag[insertAt], (_elementsInUse-insertAt) * sizeof(VoxelNode*));
|
memcpy(&_bagElements[insertAt + 1], &oldBag[insertAt], (_elementsInUse - insertAt) * sizeof(VoxelNode*));
|
||||||
|
delete[] oldBag;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// move existing elements further back in the bag array, leave a space where we need to
|
// move existing elements further back in the bag array, leave a space where we need to
|
||||||
// insert the new node
|
// insert the new node
|
||||||
memmove(&_bagElements[insertAt+1], &_bagElements[insertAt], (_elementsInUse-insertAt) * sizeof(VoxelNode*));
|
memmove(&_bagElements[insertAt + 1], &_bagElements[insertAt], (_elementsInUse - insertAt) * sizeof(VoxelNode*));
|
||||||
}
|
}
|
||||||
_bagElements[insertAt] = node;
|
_bagElements[insertAt] = node;
|
||||||
_elementsInUse++;
|
_elementsInUse++;
|
||||||
|
|
Loading…
Reference in a new issue