project_files/HedgewarsMobile/Classes/GameSetup.m
changeset 4861 91f889289a47
parent 4856 dbc256913b35
child 4924 616b618814b5
equal deleted inserted replaced
4860:4f9d05416fd6 4861:91f889289a47
   394                 }
   394                 }
   395                 break;
   395                 break;
   396             case 'q':
   396             case 'q':
   397                 // game ended, can remove the savefile
   397                 // game ended, can remove the savefile
   398                 [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];
   398                 [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];
   399                 // and remove + disable the overlay
   399                 break;
   400                 [[NSNotificationCenter defaultCenter] postNotificationName:@"remove overlay" object:nil];
   400             case 'Q':
       
   401                 // game exited but not completed, nothing to do (just don't save the message)
   401                 break;
   402                 break;
   402             default:
   403             default:
   403                 [self dumpRawData:buffer ofSize:msgSize];
   404                 [self dumpRawData:buffer ofSize:msgSize];
   404                 break;
   405                 break;
   405         }
   406         }
   406     }
   407     }
   407     DLog(@"Engine exited, ending thread");
   408     DLog(@"Engine exited, ending thread");
   408     // wait a little to let the client close cleanly
   409 
   409     [NSThread sleepForTimeInterval:2];
       
   410     // Close the client socket
   410     // Close the client socket
   411     SDLNet_TCP_Close(csd);
   411     SDLNet_TCP_Close(csd);
   412     SDLNet_Quit();
   412     SDLNet_Quit();
   413 
   413 
   414     [pool release];
   414     [pool release];
   415     //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution.
   415     // Invoking this method should be avoided as it does not give your thread a chance
       
   416     // to clean up any resources it allocated during its execution.
   416     //[NSThread exit];
   417     //[NSThread exit];
   417 }
   418 }
   418 
   419 
   419 #pragma mark -
   420 #pragma mark -
   420 #pragma mark Setting methods
   421 #pragma mark Setting methods