cocoaTouch/GameSetup.m
changeset 3349 5571592f10a8
parent 3335 2520ee7a5484
child 3356 3ae3fccb439e
equal deleted inserted replaced
3348:5f3b423babcb 3349:5571592f10a8
    71     NSDictionary *hogA1 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Snow Leopard",@"hogname",@"NoHat",@"hat",nil];
    71     NSDictionary *hogA1 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Snow Leopard",@"hogname",@"NoHat",@"hat",nil];
    72     NSDictionary *hogA2 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Leopard",@"hogname",@"NoHat",@"hat",nil];
    72     NSDictionary *hogA2 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Leopard",@"hogname",@"NoHat",@"hat",nil];
    73     NSArray *hedgehogs1 = [[NSArray alloc] initWithObjects:hogA1,hogA2,nil];
    73     NSArray *hedgehogs1 = [[NSArray alloc] initWithObjects:hogA1,hogA2,nil];
    74     [hogA1 release];
    74     [hogA1 release];
    75     [hogA2 release];
    75     [hogA2 release];
       
    76 
    76     NSDictionary *firstTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"4421353",@"color",@"0",@"hash",@"System Cats",@"teamname",
    77     NSDictionary *firstTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"4421353",@"color",@"0",@"hash",@"System Cats",@"teamname",
    77                                @"star",@"grave",@"Earth",@"fort",@"Classic",@"voicepack",@"hedgewars",@"flag",hedgehogs1,@"hedgehogs",
    78                                @"star",@"grave",@"Earth",@"fort",@"Classic",@"voicepack",@"hedgewars",@"flag",hedgehogs1,@"hedgehogs",
    78                                @"93919294221991210322351110012010000002111040400044140044464564444477477611221114440000000000000205500000040007004000000000213111103121111111231141111111111111112111",
    79                                nil];
    79                                @"ammostore",nil];
       
    80     [hedgehogs1 release];
    80     [hedgehogs1 release];
    81     [teams addObject:firstTeam];
    81     [teams addObject:firstTeam];
    82     [firstTeam release];
    82     [firstTeam release];
    83     
    83     
    84     NSDictionary *hogB1 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Raichu",@"hogname",@"Bunny",@"hat",nil];
    84     NSDictionary *hogB1 = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",@"Raichu",@"hogname",@"Bunny",@"hat",nil];
    86     NSArray *hedgehogs2 = [[NSArray alloc] initWithObjects:hogB1,hogB2,nil];
    86     NSArray *hedgehogs2 = [[NSArray alloc] initWithObjects:hogB1,hogB2,nil];
    87     [hogB1 release];
    87     [hogB1 release];
    88     [hogB2 release];
    88     [hogB2 release];
    89     NSDictionary *secondTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"4100897",@"color",@"0",@"hash",@"Poke-MAN",@"teamname",
    89     NSDictionary *secondTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"4100897",@"color",@"0",@"hash",@"Poke-MAN",@"teamname",
    90                                 @"Badger",@"grave",@"UFO",@"fort",@"Default",@"voicepack",@"hedgewars",@"flag",hedgehogs2,@"hedgehogs",
    90                                 @"Badger",@"grave",@"UFO",@"fort",@"Default",@"voicepack",@"hedgewars",@"flag",hedgehogs2,@"hedgehogs",
    91                                 @"93919294221991210322351110012010000002111040400044140044464564444477477611221114440000000000000205500000040007004000000000213111103121111111231141111111111111112111",
    91                                 nil];
    92                                 @"ammostore",nil];
       
    93     [hedgehogs2 release];
    92     [hedgehogs2 release];
    94     [teams addObject:secondTeam];
    93     [teams addObject:secondTeam];
    95     [secondTeam release];
    94     [secondTeam release];
    96 }
    95 }
    97 
    96 
   127         [hogLevelHealthAndName release];
   126         [hogLevelHealthAndName release];
   128         
   127         
   129         NSString *hogHat = [[NSString alloc] initWithFormat:@"ehat %@", [hog objectForKey:@"hat"]];
   128         NSString *hogHat = [[NSString alloc] initWithFormat:@"ehat %@", [hog objectForKey:@"hat"]];
   130         [self sendToEngine: hogHat];
   129         [self sendToEngine: hogHat];
   131         [hogHat release];
   130         [hogHat release];
   132     }
   131     }         
   133     
   132 }
   134     NSString *ammostore = [[NSString alloc] initWithFormat:@"eammstore %@", [teamData objectForKey:@"ammostore"]];
   133 
   135     [self sendToEngine: ammostore];
   134 -(void) sendAmmoData:(NSDictionary *)ammoData {
   136     [ammostore release];
   135     NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@", [ammoData objectForKey:@"ammostore_initialqt"]];
       
   136     [self sendToEngine: ammloadt];
       
   137     [ammloadt release];
       
   138     
       
   139     NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammprob %@", [ammoData objectForKey:@"ammostore_probability"]];
       
   140     [self sendToEngine: ammdelay];
       
   141     [ammdelay release];
       
   142     
       
   143     NSString *ammprob = [[NSString alloc] initWithFormat:@"eammdelay %@", [ammoData objectForKey:@"ammostore_delay"]];
       
   144     [self sendToEngine: ammprob];
       
   145     [ammprob release];
       
   146     
       
   147     NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@", [ammoData objectForKey:@"ammostore_crate"]];
       
   148     [self sendToEngine: ammreinf];
       
   149     [ammreinf release];
       
   150     
       
   151     // sent twice so it applies to both teams
       
   152     NSString *ammstore = [[NSString alloc] initWithString:@"eammstore"];
       
   153     [self sendToEngine: ammstore];
       
   154     [self sendToEngine: ammstore];
       
   155     [ammstore release];
   137 }
   156 }
   138 
   157 
   139 -(void) engineProtocol {
   158 -(void) engineProtocol {
   140 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   159 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   141 	IPaddress ip;
   160 	IPaddress ip;
   218 				
   237 				
   219                 for (NSDictionary *teamData in teams) {
   238                 for (NSDictionary *teamData in teams) {
   220                     [self sendTeamData:teamData withPlayingHogs:2];
   239                     [self sendTeamData:teamData withPlayingHogs:2];
   221                     NSLog(@"teamData sent");
   240                     NSLog(@"teamData sent");
   222                 }
   241                 }
   223 								
   242                 
       
   243                 NSDictionary *ammoData = [[NSDictionary alloc] initWithObjectsAndKeys:
       
   244                                           @"939192942219912103223511100120100000021110",@"ammostore_initialqt",
       
   245                                           @"040504054160065554655446477657666666615550",@"ammostore_probability",
       
   246                                           @"000000000000020550000004000700400000000020",@"ammostore_delay",
       
   247                                           @"131111031211111112311411111111111111121110",@"ammostore_crate", nil];
       
   248                 [self sendAmmoData: ammoData];
       
   249                 [ammoData release];
       
   250                 
   224 			clientQuit = NO;
   251 			clientQuit = NO;
   225 			} else {
   252 			} else {
   226 				NSLog(@"engineProtocolThread - wrong message or client closed connection");
   253 				NSLog(@"engineProtocolThread - wrong message or client closed connection");
   227 				clientQuit = YES;
   254 				clientQuit = YES;
   228 			}
   255 			}