equal
deleted
inserted
replaced
18 * File created on 10/01/2010. |
18 * File created on 10/01/2010. |
19 */ |
19 */ |
20 |
20 |
21 |
21 |
22 #import "EngineProtocolNetwork.h" |
22 #import "EngineProtocolNetwork.h" |
23 #import "PascalImports.h" |
|
24 #import "CommodityFunctions.h" |
|
25 #import "OverlayViewController.h" |
23 #import "OverlayViewController.h" |
|
24 |
26 |
25 |
27 #define BUFFER_SIZE 255 // like in original frontend |
26 #define BUFFER_SIZE 255 // like in original frontend |
28 |
27 |
29 @implementation EngineProtocolNetwork |
28 @implementation EngineProtocolNetwork |
30 @synthesize delegate, stream, ipcPort, csd; |
29 @synthesize delegate, stream, ipcPort, csd; |
60 } |
59 } |
61 |
60 |
62 #pragma mark - |
61 #pragma mark - |
63 #pragma mark Spawner functions |
62 #pragma mark Spawner functions |
64 -(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary { |
63 -(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary { |
65 self.stream = [[NSOutputStream alloc] initToFileAtPath:onSaveFile append:YES]; |
64 self.stream = (onSaveFile) ? [[NSOutputStream alloc] initToFileAtPath:onSaveFile append:YES] : nil; |
66 [self.stream open]; |
65 [self.stream open]; |
67 |
66 |
68 [NSThread detachNewThreadSelector:@selector(engineProtocol:) |
67 [NSThread detachNewThreadSelector:@selector(engineProtocol:) |
69 toTarget:self |
68 toTarget:self |
70 withObject:dictionary]; |
69 withObject:dictionary]; |
287 |
286 |
288 // lua script (if set) |
287 // lua script (if set) |
289 NSString *script = [gameConfig objectForKey:@"mission_command"]; |
288 NSString *script = [gameConfig objectForKey:@"mission_command"]; |
290 if ([script length] != 0) |
289 if ([script length] != 0) |
291 [self sendToEngine:script]; |
290 [self sendToEngine:script]; |
|
291 // missions/tranings only need the script configuration set |
|
292 if ([gameConfig count] == 1) |
|
293 break; |
292 |
294 |
293 // seed info |
295 // seed info |
294 [self sendToEngine:[gameConfig objectForKey:@"seed_command"]]; |
296 [self sendToEngine:[gameConfig objectForKey:@"seed_command"]]; |
295 |
297 |
296 // dimension of the map |
298 // dimension of the map |