347 DLog(@"ERROR - wrong protocol number: %d (expecting %d)", netProto, eProto); |
346 DLog(@"ERROR - wrong protocol number: %d (expecting %d)", netProto, eProto); |
348 clientQuit = YES; |
347 clientQuit = YES; |
349 } |
348 } |
350 break; |
349 break; |
351 case 'i': |
350 case 'i': |
352 if (self.statsArray == nil) |
351 if (self.statsArray == nil) { |
353 self.statsArray = [[NSMutableArray alloc] initWithCapacity:statMaxCapacity]; |
352 self.statsArray = [[NSMutableArray alloc] initWithCapacity:10 - 2]; |
|
353 NSMutableArray *ranking = [[NSMutableArray alloc] initWithCapacity:4]; |
|
354 [self.statsArray insertObject:ranking atIndex:0]; |
|
355 [ranking release]; |
|
356 } |
354 NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]]; |
357 NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]]; |
355 NSString *arg = [[tempStr componentsSeparatedByString:@" "] objectAtIndex:0]; |
358 NSArray *info = [tempStr componentsSeparatedByString:@" "]; |
|
359 NSString *arg = [info objectAtIndex:0]; |
356 int index = [arg length] + 3; |
360 int index = [arg length] + 3; |
357 switch (buffer[1]) { |
361 switch (buffer[1]) { |
358 case 'r': // winning team |
362 case 'r': // winning team |
359 [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:0]; |
363 [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:1]; |
360 break; |
364 break; |
361 case 'D': // best shot |
365 case 'D': // best shot |
362 [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award was won by %s with %@ points", &buffer[index], arg]]; |
366 [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award won by %s (with %@ points)", &buffer[index], arg]]; |
363 break; |
367 break; |
364 case 'k': // best hedgehog |
368 case 'k': // best hedgehog |
365 [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], arg]]; |
369 [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], arg]]; |
366 break; |
370 break; |
367 case 'K': // number of hogs killed |
371 case 'K': // number of hogs killed |
368 [self.statsArray addObject:[NSString stringWithFormat:@"A total of %@ hedgehog(s) were killed during this round", arg]]; |
372 [self.statsArray addObject:[NSString stringWithFormat:@"%@ hedgehog(s) were killed during this round", arg]]; |
369 break; |
373 break; |
370 case 'H': //something about team health |
374 case 'H': // team health/graph |
371 break; |
375 break; |
372 case 'T': // local team stats |
376 case 'T': // local team stats |
373 break; |
377 // still WIP in statsPage.cpp |
374 case 'P': // player postion |
378 break; |
|
379 case 'P': // teams ranking |
|
380 [[self.statsArray objectAtIndex:0] addObject:tempStr]; |
375 break; |
381 break; |
376 case 's': // self damage |
382 case 's': // self damage |
377 [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]]; |
383 [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]]; |
378 break; |
384 break; |
379 case 'S': // friendly fire |
385 case 'S': // friendly fire |