diff options
Diffstat (limited to 'src/sorted.cpp')
-rw-r--r-- | src/sorted.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sorted.cpp b/src/sorted.cpp index 08d9d3b..03f5b0a 100644 --- a/src/sorted.cpp +++ b/src/sorted.cpp @@ -242,11 +242,22 @@ Layer_SortAll(project_state *State, memory *Memory, sorted_layer_array *LayerEntry = &SortedLayerStart[Idx]; block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, LayerEntry->Block_Layer_Index); if (Layer->IsSelected) { + for (int a = i+1; a < SortedCompStart->LayerCount; a++) { + int PrevIdx = a + FauxIncrement - 1; + sorted_layer_array *PrevLayerEntry = &SortedLayerStart[PrevIdx]; + int NextIdx = a + FauxIncrement; + sorted_layer_array *NextLayerEntry = &SortedLayerStart[NextIdx]; + if (NextLayerEntry->SortedOffset == PrevLayerEntry->SortedOffset) + NextLayerEntry->SortedOffset -= 1; + else + break; + } uint8 *Address_Start = (uint8 *)(LayerEntry); uint8 *Address_End = (uint8 *)(&SortedLayerStart[SortedCompStart->LayerCount + FauxIncrement]) - 1; Assert(SortedCompStart->CurrentSortIndex != (SortedCompStart->LayerCount + SortedCompStart->FakeLayerCount)); Arbitrary_ShiftData(Address_Start, Address_End, sizeof(sorted_layer_array), 1); sorted_layer_array *FakeLayerEntry = LayerEntry + 1; + FakeLayerEntry->SortedOffset -= 1; Assert(FakeLayerEntry->Block_Layer_Index == LayerEntry->Block_Layer_Index); FakeLayerEntry->IsFake = true; FauxIncrement++; |