project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m
changeset 6494 5e0595f41cde
parent 6353 d8f62c805619
child 6700 e04da46ee43c
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Sun Dec 04 11:53:08 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Sun Dec 04 18:52:22 2011 +0100
@@ -93,13 +93,13 @@
         NSString *descComplete = [[NSString alloc] initWithContentsOfFile:descLocation encoding:NSUTF8StringEncoding error:NULL];
         [descLocation release];
         NSArray *descArray = [descComplete componentsSeparatedByString:@"\n"];
-        NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]];
+        NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]/3];
         [descComplete release];
         // sanity check to avoid having missions and descriptions conflicts
         for (int i = 0; i < [self.listOfMissions count]; i++) {
             NSString *desc = [[self.listOfMissions objectAtIndex:i] stringByDeletingPathExtension];
             for (NSString *str in descArray)
-                if ([str hasPrefix:desc]) {
+                if ([str hasPrefix:desc] && [str hasSuffix:@"\""]) {
                     NSArray *descriptionText = [str componentsSeparatedByString:@"\""];
                     [filteredArray insertObject:[descriptionText objectAtIndex:1] atIndex:i];
                     break;