Build a list of parent mods before launching.

This commit is contained in:
Paul Chote
2010-11-17 14:14:50 +13:00
parent 3dc16bdbb4
commit 034196ddd6
2 changed files with 23 additions and 7 deletions

View File

@@ -61,14 +61,29 @@ static JSBridge *SharedInstance;
- (BOOL)launchMod:(NSString *)aMod
{
id mod = [[controller allMods] objectForKey:aMod];
if (mod == nil)
{
NSLog(@"Invalid or unknown mod: %@", aMod);
return NO;
}
// Build the list of mods to launch
NSMutableArray *mods = [NSMutableArray array];
NSString *current = aMod;
[controller launchMod:aMod];
// Assemble the mods in the reverse order to work around an engine bug
while (current != nil)
{
Mod *mod = [[controller allMods] objectForKey:current];
if (mod == nil)
{
NSLog(@"Unknown mod: %@", current);
return NO;
}
[mods addObject:current];
if ([mod standalone])
current = nil;
else
current = [mod requires];
}
// Todo: Reverse the array ordering once the engine bug is fixed
[controller launchMod:[mods componentsJoinedByString:@","]];
return YES;
}

View File

@@ -79,6 +79,7 @@
.button:hover
{
background-color: #333;
cursor:pointer;
}
</style>