Implement forward bisect
This commit is contained in:
@@ -15,12 +15,21 @@ import 'package:rimworld_modman/mod_list.dart';
|
||||
class ModListTroubleshooter {
|
||||
final ModList originalModList;
|
||||
ModList currentModList;
|
||||
int _startIndex = 0;
|
||||
int _endIndex = 0;
|
||||
|
||||
ModListTroubleshooter(ModList modList)
|
||||
: originalModList = modList,
|
||||
currentModList = modList.copyWith();
|
||||
currentModList = modList.copyWith(),
|
||||
_startIndex = 0,
|
||||
_endIndex = modList.activeMods.length;
|
||||
|
||||
ModList binaryForward() {
|
||||
final midIndex = (_startIndex + _endIndex) ~/ 2;
|
||||
final subset = originalModList.activeMods.keys.toList().sublist(midIndex);
|
||||
currentModList.disableAll();
|
||||
currentModList.enableMods(subset);
|
||||
_startIndex = midIndex;
|
||||
return currentModList;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user