project_files/HedgewarsMobile/Classes/SingleTeamViewController.m
changeset 3574 78fc6e61570b
parent 3547 02875b1145b7
child 3659 f8d5ac50e307
equal deleted inserted replaced
3573:c84067629035 3574:78fc6e61570b
    38 -(BOOL) save:(id) sender {
    38 -(BOOL) save:(id) sender {
    39     NSInteger index = textFieldBeingEdited.tag;
    39     NSInteger index = textFieldBeingEdited.tag;
    40     
    40     
    41     if (textFieldBeingEdited != nil) {
    41     if (textFieldBeingEdited != nil) {
    42         if (TEAMNAME_TAG == index) {
    42         if (TEAMNAME_TAG == index) {
       
    43             if ([textFieldBeingEdited.text length] == 0) 
       
    44                 textFieldBeingEdited.text = self.title;
    43             [self.teamDictionary setObject:textFieldBeingEdited.text forKey:@"teamname"];
    45             [self.teamDictionary setObject:textFieldBeingEdited.text forKey:@"teamname"];
       
    46             self.title = textFieldBeingEdited.text;
    44         } else {
    47         } else {
       
    48             if ([textFieldBeingEdited.text length] == 0) 
       
    49                 textFieldBeingEdited.text = [NSString stringWithFormat:@"hedgehog %d",index];
       
    50             
    45             //replace the old value with the new one            
    51             //replace the old value with the new one            
    46             NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:index];
    52             NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:index];
    47             [hog setObject:textFieldBeingEdited.text forKey:@"hogname"];
    53             [hog setObject:textFieldBeingEdited.text forKey:@"hogname"];
    48         }
    54         }
    49         
    55