- Fix for loading missions descriptions ios-revival
authorantonc27 <antonc27@mail.ru>
Fri, 14 Aug 2015 02:10:53 +0200
branchios-revival
changeset 11119 f08d5bb1d2b0
parent 11118 600a5af8d61f
child 11120 83c0d96f86ea
- Fix for loading missions descriptions Note: Much way better is to use NSDictionary here! Must be refactored
project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Fri Aug 14 02:09:46 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Fri Aug 14 02:10:53 2015 +0200
@@ -92,11 +92,18 @@
         for (NSUInteger i = 0; i < [self.listOfMissions count]; i++) {
             NSString *desc = [[self.listOfMissions objectAtIndex:i] stringByDeletingPathExtension];
             for (NSString *str in descArray)
+            {
                 if ([str hasPrefix:desc] && [str hasSuffix:@"\""]) {
                     NSArray *descriptionText = [str componentsSeparatedByString:@"\""];
-                    [filteredArray insertObject:[descriptionText objectAtIndex:1] atIndex:i];
+                    [filteredArray addObject:[descriptionText objectAtIndex:1]];
                     break;
                 }
+            }
+            
+            if ([filteredArray count] == i)
+            {
+                [filteredArray addObject:@""];
+            }
         }
         self.listOfDescriptions = filteredArray;
         [filteredArray release];