diff options
Diffstat (limited to 'src/sorted.cpp')
-rw-r--r-- | src/sorted.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/sorted.cpp b/src/sorted.cpp index 1553bf9..948c6f6 100644 --- a/src/sorted.cpp +++ b/src/sorted.cpp @@ -299,16 +299,7 @@ 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 & 0x01) { - 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; - } + // Sort_OffsetDupes(Memory, SortedLayerStart, Layer, LayerEntry, i, FauxIncrement, SortedCompStart->LayerCount, 1); uint8 *Address_Start = (uint8 *)(LayerEntry); uint8 *Address_End = (uint8 *)(&SortedLayerStart[SortedCompStart->LayerCount + FauxIncrement]) - 1; Assert(SortedCompStart->CurrentSortIndex != (SortedCompStart->LayerCount + SortedCompStart->FakeLayerCount)); @@ -318,6 +309,17 @@ Layer_SortAll(project_state *State, memory *Memory, Assert(FakeLayerEntry->Block_Layer_Index == LayerEntry->Block_Layer_Index); FakeLayerEntry->IsFake = true; FauxIncrement++; + + sorted_layer_array *PrevLayerEntry = FakeLayerEntry; + for (int a = i+1; a < SortedCompStart->LayerCount; a++) { + int NextIdx = a + FauxIncrement; + sorted_layer_array *NextLayerEntry = &SortedLayerStart[NextIdx]; + if (NextLayerEntry->SortedOffset == PrevLayerEntry->SortedOffset) + NextLayerEntry->SortedOffset -= 1; + else + break; + PrevLayerEntry = NextLayerEntry; + } } i++; } |