MCPcopy Create free account
hub / github.com/defold/defold / ExpandLevel

Function ExpandLevel

engine/gameobject/src/gameobject/gameobject.cpp:760–766  ·  view source on GitHub ↗

* Heuristic for expanding the level indices arrays: * * Increase capacity by 50%, but: * ** 10 elements as min * ** Up to max_instances as max */

Source from the content-addressed store, hash-verified

758 * ** Up to max_instances as max
759 */
760 static void ExpandLevel(dmArray<uint16_t>& level, uint32_t max_instances)
761 {
762 const uint32_t min_offset = 10;
763 const uint32_t max_offset = max_instances - level.Capacity();
764 int32_t offset = dmMath::Min(max_offset, dmMath::Max(min_offset, level.Size() / 2));
765 level.OffsetCapacity(offset);
766 }
767
768 static void InsertInstanceInLevelIndex(Collection* collection, HInstance instance)
769 {

Callers 1

Calls 5

MinFunction · 0.85
MaxFunction · 0.50
CapacityMethod · 0.45
SizeMethod · 0.45
OffsetCapacityMethod · 0.45

Tested by

no test coverage detected