180 /* basic game flags */ |
180 /* basic game flags */ |
181 NSString *path = [[NSString alloc] initWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()]; |
181 NSString *path = [[NSString alloc] initWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()]; |
182 NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path]; |
182 NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path]; |
183 [path release]; |
183 [path release]; |
184 |
184 |
185 int i = 0; |
185 result = [[basicArray objectAtIndex:0] intValue]; |
186 // initial health |
186 |
187 result = [[basicArray objectAtIndex:i++] intValue]; |
187 for (int i = 1; i < [basicArray count]; i++) { |
188 |
188 NSDictionary *dict = [mods objectAtIndex:i]; |
189 // turn time |
189 NSString *command = [dict objectForKey:@"command"]; |
190 NSInteger tentativeTurntime = [[basicArray objectAtIndex:i++] intValue]; |
|
191 if (tentativeTurntime >= 100) |
|
192 tentativeTurntime = 9999; |
|
193 NSString *turnTime = [[NSString alloc] initWithFormat:@"e$turntime %d",tentativeTurntime * 1000]; |
|
194 [self sendToEngine:turnTime]; |
|
195 [turnTime release]; |
|
196 |
|
197 NSString *minesTime = [[NSString alloc] initWithFormat:@"e$minestime %d",[[basicArray objectAtIndex:i++] intValue] * 1000]; |
|
198 [self sendToEngine:minesTime]; |
|
199 [minesTime release]; |
|
200 |
|
201 for (; i < [basicArray count]; i++) { |
|
202 NSDictionary *basicDict = [mods objectAtIndex:i]; |
|
203 NSString *command = [basicDict objectForKey:@"command"]; |
|
204 NSInteger value = [[basicArray objectAtIndex:i] intValue]; |
190 NSInteger value = [[basicArray objectAtIndex:i] intValue]; |
205 if ([basicDict objectForKey:@"checkOverMax"] && value >= [[basicDict objectForKey:@"max"] intValue]) |
191 if ([[dict objectForKey:@"checkOverMax"] boolValue] && value >= [[dict objectForKey:@"max"] intValue]) |
206 value = 9999; |
192 value = 9999; |
|
193 if ([[dict objectForKey:@"times1000"] boolValue]) |
|
194 value = value * 1000; |
207 NSString *strToSend = [[NSString alloc] initWithFormat:@"%@ %d",command,value]; |
195 NSString *strToSend = [[NSString alloc] initWithFormat:@"%@ %d",command,value]; |
208 [self sendToEngine:strToSend]; |
196 [self sendToEngine:strToSend]; |
209 [strToSend release]; |
197 [strToSend release]; |
210 } |
198 } |
211 [mods release]; |
199 [mods release]; |