project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
changeset 5175 a3da220dbb3f
parent 5174 f5294509783e
child 5177 b850b544addc
equal deleted inserted replaced
5174:f5294509783e 5175:a3da220dbb3f
   175     // the overlay is not needed any more and can be removed
   175     // the overlay is not needed any more and can be removed
   176     [self.overlayController removeOverlay];
   176     [self.overlayController removeOverlay];
   177 
   177 
   178     // warn our host that it's going to be visible again
   178     // warn our host that it's going to be visible again
   179     [self.parentController viewWillAppear:YES];
   179     [self.parentController viewWillAppear:YES];
       
   180 
       
   181     // release the network manager and the savepath as they are not needed anymore
       
   182     [self.engineProtocol release];
       
   183     [self.savePath release];
   180 }
   184 }
   181 
   185 
   182 // set up variables for a local game
   186 // set up variables for a local game
   183 -(void) startLocalGame:(NSDictionary *)withDictionary {
   187 -(void) startLocalGame:(NSDictionary *)withDictionary {
   184     self.gameType = gtLocal;
   188     self.gameType = gtLocal;
   185 
   189 
   186     NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
   190     NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
   187     [outputFormatter setDateFormat:@"yyyy-MM-dd '@' HH.mm"];
   191     [outputFormatter setDateFormat:@"yyyy-MM-dd '@' HH.mm"];
   188     NSString *newDateString = [outputFormatter stringFromDate:[NSDate date]];
   192     self.savePath = [[NSString alloc] initWithFormat:@"%@%@.hws",SAVES_DIRECTORY(),[outputFormatter stringFromDate:[NSDate date]]];
   189     self.savePath = [SAVES_DIRECTORY() stringByAppendingFormat:@"%@.hws", newDateString];
       
   190     [outputFormatter release];
   193     [outputFormatter release];
   191 
   194 
   192     // in the rare case in which a savefile with the same name exists the older one must be removed (or it gets corrupted)
   195     // in the rare case in which a savefile with the same name exists the older one must be removed (or it gets corrupted)
   193     if ([[NSFileManager defaultManager] fileExistsAtPath:self.savePath])
   196     if ([[NSFileManager defaultManager] fileExistsAtPath:self.savePath])
   194         [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];
   197         [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil];