Fix throwing error on conflicts
This commit is contained in:
@@ -190,11 +190,11 @@ class ModList {
|
||||
|
||||
// Only check each pair once
|
||||
for (final modId in activeModIds) {
|
||||
Mod mod = mods[modId]!;
|
||||
final mod = mods[modId]!;
|
||||
|
||||
for (final incompId in mod.incompatibilities) {
|
||||
// Only process if other mod is active and we haven't checked this pair yet
|
||||
if (activeMods.containsKey(incompId) && modId.compareTo(incompId) < 0) {
|
||||
if (activeMods.containsKey(incompId)) {
|
||||
conflicts.add([modId, incompId]);
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class ModList {
|
||||
}
|
||||
|
||||
// Visit all nodes
|
||||
for (Mod mod in mods.values) {
|
||||
for (final mod in mods.values) {
|
||||
if (!mod.visited) {
|
||||
visit(mod);
|
||||
}
|
||||
|
@@ -31,36 +31,28 @@ void main() {
|
||||
id: 'harmony',
|
||||
loadBefore: ["ludeon.rimworld"],
|
||||
size: 47,
|
||||
enabled: true,
|
||||
),
|
||||
'ludeon.rimworld': dummyMod.copyWith(
|
||||
name: 'RimWorld',
|
||||
id: 'ludeon.rimworld',
|
||||
enabled: true,
|
||||
isBaseGame: true,
|
||||
),
|
||||
'ludeon.rimworld.anomaly': dummyMod.copyWith(
|
||||
name: 'RimWorld Anomaly',
|
||||
id: 'ludeon.rimworld.anomaly',
|
||||
enabled: true,
|
||||
isExpansion: true,
|
||||
),
|
||||
'disabledDummy': dummyMod.copyWith(
|
||||
name: 'Disabled Dummy',
|
||||
id: 'disabledDummy',
|
||||
enabled: false,
|
||||
),
|
||||
'yuuuge': dummyMod.copyWith(
|
||||
name: 'Yuuuge',
|
||||
id: 'yuuuge',
|
||||
enabled: true,
|
||||
size: 1000000,
|
||||
),
|
||||
'smol': dummyMod.copyWith(
|
||||
name: 'Smol',
|
||||
id: 'smol',
|
||||
enabled: true,
|
||||
'yuuuge': dummyMod.copyWith(name: 'Yuuuge', id: 'yuuuge', size: 1000000),
|
||||
'smol': dummyMod.copyWith(name: 'Smol', id: 'smol', size: 1),
|
||||
'incompatible': dummyMod.copyWith(
|
||||
name: 'Incompatible',
|
||||
id: 'incompatible',
|
||||
size: 1,
|
||||
incompatibilities: ['harmony'],
|
||||
),
|
||||
};
|
||||
|
||||
@@ -70,6 +62,7 @@ void main() {
|
||||
dummyList.setEnabled(mod, true);
|
||||
}
|
||||
dummyList.setEnabled('disabledDummy', false);
|
||||
dummyList.setEnabled('incompatible', false);
|
||||
final sortedMods = dummyList.generateLoadOrder();
|
||||
|
||||
group('Test sorting', () {
|
||||
@@ -92,5 +85,9 @@ void main() {
|
||||
final yuuugeIndex = sortedMods.indexOf('yuuuge');
|
||||
expect(yuuugeIndex, lessThan(smolIndex));
|
||||
});
|
||||
dummyList.setEnabled('incompatible', true);
|
||||
test('Error generating load order with incompatible mods', () {
|
||||
expect(() => dummyList.generateLoadOrder(), throwsException);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user