project_files/HedgewarsMobile/Classes/GameSetup.m
changeset 4488 e83216eba1db
parent 4478 05029b4d8490
child 4510 ce9b8206e681
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Dec 08 17:48:33 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Thu Dec 09 22:50:16 2010 +0100
@@ -165,7 +165,6 @@
     [schemePath release];
     NSArray *basicArray = [schemeDictionary objectForKey:@"basic"];
     NSArray *gamemodArray = [schemeDictionary objectForKey:@"gamemod"];
-    int i = 0;
     int result = 0;
     int mask = 0x00000004;
 
@@ -184,22 +183,23 @@
     NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
     [path release];
 
+    int i = 0;
     // initial health
-    result = [[basicArray objectAtIndex:0] intValue];
+    result = [[basicArray objectAtIndex:i++] intValue];
 
     // turn time
-    NSInteger tentativeTurntime = [[basicArray objectAtIndex:1] intValue];
+    NSInteger tentativeTurntime = [[basicArray objectAtIndex:i++] intValue];
     if (tentativeTurntime >= 100)
         tentativeTurntime = 9999;
     NSString *turnTime = [[NSString alloc] initWithFormat:@"e$turntime %d",tentativeTurntime * 1000];
     [self sendToEngine:turnTime];
     [turnTime release];
 
-    NSString *minesTime = [[NSString alloc] initWithFormat:@"e$turntime %d",[[basicArray objectAtIndex:2] intValue] * 1000];
+    NSString *minesTime = [[NSString alloc] initWithFormat:@"e$turntime %d",[[basicArray objectAtIndex:i++] intValue] * 1000];
     [self sendToEngine:minesTime];
     [minesTime release];
 
-    for (i = 2; i < [basicArray count]; i++) {
+    for (; i < [basicArray count]; i++) {
         NSDictionary *basicDict = [mods objectAtIndex:i];
         NSString *command = [basicDict objectForKey:@"command"];
         NSInteger value = [[basicArray objectAtIndex:i] intValue];