346 DLog(@"ERROR - wrong protocol number: %d (expecting %d)", netProto, eProto); |
347 DLog(@"ERROR - wrong protocol number: %d (expecting %d)", netProto, eProto); |
347 clientQuit = YES; |
348 clientQuit = YES; |
348 } |
349 } |
349 break; |
350 break; |
350 case 'i': |
351 case 'i': |
351 // initialized with maximum |
|
352 if (self.statsDictionary == nil) |
|
353 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:10]; |
|
354 switch (buffer[1]) { |
352 switch (buffer[1]) { |
355 case 'r': |
353 case 'r': |
356 DLog(@"Winning team: %s", &buffer[2]); |
354 if (self.statsDictionary == nil) |
|
355 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
357 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"winning_team"]; |
356 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"winning_team"]; |
358 break; |
357 break; |
359 case 'D': |
358 case 'D': |
360 DLog(@"Best Shot: %s", &buffer[2]); |
359 if (self.statsDictionary == nil) |
361 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"best_shot"]; |
360 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
361 [self.statsDictionary setObject:[NSString stringWithFormat:@"Best shot: %s", &buffer[2]] forKey:@"best_shot"]; |
362 break; |
362 break; |
363 case 'k': |
363 case 'k': |
364 DLog(@"Best Hedgehog: %s", &buffer[2]); |
364 if (self.statsDictionary == nil) |
365 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"best_hog"]; |
365 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
366 [self.statsDictionary setObject:[NSString stringWithFormat:@"Best hedgehog: %s", &buffer[2]] forKey:@"best_hog"]; |
366 break; |
367 break; |
367 case 'K': |
368 case 'K': |
368 DLog(@"Hogs Killed: %s", &buffer[2]); |
369 if (self.statsDictionary == nil) |
369 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"kills"]; |
370 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
371 [self.statsDictionary setObject:[NSString stringWithFormat:@"%s hogs killed", &buffer[2]] forKey:@"kills"]; |
370 break; |
372 break; |
371 case 'H': |
373 case 'H': |
372 //something about team health |
374 //something about team health |
373 break; |
375 break; |
374 case 'T': |
376 case 'T': |
376 break; |
378 break; |
377 case 'P': |
379 case 'P': |
378 // player postion |
380 // player postion |
379 break; |
381 break; |
380 case 's': |
382 case 's': |
381 DLog(@"Most self damage: %s", &buffer[2]); |
383 if (self.statsDictionary == nil) |
382 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"self_dmg"]; |
384 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
385 [self.statsDictionary setObject:[NSString stringWithFormat:@"%s hit himself", &buffer[2]] forKey:@"self_dmg"]; |
383 break; |
386 break; |
384 case 'S': |
387 case 'S': |
385 DLog(@"Most friendly fire: %s", &buffer[2]); |
388 if (self.statsDictionary == nil) |
386 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"friendly_fire"]; |
389 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
390 [self.statsDictionary setObject:[NSString stringWithFormat:@"%s hit his friends", &buffer[2]] forKey:@"friendly_fire"]; |
387 break; |
391 break; |
388 case 'B': |
392 case 'B': |
389 DLog(@"Most turn skipped by: %s", &buffer[2]); |
393 if (self.statsDictionary == nil) |
390 [self.statsDictionary setObject:[NSString stringWithUTF8String:&buffer[2]] forKey:@"turn_skips"]; |
394 self.statsDictionary = [[NSMutableDictionary alloc] initWithCapacity:statMaxCapacity]; |
|
395 [self.statsDictionary setObject:[NSString stringWithFormat:@"%s skipped most turns", &buffer[2]] forKey:@"turn_skips"]; |
391 break; |
396 break; |
392 default: |
397 default: |
393 DLog(@"Unhandled stat message, see statsPage.cpp"); |
398 DLog(@"Unhandled stat message, see statsPage.cpp"); |
394 break; |
399 break; |
395 } |
400 } |