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

Function EraseSwapLevelIndex

engine/gameobject/src/gameobject/gameobject.cpp:737–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735
736
737 static void EraseSwapLevelIndex(Collection* collection, HInstance instance)
738 {
739 /*
740 * Remove instance from m_LevelIndices using an erase-swap operation
741 */
742
743 dmArray<uint16_t>& level = collection->m_LevelIndices[instance->m_Depth];
744 assert(level.Size() > 0);
745 assert(instance->m_LevelIndex < level.Size());
746
747 uint16_t level_index = instance->m_LevelIndex;
748 uint16_t swap_in_index = level.EraseSwap(level_index);
749 HInstance swap_in_instance = collection->m_Instances[swap_in_index];
750 assert(swap_in_instance->m_Index == swap_in_index);
751 swap_in_instance->m_LevelIndex = level_index;
752 }
753
754 /*
755 * Heuristic for expanding the level indices arrays:

Callers 5

UndoNewInstanceFunction · 0.85
MoveUpFunction · 0.85
MoveDownFunction · 0.85
DoDeleteInstanceFunction · 0.85
SetParentFunction · 0.85

Calls 2

assertFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected