@@ -2193,30 +2193,23 @@ public function _parseFen($fen)
21932193 $ this ->_WCastleK = false ;
21942194 $ this ->_BCastleQ = false ;
21952195 $ this ->_BCastleK = false ;
2196-
2197- $ wr1 = $ this ->getPiece ('WR1 ' );
2198- $ wr2 = $ this ->getPiece ('WR2 ' );
2199- $ br1 = $ this ->getPiece ('BR1 ' );
2200- $ br2 = $ this ->getPiece ('BR2 ' );
2201-
22022196 if ($ splitFen [2 ] != '- ' ) {
22032197 for ($ i = 0 ; $ i < 4 ; $ i ++) {
22042198 if ($ i >= strlen ($ splitFen [2 ])) {
22052199 continue ;
22062200 }
2207-
22082201 switch ($ splitFen [2 ][$ i ]) {
22092202 case 'K ' :
2210- $ this ->_WCastleK = $ wr1 === ' h1 ' || $ wr2 === ' h1 ' ;
2203+ $ this ->_WCastleK = true ;
22112204 break ;
22122205 case 'Q ' :
2213- $ this ->_WCastleQ = $ wr1 === ' a1 ' || $ wr2 === ' a1 ' ;
2206+ $ this ->_WCastleQ = true ;
22142207 break ;
22152208 case 'k ' :
2216- $ this ->_BCastleK = $ br1 === ' h8 ' || $ br2 === ' h8 ' ;
2209+ $ this ->_BCastleK = true ;
22172210 break ;
22182211 case 'q ' :
2219- $ this ->_BCastleQ = $ br1 === ' a8 ' || $ br2 === ' a8 ' ;
2212+ $ this ->_BCastleQ = true ;
22202213 break ;
22212214 default :
22222215 return $ this ->raiseError (self ::GAMES_CHESS_ERROR_FEN_CASTLEWRONG ,
@@ -3621,8 +3614,8 @@ public function rollbackTransaction()
36213614 public function isBishop ($ pieceName )
36223615 {
36233616 return $ pieceName [1 ] == 'B ' ||
3624- ($ pieceName [1 ] == 'P ' &&
3625- $ this ->_pieces [$ pieceName ][1 ] == 'B ' );
3617+ ($ pieceName [1 ] == 'P ' &&
3618+ $ this ->_pieces [$ pieceName ][1 ] == 'B ' );
36263619 }
36273620
36283621 /**
@@ -3638,8 +3631,8 @@ public function isBishop($pieceName)
36383631 public function isRook ($ pieceName )
36393632 {
36403633 return $ pieceName [1 ] == 'R ' ||
3641- ($ pieceName [1 ] == 'P ' &&
3642- $ this ->_pieces [$ pieceName ][1 ] == 'R ' );
3634+ ($ pieceName [1 ] == 'P ' &&
3635+ $ this ->_pieces [$ pieceName ][1 ] == 'R ' );
36433636 }
36443637
36453638 /**
@@ -3655,7 +3648,7 @@ public function isRook($pieceName)
36553648 public function isPawn ($ pieceName )
36563649 {
36573650 return $ pieceName [1 ] == 'P ' &&
3658- $ this ->_pieces [$ pieceName ][1 ] == 'P ' ;
3651+ $ this ->_pieces [$ pieceName ][1 ] == 'P ' ;
36593652 }
36603653
36613654 /**
@@ -3681,8 +3674,8 @@ public function isKing($pieceName)
36813674 public function _isKnight ($ pieceName )
36823675 {
36833676 return $ pieceName [1 ] == 'N ' ||
3684- ($ pieceName [1 ] == 'P ' &&
3685- $ this ->_pieces [$ pieceName ][1 ] == 'N ' );
3677+ ($ pieceName [1 ] == 'P ' &&
3678+ $ this ->_pieces [$ pieceName ][1 ] == 'N ' );
36863679 }
36873680
36883681 /**
0 commit comments