# HG changeset patch # User antonc27 # Date 1455836879 -3600 # Node ID b96080df19d03a8d5d06ebd47eebbcd730a22035 # Parent 73e6a3d2f768b4dac5c99ad9369ec594b273a540 - Send also some seed when loading missions on iOS (same behavior as on desktop) diff -r 73e6a3d2f768 -r b96080df19d0 project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m --- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Wed Feb 17 23:27:13 2016 +0100 +++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Fri Feb 19 00:07:59 2016 +0100 @@ -273,13 +273,14 @@ NSString *script = [gameConfig objectForKey:@"mission_command"]; if ([script length] != 0) [self sendToEngine:script]; - // missions/tranings only need the script configuration set - if ([gameConfig count] == 1) - break; - + // seed info [self sendToEngine:[gameConfig objectForKey:@"seed_command"]]; + // missions/tranings only need the script configuration set and seed + if ([HWUtils gameType] == gtMission) + break; + // dimension of the map [self sendToEngine:[gameConfig objectForKey:@"templatefilter_command"]]; [self sendToEngine:[gameConfig objectForKey:@"mapgen_command"]]; diff -r 73e6a3d2f768 -r b96080df19d0 project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Wed Feb 17 23:27:13 2016 +0100 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Fri Feb 19 00:07:59 2016 +0100 @@ -241,12 +241,18 @@ } +(void) startMissionGame:(NSString *)withScript { + // generate a seed + NSString *seed = [HWUtils seed]; + NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; + [seed release]; + NSString *missionPath = [[NSString alloc] initWithFormat:@"escript Missions/Training/%@.lua",withScript]; - NSDictionary *missionLine = [[NSDictionary alloc] initWithObjectsAndKeys:missionPath,@"mission_command",nil]; + + NSDictionary *missionDict = [[NSDictionary alloc] initWithObjectsAndKeys:missionPath, @"mission_command", seedCmd, @"seed_command", nil]; [missionPath release]; - [self startGame:gtMission atPath:nil withOptions:missionLine]; - [missionLine release]; + [self startGame:gtMission atPath:nil withOptions:missionDict]; + [missionDict release]; } +(void) startSimpleGame {