Skip to content

Commit

Permalink
Change insert method
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Oct 18, 2023
1 parent 8cf1ed1 commit cfaad07
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/mercury_engine_data_structures/formats/bmsld.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from bisect import bisect
from typing import Iterator, Tuple

import construct
Expand Down Expand Up @@ -215,10 +214,5 @@ def compare_func(first: str, second: str) -> bool:

def insert_into_entity_group(self, sub_area: Container, name_to_add: str) -> None:
# MSR requires to have the names in the sub area list sorted by their crc32 value
crcs_list = [
crc32(name)
for name in sub_area.names
]
crc_to_add = crc32(name_to_add)
index = bisect(crcs_list, crc_to_add)
sub_area.names.insert(index, name_to_add)
sub_area.names.append(name_to_add)
sub_area.names.sort(key=crc32)

0 comments on commit cfaad07

Please sign in to comment.