Removed NSLog; corrected initial/final letter bug.

Pascal J. Bourguignon [2014-04-03 22:06]
Removed NSLog; corrected initial/final letter bug.
Filename
sources/Hangman.m
sources/HangmanController.m
diff --git a/sources/Hangman.m b/sources/Hangman.m
index b9c80ce..59b20a0 100644
--- a/sources/Hangman.m
+++ b/sources/Hangman.m
@@ -102,7 +102,9 @@
     BOOL error=YES;
     r=[word rangeOfString:letter];
     while(r.length>0){
-        error=NO;
+        if(![[found objectAtIndex:r.location]boolValue]){
+            error=NO;
+        }
         [found replaceObjectAtIndex:r.location withObject:yes];
         NSInteger start=r.location+r.length;
         NSRange searchRange=NSMakeRange(start,length-start);
diff --git a/sources/HangmanController.m b/sources/HangmanController.m
index 77bdce3..22cdf05 100644
--- a/sources/HangmanController.m
+++ b/sources/HangmanController.m
@@ -165,7 +165,6 @@
 -(void)setHangImage:(NSInteger)index{
     if((0<=index)&&(index<=[self maximumErrorCount])){
         NSImage* hungImage=[NSImage imageNamed:[NSString stringWithFormat:@"hung-%ld",(long)index]];
-        NSLog(@"name=%@ hungImage=%@",[NSString stringWithFormat:@"hung-%ld",(long)index],hungImage);
         [image setImage:hungImage];}}

ViewGit