[board] When loading a FEN string, start with no castling rights
The default value of the castle::Rights struct is with all rights granted. When loading a FEN string, start with none and add to it.
This commit is contained in:
		
							parent
							
								
									9972ce94d0
								
							
						
					
					
						commit
						933924d37a
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		|  | @ -229,9 +229,8 @@ impl FromFenStr for Board { | |||
|         let castling_rights = fields | ||||
|             .next() | ||||
|             .ok_or(FromFenStrError::MissingField(Field::CastlingRights))?; | ||||
|         if castling_rights == "-" { | ||||
|             board.revoke_all_castling_rights(); | ||||
|         } else { | ||||
|         board.revoke_all_castling_rights(); | ||||
|         if castling_rights != "-" { | ||||
|             for ch in castling_rights.chars() { | ||||
|                 match ch { | ||||
|                     'K' => board.grant_castling_right(Color::White, Wing::KingSide), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue