project_files/HedgewarsMobile/Classes/GameSetup.m
changeset 3904 22e4d74240e5
parent 3902 3aac7ca07b0e
child 3910 dd47efbdec46
equal deleted inserted replaced
3903:db01c37494af 3904:22e4d74240e5
    23 #import "SDL_uikitappdelegate.h"
    23 #import "SDL_uikitappdelegate.h"
    24 #import "SDL_net.h"
    24 #import "SDL_net.h"
    25 #import "PascalImports.h"
    25 #import "PascalImports.h"
    26 #import "CommodityFunctions.h"
    26 #import "CommodityFunctions.h"
    27 #import "NSStringExtra.h"
    27 #import "NSStringExtra.h"
       
    28 #import "OverlayViewController.h"
    28 
    29 
    29 #define BUFFER_SIZE 255     // like in original frontend
    30 #define BUFFER_SIZE 255     // like in original frontend
    30 
    31 
    31 @implementation GameSetup
    32 @implementation GameSetup
    32 @synthesize systemSettings, gameConfig, savePath;
    33 @synthesize systemSettings, gameConfig, savePath;
   373                     DLog(@"Setting protocol version %d (%s)", eProto, versionStr);
   374                     DLog(@"Setting protocol version %d (%s)", eProto, versionStr);
   374                 } else {
   375                 } else {
   375                     DLog(@"ERROR - wrong protocol number: [%s] - expecting %d", &buffer[1], eProto);
   376                     DLog(@"ERROR - wrong protocol number: [%s] - expecting %d", &buffer[1], eProto);
   376                     clientQuit = YES;
   377                     clientQuit = YES;
   377                 }
   378                 }
   378 
       
   379                 break;
   379                 break;
   380             case 'i':
   380             case 'i':
   381                 switch (buffer[1]) {
   381                 switch (buffer[1]) {
   382                     case 'r':
   382                     case 'r':
   383                         DLog(@"Winning team: %s", &buffer[2]);
   383                         DLog(@"Winning team: %s", &buffer[2]);
   391                 }
   391                 }
   392                 break;
   392                 break;
   393             case 'q':
   393             case 'q':
   394                 // game ended, can remove the savefile
   394                 // game ended, can remove the savefile
   395                 [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];
   395                 [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];
       
   396                 // so update the relative viewcontroler
       
   397                 [[NSNotificationCenter defaultCenter] postNotificationName:@"removedSave" object:nil];
       
   398                 // and disable the overlay
       
   399                 setGameRunning(NO);
   396                 break;
   400                 break;
   397             default:
   401             default:
   398                 // is it performant to reopen the stream every time? 
   402                 // is it performant to reopen the stream every time? 
   399                 os = [[NSOutputStream alloc] initToFileAtPath:self.savePath append:YES];
   403                 os = [[NSOutputStream alloc] initToFileAtPath:self.savePath append:YES];
   400                 [os open];
   404                 [os open];