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